mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-22 17:31:28 +00:00
fix(parse): #5234 adjust width of rhs according to lhs
This commit is contained in:
parent
c0577890f0
commit
11b829ba70
3 changed files with 32 additions and 1 deletions
|
@ -5974,7 +5974,11 @@ bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, R
|
|||
}
|
||||
}
|
||||
|
||||
return parse(sig, module, str);
|
||||
if (!parse(sig, module, str))
|
||||
return false;
|
||||
if (sig.width_ > lhs.width_)
|
||||
sig.remove(lhs.width_, sig.width_ - lhs.width_);
|
||||
return true;
|
||||
}
|
||||
|
||||
RTLIL::CaseRule::~CaseRule()
|
||||
|
|
10
tests/sat/fminit_noexpand.ys
Normal file
10
tests/sat/fminit_noexpand.ys
Normal file
|
@ -0,0 +1,10 @@
|
|||
read_verilog -sv <<EOF
|
||||
module thing(input [2:0] in, output reg [2:0] out);
|
||||
assign out = in;
|
||||
endmodule
|
||||
EOF
|
||||
|
||||
select -assert-count 0 t:$eq
|
||||
fminit -set out 1'b1
|
||||
select -assert-count 1 t:$eq
|
||||
select -assert-count 1 t:$eq r:A_WIDTH=1 %i
|
17
tests/sat/fminit_seq_width.ys
Normal file
17
tests/sat/fminit_seq_width.ys
Normal file
|
@ -0,0 +1,17 @@
|
|||
read_verilog -sv -formal <<EOF
|
||||
module counter(input clk, input [2:0] rst, input [0:3] rst_val, output logic is_full);
|
||||
logic [1:0] ctr;
|
||||
|
||||
always @(posedge clk)
|
||||
if (rst)
|
||||
ctr <= 0;
|
||||
else
|
||||
ctr <= ctr+1;
|
||||
|
||||
assign is_full = (ctr == 2'b11);
|
||||
endmodule
|
||||
EOF
|
||||
|
||||
hierarchy -check -top counter
|
||||
prep -top counter
|
||||
fminit -seq rst 0,1,2'b11,2'sb11,rst_val
|
Loading…
Add table
Add a link
Reference in a new issue