Add Active_High support func and fix LPM part select
This commit is contained in:
parent
b0de1a8d7e
commit
6b73cc39a5
|
|
@ -89,7 +89,7 @@ static int draw_part_select_vp_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
|
||||||
if (NULL == out)
|
if (NULL == out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
selfrom->set_slice(off);
|
selfrom->set_slice(off, ivl_lpm_width(lpm) - 1);
|
||||||
arch->add_stmt(new vhdl_cassign_stmt(out, selfrom));
|
arch->add_stmt(new vhdl_cassign_stmt(out, selfrom));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ static int draw_part_select_pv_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
|
||||||
if (NULL == out)
|
if (NULL == out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
out->set_slice(off);
|
out->set_slice(off, ivl_lpm_width(lpm) - 1);
|
||||||
arch->add_stmt(new vhdl_cassign_stmt(out, selfrom));
|
arch->add_stmt(new vhdl_cassign_stmt(out, selfrom));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ package Verilog_Support is
|
||||||
|
|
||||||
-- Routines to implement Verilog reduction operators
|
-- Routines to implement Verilog reduction operators
|
||||||
function Reduce_OR(X : unsigned) return std_logic;
|
function Reduce_OR(X : unsigned) return std_logic;
|
||||||
|
|
||||||
|
-- Convert Boolean to std_logic
|
||||||
|
function Active_High(B : Boolean) return std_logic;
|
||||||
|
|
||||||
end Verilog_Support;
|
end Verilog_Support;
|
||||||
|
|
||||||
|
|
@ -36,6 +38,15 @@ package body Verilog_Support is
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
return '0';
|
return '0';
|
||||||
end function;
|
end function;
|
||||||
|
|
||||||
|
function Active_High(B : Boolean) return std_logic is
|
||||||
|
begin
|
||||||
|
if B then
|
||||||
|
return '1';
|
||||||
|
else
|
||||||
|
return '0';
|
||||||
|
end if;
|
||||||
|
end function;
|
||||||
|
|
||||||
end Verilog_Support;
|
end Verilog_Support;
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,16 @@ vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
|
||||||
|
|
||||||
return conv;
|
return conv;
|
||||||
}
|
}
|
||||||
|
else if (to->get_name() == VHDL_TYPE_STD_LOGIC &&
|
||||||
|
type_->get_name() == VHDL_TYPE_BOOLEAN) {
|
||||||
|
// Verilog assumes active-high logic and there
|
||||||
|
// is a special routine in verilog_support.vhd
|
||||||
|
// to do this for us
|
||||||
|
vhdl_fcall *ah = new vhdl_fcall("Active_High", vhdl_type::std_logic());
|
||||||
|
ah->add_expr(this);
|
||||||
|
|
||||||
|
return ah;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// We have to cast the expression before resizing or the
|
// We have to cast the expression before resizing or the
|
||||||
// wrong sign bit may be extended (i.e. when casting between
|
// wrong sign bit may be extended (i.e. when casting between
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue