Cluny
Junior Member level 1
Hi,
I want to calculate the minimum of two values compared to an older minimum value. And I want to do this in one cycle. In my calculation I take the first value and compare it with the old minimum value. Then I take the new (maybe) minimum value and compare it with the second element.
I think that I can only realize this with blocking assignments? for example in the following simplified way:
My question: Is there any better way to do this??? Because if I want to synthesize the code, a lot of warnings, due to the produced latch, are reported.
Cluny
I want to calculate the minimum of two values compared to an older minimum value. And I want to do this in one cycle. In my calculation I take the first value and compare it with the old minimum value. Then I take the new (maybe) minimum value and compare it with the second element.
I think that I can only realize this with blocking assignments? for example in the following simplified way:
Code:
always @(*)
begin
if (value[0] < min)
min = value1;
if (value[1] < min)
min = value2;
end
always @(posedge clk)
begin
min_out <= min;
end
Cluny