Including an array in a sensitivity list

K

kb33

Guest
Hi,

I have the following sequential and combinational logic:

reg [31:0] job_time_array[0:7]
job_time_array_comb[0:7];

reg v_bit_array[0:7],
v_bit_array_comb[0:7];


//Sequential logic....
always @(posedge sys_clk)
begin
for (i=0; i < 8; i=i+1)
begin
job_time_array <= job_time_array_comb;
v_bit_array <= v_bit_array_comb;
end


//Combinational logic...
always @(reset_n)
begin
if (~reset_n)
for (k=0; k < 8; k=k+1)
job_time_array_comb[k] <= 0;

else
for(k=0; k < 8; k=k+1)
if ((v_bit_array[k] == 1) && (job_time_array[k] > 0))
job_time_array_comb[k] <= job_time_array[k] - 1;
else
job_time_array_comb[k] <= job_time_array[k];

end

My problem is the following: I want the second FOR loop in the
combinational logic to be executed at each clock cycle, but unless
there is something changing in the sensitivity list, this will not
happen. Is there any way to include the whole of job_time_array in the
sensitivity list so that the FOR loop can be executed?

Thanks
Kanchan
 
On Jun 2, 4:35 am, kb33 <kanchan.devarako...@gmail.com> wrote:
Hi,

I have the following sequential and combinational logic:

reg [31:0] job_time_array[0:7]
job_time_array_comb[0:7];

reg v_bit_array[0:7],
v_bit_array_comb[0:7];

//Sequential logic....
always @(posedge sys_clk)
begin
for (i=0; i < 8; i=i+1)
begin
job_time_array <= job_time_array_comb;
v_bit_array <= v_bit_array_comb;
end

//Combinational logic...
always @(reset_n)
begin
if (~reset_n)
for (k=0; k < 8; k=k+1)
job_time_array_comb[k] <= 0;

else
for(k=0; k < 8; k=k+1)
if ((v_bit_array[k] == 1) && (job_time_array[k] > 0))
job_time_array_comb[k] <= job_time_array[k] - 1;
else
job_time_array_comb[k] <= job_time_array[k];

end

My problem is the following: I want the second FOR loop in the
combinational logic to be executed at each clock cycle, but unless
there is something changing in the sensitivity list, this will not
happen. Is there any way to include the whole of job_time_array in the
sensitivity list so that the FOR loop can be executed?

Thanks
Kanchan

Hi!
Use always@(*)
Should not worry anymore about the sensitivity list and leave it to
the tool.

Rajkumar...
 
Rajkumar Kadam wrote:
Use always@(*)
Should not worry anymore about the sensitivity list and leave it to
the tool.
This is not guaranteed to work. The @* construct is defined in terms
of a normal sensitivity list that it is equivalent to. Since the
equivalent sensitivity list has an array name in it, and an array name
is not legal in an event control, this is not well-defined in the
language.

However, in practice most tools will allow this and give you what you
want, so this is probably good advice.
 
On Jun 4, 2:07 pm, s...@cadence.com wrote:
Rajkumar Kadam wrote:

Use always@(*)
Should not worry anymore about the sensitivity list and leave it to
the tool.

....
However, in practice most tools will allow this and give you what you
want, so this is probably good advice.
Actually, in practice, it doesn't work. XST 9.1 and DC 2004.06 choke
on it and you have to explicitly give each element of each 2D array.

But it does work on the latest modelsim (6.2g+ in my experience) so if
it is just a tool issue and not a restriction of the language as you
say then there is hope that it will work... someday.

SysTom
 
SysTom wrote:
Actually, in practice, it doesn't work. XST 9.1 and DC 2004.06 choke
on it and you have to explicitly give each element of each 2D array.

But it does work on the latest modelsim (6.2g+ in my experience) so if
it is just a tool issue and not a restriction of the language as you
say then there is hope that it will work... someday.
It is an area where the language definition is unclear. It specifies
what the @* expands into, but the thing it expands into is illegal,
and therefore its behavior is undefined.

There was a long discussion of this in the language committee, but
consensus was not reached. It was ultimately dropped as attention
turned to SystemVerilog, partly because SystemVerilog re-invented the
@* wheel with always_comb.

The always_comb construct did get its behavior specified when arrays
are involved. There was an attempt to reduce the sensitivity to
reduce false combinational loops. However, what was specified is not
practical to implement in some cases. Even the person who proposed it
admitted that they did not know a way to implement it efficiently.

So anyway, this behavior is not specified for @* in the language.
However, it is not difficult to implement something that works the way
that users would expect (though with the possibility of false
combinational loops).

Someone from Xilinx was involved in the committee discussions, so they
should be aware of the issues, and of what would be necessary to get
the desired behavior.

Synthesis tools should not have any problem with this. They don't
have to figure out the exact sensitivity; they just have to produce
combinational logic. The construct was introduced to make it easy for
users to make simulators get the same sensitivity that the synthesized
logic already had.
 

Welcome to EDABoard.com

Sponsor

Back
Top