Abhisek hota
Newbie level 1
- Joined
- Mar 15, 2015
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 10
Code Verilog - [expand] 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 28 29 30 31 32 33 34 35 module ram_mem(din,add,rst,clk,en,rw,dout); input [3:0]din; input [5:0]add; input rst,clk,en,rw; output reg [3:0]dout; reg [3:0]mem[0:63]; always@(clk) begin if(en) begin always@(posedge clk or negedge rst) begin if(rw) mem[add]<=din; else dout<=mem[add]; end end else begin always@(negedge clk or negedge rst) begin if(rw) mem[add]<=din; else dout<=mem[add]; end end end endmodule
Last edited by a moderator: