forast
Junior Member level 3
- Joined
- Mar 10, 2014
- Messages
- 25
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Activity points
- 216
I'm quite new to verilog and don't quite understand things that well yet so I apologize if this is a simple question but I'm having a difficult time putting my design into verilog. It's a 64x8 Memory Unit that's suppose to be designed with a 16x4 SRAM. I think I have the decoder module and 16x4 but not sure how to do the 64x8. These are the only three modules I'll need correct?
16x4 SRAM:
2 to 4 Decoder:
I'm clueless at this point and I've looked and couldn't find any examples of this. I usually could do it if there's some sort of guideline or examples but couldn't find any so I'm unsure what to do as I'm really confused with verilog.
16x4 SRAM:
Code:
module ram16x4(
input [3:0] adrs,
inout [3:0] data,
input chip_en, write_en, output_en
);
reg [0:15][3:0] mem;
assign data = ~chip_en & write_en & ~output_en ? mem[adrs]: 4'hz;
always@(*)
begin
if(chip_en == 0)
if(write_en == 0 && output_en == 1)
mem[adrs] = data;
end
endmodule
2 to 4 Decoder:
Code:
module 2to4decoder (a4, a5, _ce0, _ce1, _ce2, _ce3);
output _ce0, _ce1, _ce2, _ce3;
input a4, a5;
assign _ce0 = (~a4) & (~a5);
assign _ce1 = (~a4) & a5;
assign _ce2 = a4 & (~a5);
assign _ce3 = a4 & a5;
endmodule
I'm clueless at this point and I've looked and couldn't find any examples of this. I usually could do it if there's some sort of guideline or examples but couldn't find any so I'm unsure what to do as I'm really confused with verilog.
Last edited: