Artlav
Full Member level 2
- Joined
- Nov 26, 2010
- Messages
- 144
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Activity points
- 2,723
Hello.
Trying to get a mixed VHDL/Verilog project to a common denominator, specifically Verilog.
But there is a piece that i don't know how to translate.
VHDL original:
This compiles fine and without warnings.
First attempt, translated as written.
Getting "Unexpected event in always block sensitivity list" error for the second "always".
Apparently, you can not put edge and level sensitive signals in one always block.
Second attempt, tried to start to work around it, but now i get "Found 4-bit latch for signal <cnt>." warnings.
Trying to resolve the latch by adding a last else produce lots of "the following signal(s) form a combinatorial loop" warnings.
Which is kind of the point, but didn't happen in the VHDL case.
In any case, i still have no idea how to do the rising edge trigger properly here, and i'm not familiar enough with the design to reimplement it by the meaning.
So, can anyone help to translate this part correctly?
- - - Updated - - -
Resolved the problem like so:
Sorry for the bother.
Trying to get a mixed VHDL/Verilog project to a common denominator, specifically Verilog.
But there is a piece that i don't know how to translate.
VHDL original:
Code:
process (cnt) is
begin
if (cnt = "0000") then
stop <= '1';
else
stop <= '0';
end if;
end process;
process (rst,stop,c[10]) is
begin
if (rst='0') then
cnt <= "0001";
elsif ((rising_edge(c[10])) and (stop='0')) then
cnt <= cnt + 1;
end if;
end process;
First attempt, translated as written.
Getting "Unexpected event in always block sensitivity list" error for the second "always".
Apparently, you can not put edge and level sensitive signals in one always block.
Code:
always @(cnt)
begin
if (cnt==4'b0000) begin
stop <= 1'b1;
end else begin
stop <= 1'b0;
end
end
always @(rst or stop or posedge c[10])
begin
if (!rst) begin
cnt <= 4'b0001;
end else if (c[10] && !stop) begin
cnt <= cnt + 1'b1;
end
end
Second attempt, tried to start to work around it, but now i get "Found 4-bit latch for signal <cnt>." warnings.
Code:
always @(rst or stop or c[10])
...
Trying to resolve the latch by adding a last else produce lots of "the following signal(s) form a combinatorial loop" warnings.
Which is kind of the point, but didn't happen in the VHDL case.
In any case, i still have no idea how to do the rising edge trigger properly here, and i'm not familiar enough with the design to reimplement it by the meaning.
So, can anyone help to translate this part correctly?
- - - Updated - - -
Resolved the problem like so:
Code:
always @(negedge rst or posedge c[10])
begin
if (!rst) begin
cnt <= 4'b0001;
end else if (!stop) begin
cnt <= cnt + 1'b1;
end
end
Sorry for the bother.