The assign
statement is used for driving wire
s.
If you've somethings declared as a reg
, then you have to give it values inside a procedure ( always
or initial
blocks ). It's best practice to only set values of reg
s in the same always
block. eg:
always @( * ) begin // combo logic block
if( some_condition ) begin
icache_ram_rw = 1'b0;
end else begin
icache_ram_rw = something_else;
end
There are important differences between reg
s and wire
s that you should read up on.
I've a feeling though that you'll need some clocked logic if you're driving RAM signals. In this case, you'll need code that looks something like this:
// some parameter definitions to make logic 'read' clearer.
localparam READ = 1'b0;
localparam WRITE = 1'b1;
// standard clocked logic 'template' that synthesis tools recognise.
always @( posedge clk or negedge resetb )
if( !resetb ) begin // asynchronous active low reset
icache_ram_rw = READ;
end else if( some_enable_condition ) begin
icache_ram_rw = WRITE;
end else begin
icache_ram_rw = READ;
end