HELP, processes

H

Herr P

Why do people say then I cant write en d-latch like this?

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity d_latch is
port(d, clk : in std_logic;
q : out std_logic);
end d_latch;

architecture beh of d_latch is
begin
process(clk)
begin
if clk = '1' then -- check if clk went up (had a rising edge)
q <= d;
end if;
end process;
end beh;

The clk is on the sensitivity list of the process, so the process should
respond to changes on clk (also called edges), so why cant I writ it like
this?
When the process starts I know that clk had an edge, and then I test clk if
it is a '1', then I know that is was a rising edge.

Or am I wrong about sensitivity lists?

/ A beginner at VHDL
 

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,813
Messages
2,569,697
Members
45,488
Latest member
MohammedHa

Latest Threads

Top