3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-19 22:00:33 +00:00

memory_dff: Recognize read ports with reset / initial value.

This commit is contained in:
Marcelina Kościelnicka 2021-05-27 21:08:11 +02:00
parent 24027b5446
commit 72d86c327e
4 changed files with 55 additions and 8 deletions

View 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