achaleus
Member level 5
- Joined
- Dec 21, 2012
- Messages
- 85
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,288
- Location
- Bangalore
- Activity points
- 1,866
hi all, I want to generate case conditions, I wrote like this but state is not inc and output is wrong..
just help me how to write these generate statement, I need to repeat the code inside case condition (say 100) according to 'j' value and has to change state also(next case condition)
generate
for(j=0; j<ENGINES; j=j+1)
begin
always @(posedge clk)
begin
if(rst)
begin
WRSTATE <= 10'd0;
s1i_rdy <= 1'b0;
WRSTATE_D <= 10'd0;
N <= 10'd0;
end
else
begin
case(WRSTATE)
N :
begin
s1i_rdy <= s1i_rdy_d[j];
if(s1i_rdy_d[j])
begin
s1i_valid_d[j] <= s1i_valid;
s1i_data_d[j] <= s1i_data;
end
else
begin
WRSTATE <= WRSTATE_D + 1'b1;
s1i_valid_d[j] <= 1'b0;
end
end
default : WRSTATE <= 10'd0;
endcase
N <= N + 1'b1;
end
end
end
endgenerate
just help me how to write these generate statement, I need to repeat the code inside case condition (say 100) according to 'j' value and has to change state also(next case condition)
generate
for(j=0; j<ENGINES; j=j+1)
begin
always @(posedge clk)
begin
if(rst)
begin
WRSTATE <= 10'd0;
s1i_rdy <= 1'b0;
WRSTATE_D <= 10'd0;
N <= 10'd0;
end
else
begin
case(WRSTATE)
N :
begin
s1i_rdy <= s1i_rdy_d[j];
if(s1i_rdy_d[j])
begin
s1i_valid_d[j] <= s1i_valid;
s1i_data_d[j] <= s1i_data;
end
else
begin
WRSTATE <= WRSTATE_D + 1'b1;
s1i_valid_d[j] <= 1'b0;
end
end
default : WRSTATE <= 10'd0;
endcase
N <= N + 1'b1;
end
end
end
endgenerate