F
fpgabuilder
Guest
Specifically, what is the difference between the following two
snippets of code in my behavioral model? i is a genvar.
always@(*)
begin
adc_d[(i+1)*DATA_WIDTH-1i*DATA_WIDTH)] = (pixel_cnt[0]) ?
~(pixel_cnt + i*NUM_OF_SENSOR_TAPS) :
(pixel_cnt + i*NUM_OF_SENSOR_TAPS) ;
end
assign adc_d[(i+1)*DATA_WIDTH-1i*DATA_WIDTH)] = (pixel_cnt[0]) ?
~(pixel_cnt + i*NUM_OF_SENSOR_TAPS) :
(pixel_cnt + i*NUM_OF_SENSOR_TAPS) ;
pixel_cnt is declared as shortint. It is held in reset at the
beginning of the simulation. Its reset value is 0. An initial block
asserts a reset which holds the pixel_cnt in reset. The reset is
released by a clock event which also increments the pixel_cnt.
The adc_d in the procedural block does not get a valid value before
pixel_cnt is incremented whereas adc_c that is continuously assigned
does get a valid value derived from the pixel_cnt before it is
incremented. I haven't been able to explain this yet. Any thoughts?
snippets of code in my behavioral model? i is a genvar.
always@(*)
begin
adc_d[(i+1)*DATA_WIDTH-1i*DATA_WIDTH)] = (pixel_cnt[0]) ?
~(pixel_cnt + i*NUM_OF_SENSOR_TAPS) :
(pixel_cnt + i*NUM_OF_SENSOR_TAPS) ;
end
assign adc_d[(i+1)*DATA_WIDTH-1i*DATA_WIDTH)] = (pixel_cnt[0]) ?
~(pixel_cnt + i*NUM_OF_SENSOR_TAPS) :
(pixel_cnt + i*NUM_OF_SENSOR_TAPS) ;
pixel_cnt is declared as shortint. It is held in reset at the
beginning of the simulation. Its reset value is 0. An initial block
asserts a reset which holds the pixel_cnt in reset. The reset is
released by a clock event which also increments the pixel_cnt.
The adc_d in the procedural block does not get a valid value before
pixel_cnt is incremented whereas adc_c that is continuously assigned
does get a valid value derived from the pixel_cnt before it is
incremented. I haven't been able to explain this yet. Any thoughts?