Discussion:
how do i add the two dimensional array to sensitivity list?
(too old to reply)
news.singnet.com.sg
2007-11-29 15:38:37 UTC
Permalink
Basically my design employees 16 pieces of 32-bit registers,

reg [31:0] temp_mem[0:15];

During writing to the memory, fine, I put it in a always @(clock)..
statement.

However during reading, I need it to be in a combinational circuit.

always @(temp_mem or read1 or read2 or read3 ...)

In Verilog I must write "always @(temp_mem[0] or temp_mem[1] or ... or read1
or read2 or read3 ...)
but I don't like the long list.

The reading is too complicated for a simple assign statement.

Any solutions?
g***@lycos.com
2007-11-30 00:32:18 UTC
Permalink
Post by news.singnet.com.sg
Basically my design employees 16 pieces of 32-bit registers,
reg [31:0] temp_mem[0:15];
statement.
However during reading, I need it to be in a combinational circuit.
or read2 or read3 ...)
but I don't like the long list.
The reading is too complicated for a simple assign statement.
Any solutions?
If you are addressing it as memory, you can used just the address in
the sensitivity list. eg:
assign stuff = temp_mem[index];
always @ (index) ...

If you can (or need to) see all of the locations at once, you can
build a vector. eg:
assign vec = {temp_mem[0],temp_mem[1] ...}
always @ (vec) ...


G.
s***@cadence.com
2007-12-02 00:04:38 UTC
Permalink
This post might be inappropriate. Click to display it.
s***@cadence.com
2007-12-02 00:25:23 UTC
Permalink
Post by news.singnet.com.sg
or read2 or read3 ...)
but I don't like the long list.
Any solutions?
The other way to do this would be to use a continuous assignment
instead of trying to use an always block. Continuous assignments were
designed to model combinational logic, and will automatically handle
array references properly. Always blocks were not really designed for
modeling combinational logic. You can make them do so, but you have
to handle the sensitivity yourself and you run into this problem with
arrays.

If you were using an always block because you needed procedural code,
you can get this in a continuous assignment by writing a function that
is used in the continuous assignment and contains your procedural
computation. However, the continuous assignment will assume that the
function represents a "pure" function that computes a combinational
result solely from its input arguments. If it is "impure" and uses
values other than its arguments as inputs, the continuous assignment
will not take that into account.
ajcrm125
2007-12-07 16:53:24 UTC
Permalink
Post by news.singnet.com.sg
Basically my design employees 16 pieces of 32-bit registers,
reg [31:0] temp_mem[0:15];
statement.
However during reading, I need it to be in a combinational circuit.
or read2 or read3 ...)
but I don't like the long list.
The reading is too complicated for a simple assign statement.
Any solutions?
I'm having a similar problem:

reg [0:10] MUX_RXWRD [0:`FIFO_DEPTH-1];
reg [0:10] S_RXWRD [0:`FIFO_DEPTH-1];
wire [0:`FIFIO_DEPTH-1] SHIFT;

always @(S_RXWRD or SHIFT)
begin
for (i=9;i<`FIFO_DEPTH;i=i+1)
MUX_RXWRD[i] = (SHIFT[i]) ? S_RXWRD[i+1] : S_RXWRD[i];
end

Because FIFO_DEPTH is definable, I can't declare a vector as described
above because I have no way on knowing just how big FIFO_DEPTH could
be.
Any ideas?
s***@cadence.com
2007-12-12 02:39:44 UTC
Permalink
Post by ajcrm125
Because FIFO_DEPTH is definable, I can't declare a vector as described
above because I have no way on knowing just how big FIFO_DEPTH could
be.
Sure you can. Just define the width using an expression involving
FIFO_DEPTH.

Continue reading on narkive:
Search results for 'how do i add the two dimensional array to sensitivity list?' (Questions and Answers)
4
replies
investing.What exactly is ....?
started 2007-12-27 21:29:25 UTC
investing
Loading...