VHDL correspondance of Verilog construct

F

Floresita

Hi,

following question:


Verilog-code:

always@(posedge clk)
if (reset)
number <= 3'd 0;
else if(valid) begin
....
show = (number >= 3);
...
end


How are these Verilog constructs described in VHDL ?

Thank you.

Rgds
 
K

Kai Harrekilde-Petersen

Hi,

following question:


Verilog-code:

always@(posedge clk)
if (reset)
number <= 3'd 0;
else if(valid) begin
....
show = (number >= 3);
...
end


How are these Verilog constructs described in VHDL ?

process (clk)
begin
if rising_edge(clk) then
if reset = '1' then
number <= (others => '0');
else
...
end if;
end if;
end process;

Note that you get a synchronous reset in your design above.


Regards,


Kai
 
F

fe

Verilog-code:
always@(posedge clk)
if (reset)
number <= 3'd 0;
else if(valid) begin
....
show = (number >= 3);
...
end
The implementation in VHDL depend on the type of each signals/ports.
Example:
if reset is a std_logic input port
and number is an unsigned(2 downto 0) signal
and valid is a boolean signal
and I suppose that show is only use inside the always block (use of blocking
assignment inside a clocked always block generate race condition if read
outside)
then

VHDL code

process(clk)
variable show : boolean;
begin
if rising_edge(clk) then
if reset = '1' then
number <= (others => '0');
elsif valid then -- note the difference between a boolean (valid) and a
std_logic (reset)
....
show := (number >= 3);
...
end if;
end if;
end process;

regards
fe
 
O

Oggie

Hi,

following question:


Verilog-code:

always@(posedge clk)
if (reset)
number <= 3'd 0;
else if(valid) begin
....
show = (number >= 3);
...
end


How are these Verilog constructs described in VHDL ?

Thank you.

Rgds

Here is the answer:

signal clk, reset, valid, show : std_logic;
signal number : std_logic_vector(2 downto 0);

process(clk)
begin
if rising_edge(clk) then
if(reset = '1') then
number <= (others => '0');
else
if(valid = '1') then
......
if(number >= "011") then
show <= '1';
else
show <= '0';
end if;
......
end if;
end if;
end if;
end process;

Cheers!
Oggie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top