mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 05:08:56 +00:00
memory_dff: Recognize read ports with reset / initial value.
This commit is contained in:
parent
24027b5446
commit
72d86c327e
4 changed files with 55 additions and 8 deletions
27
tests/memories/read_arst.v
Normal file
27
tests/memories/read_arst.v
Normal file
|
@ -0,0 +1,27 @@
|
|||
// expect-wr-ports 1
|
||||
// expect-rd-ports 1
|
||||
// expect-rd-clk \clk
|
||||
// expect-rd-en \re
|
||||
// expect-rd-arst-sig \reset
|
||||
// expect-rd-arst-val 8'01011010
|
||||
// expect-rd-init-val 8'00111100
|
||||
|
||||
module top(input clk, input we, re, reset, input [7:0] addr, wdata, output reg [7:0] rdata);
|
||||
|
||||
reg [7:0] bram[0:255];
|
||||
initial rdata = 8'h3c;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (we)
|
||||
bram[addr] <= wdata;
|
||||
end
|
||||
|
||||
always @(posedge clk, posedge reset) begin
|
||||
if (reset)
|
||||
rdata <= 8'h5a;
|
||||
else if (re)
|
||||
rdata <= bram[addr];
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
// expect-wr-ports 1
|
||||
// expect-rd-ports 1
|
||||
// expect-no-rd-clk
|
||||
// expect-rd-clk \clk
|
||||
// expect-rd-en \re
|
||||
// expect-rd-srst-sig \reset
|
||||
// expect-rd-srst-val 8'00000000
|
||||
|
||||
module top(input clk, input we, re, reset, input [7:0] addr, wdata, output reg [7:0] rdata);
|
||||
|
||||
|
|
|
@ -31,6 +31,30 @@ for f in `egrep -l 'expect-(wr-ports|rd-ports|rd-clk)' *.v`; do
|
|||
grep -q "connect \\\\RD_CLK \\$(gawk '/expect-rd-clk/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read clock."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-en $f; then
|
||||
grep -q "connect \\\\RD_EN \\$(gawk '/expect-rd-en/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read enable."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-srst-sig $f; then
|
||||
grep -q "connect \\\\RD_SRST \\$(gawk '/expect-rd-srst-sig/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read sync reset."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-srst-val $f; then
|
||||
grep -q "parameter \\\\RD_SRST_VALUE $(gawk '/expect-rd-srst-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read sync reset value."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-arst-sig $f; then
|
||||
grep -q "connect \\\\RD_ARST \\$(gawk '/expect-rd-arst-sig/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read async reset."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-arst-val $f; then
|
||||
grep -q "parameter \\\\RD_ARST_VALUE $(gawk '/expect-rd-arst-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read async reset value."; false; }
|
||||
fi
|
||||
if grep -q expect-rd-init-val $f; then
|
||||
grep -q "parameter \\\\RD_INIT_VALUE $(gawk '/expect-rd-init-val/ { print $3; }' $f)\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Unexpected read init value."; false; }
|
||||
fi
|
||||
if grep -q expect-no-rd-clk $f; then
|
||||
grep -q "connect \\\\RD_CLK 1'x\$" ${f%.v}.dmp ||
|
||||
{ echo " ERROR: Expected no read clock."; false; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue