raghava216
Junior Member level 3
X : for i in 1 to 7 generate
process(clk,rst)
begin
if (rst = '0')then
d1(i) <= '1';
d2(i) <= '1';
d3(i) <= '1';
d4(i) <= '1';
elsif clk'event and clk = '1' then
d1(i) <= int_n(i);
d2(i) <= d1(i);
d3(i) <= d2(i);
d4(i) <= d3(i);
end if;
end process;
pend_set(i) <= d4(i) and (not d3(i)) and (not d2(i));
process(clk,rst)
begin
if (rst = '0')then
pend_n(i) <= '1';
elsif clk'event and clk= '1' then
if (pend_set(i) = '1') then
pend_n(i) <= '0';
elsif ((i = conv_integer(ack(2 downto 0))) and ack(3) = '0' and ack_n='1'
and ack_n_d3 ='0') then
pend_n(i) <= '1';
end if;
end if;
end process;
end generate X;
I am trying to convert this VHDL code to verilog.
I started with the generate statement then the problem is I can't write an always block inside a for loop in verilog.
Please suggest me how to write the above code in verilog correctly.
process(clk,rst)
begin
if (rst = '0')then
d1(i) <= '1';
d2(i) <= '1';
d3(i) <= '1';
d4(i) <= '1';
elsif clk'event and clk = '1' then
d1(i) <= int_n(i);
d2(i) <= d1(i);
d3(i) <= d2(i);
d4(i) <= d3(i);
end if;
end process;
pend_set(i) <= d4(i) and (not d3(i)) and (not d2(i));
process(clk,rst)
begin
if (rst = '0')then
pend_n(i) <= '1';
elsif clk'event and clk= '1' then
if (pend_set(i) = '1') then
pend_n(i) <= '0';
elsif ((i = conv_integer(ack(2 downto 0))) and ack(3) = '0' and ack_n='1'
and ack_n_d3 ='0') then
pend_n(i) <= '1';
end if;
end if;
end process;
end generate X;
I am trying to convert this VHDL code to verilog.
I started with the generate statement then the problem is I can't write an always block inside a for loop in verilog.
Please suggest me how to write the above code in verilog correctly.