aboutsummaryrefslogtreecommitdiffstats
path: root/tests/memories/read_arst.v
blob: 6100cc4a787cd7f6af1b2a3baaa5ea63509c272a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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