Accessing word (32-bit) in byte aligned memory
module data_mem ( input clk, input [31:0] addr, input [31:0] wdata, input wr_en, input rd_en, output [31:0] rdata ); reg [7:0] Mem [255:0]; assign rdata = rd_en ? Mem[addr] : 32'bxxxx_xxxx; always @(posedge clk) begin if (wr_en) Mem[addr] <= wdata; end endmodule I want to assign wdata to 4 bytes Mem[3:0] for a write when the wr_en flag is 1. More specifically, Mem[addr+3: addr]. How can I do this?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.