Edge Detector
Edge detector 를 만들고자 한다.
한번에 한 개 bit 만 입력이 된다.
입력이 0 다음에 1 이 입력되면 출력이 1 이 된다.
즉 edge 가 검출된다.
예를 들어 입력이 순서대로 00 01 11 01 0 인 경우 2 개의 edge가 있어 이때 마다 출력은 1 이 된다
if 절 또는 when 절 또는 case 문들을 이용한 Behavior 형태로 (또는 data_flow 와 합성형태도 가능) 작성하시오
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY edge_detector IS
port ( clk, w : IN std_logic;
z : OUT std_logic );
END edge_detector;
ARCHITECTURE edge_detector_a OF edge_detector IS
signal temp1 :std_logic;
signal temp2 :std_logic;
temp1 = '0';
BEGIN
PROCESS(clk)
BEGIN
IF clk THEN
temp2 <= temp1;
temp1 <= w;
END IF;
END PROCESS;
z <= temp1 AND (NOT(temp2));
END edge_detector_a;
components 이용한 Structural 행태로 작성하시오
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY edge_detector IS
PORT ( clk, w : IN std_logic;
z : OUT std_logic );
END edge_detector;
ARCHITECTURE edge_detector_b OF edge_detector IS
SIGNAL clock, a_ : std_logic;
COMPONENT NOT
PORT (I : IN std_logic;
O : OUT std_logic );
END COMPONENT
COMPONENT AND
PORT (I1, I2 : IN std_logic;
O : OUT std_logic );
END COMPONENT
COMPONENT DFF
PORT (D, CLK : IN std_logic;
A : OUT std_logic );
END COMPONENT
BEGIN
DFF1 : DFF PORT MAP(w, clock, ff_out);
NOT1 : NOT(ff_out, a_);
AND1 : AND PORT MAP(w, a_, z);
END edge_detector_b;