Tajwar
Newbie level 6
- Joined
- May 19, 2013
- Messages
- 14
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,404
I am trying to read/ write a file from mem.
here is my code. I have an error "" if any1 can help me.
ERROR:HDLCompilers:247 - "wr_file.v" line 34 Reference to vector wire 'data_out' is not a legal reg or variable lvalue
ERROR:HDLCompilers:106 - "wr_file.v" line 34 Illegal left hand side of nonblocking assignment
module wr_file(clk, we, add, data_in, data_out);
input clk, we;
input [3:0] add;
input [31:0] data_in;
output [31:0]data_out;
reg [31:0] memory[7:0];
always @(posedge clk)
begin
if(we)
memory[add] <= data_in;
else
data_out <= memory[add];
end
memory mem (
.clka(clk),
.wea(we), // Bus [0 : 0]
.addra(add), // Bus [2 : 0]
.dina(data_in), // Bus [31 : 0]
.douta(data_out));
endmodule
here is my code. I have an error "" if any1 can help me.
ERROR:HDLCompilers:247 - "wr_file.v" line 34 Reference to vector wire 'data_out' is not a legal reg or variable lvalue
ERROR:HDLCompilers:106 - "wr_file.v" line 34 Illegal left hand side of nonblocking assignment
module wr_file(clk, we, add, data_in, data_out);
input clk, we;
input [3:0] add;
input [31:0] data_in;
output [31:0]data_out;
reg [31:0] memory[7:0];
always @(posedge clk)
begin
if(we)
memory[add] <= data_in;
else
data_out <= memory[add];
end
memory mem (
.clka(clk),
.wea(we), // Bus [0 : 0]
.addra(add), // Bus [2 : 0]
.dina(data_in), // Bus [31 : 0]
.douta(data_out));
endmodule