neefa
Member level 1

hi frnz,
I need to implement a RAM.which is designed in such a way that it takes 32 bit input with 32 registers and it should give the o/p in 4 parallel sequence 8 bits each In my code iam unable to get this .plzz help...iam attaching my code here.
module ram4(q,q1,q2,q3,q4, d, a, we, clk);
output [31:0] q;
output [7:0] q1;
output [7:0] q2;
output [7:0] q3;
output [7:0] q4;
input [31:0] d;
input [4:0] a;
input we;
input clk;
reg [31:0] read_add;
reg [31:0] mem [31744:0];
//reg [31:0]temp_reg;
always @(posedge clk) begin
if (we)
mem[a] <= d;
read_add <= a;
end
assign q = mem[read_add];
assign q1 = q[7:0];
assign q2 = q[15:8];
assign q3 = q[23:16];
assign q4 = q[31:24];
endmodule
thanks.
I need to implement a RAM.which is designed in such a way that it takes 32 bit input with 32 registers and it should give the o/p in 4 parallel sequence 8 bits each In my code iam unable to get this .plzz help...iam attaching my code here.
module ram4(q,q1,q2,q3,q4, d, a, we, clk);
output [31:0] q;
output [7:0] q1;
output [7:0] q2;
output [7:0] q3;
output [7:0] q4;
input [31:0] d;
input [4:0] a;
input we;
input clk;
reg [31:0] read_add;
reg [31:0] mem [31744:0];
//reg [31:0]temp_reg;
always @(posedge clk) begin
if (we)
mem[a] <= d;
read_add <= a;
end
assign q = mem[read_add];
assign q1 = q[7:0];
assign q2 = q[15:8];
assign q3 = q[23:16];
assign q4 = q[31:24];
endmodule
thanks.