본문내용
= 1 = 1
3) Draw the logic diagram by Quartus
① logic diagram
② VHDL source
library ieee;
use ieee.std_logic_1164.all;
entity counter is
port ( clk,rst : in std_logic;
A,B,C,D : buffer std_logic);
end entity counter;
architecture jkf of counter is
signal j1,j2,j3,j4,k1,k2,k3,k4,d1,d2,d3,d4 : std_logic;
begin
process (clk,rst,d1,d2,d3,d4,A,B,C,D)
begin
if (rst =\'1\') then A<= \'0\';
elsif (rst =\'1\') then B<= \'0\';
elsif (rst =\'1\') then C<= \'0\';
elsif (rst =\'1\') then D<= \'0\';
elsif (rising_edge(clk)) then A <= d1;
elsif (rising_edge(clk)) then B <= d2;
elsif (rising_edge(clk)) then C <= d3;
elsif (rising_edge(clk)) then D <= d4;
end if;
end process;
process (j1,k1,d1)
begin
j1 <= B and C and D;
k1 <= C and D;
if (j1=\'0\')and(k1=\'0\') then d1 <= A;
elsif (j1=\'0\')and(k1=\'1\') then d1 <= \'0\';
elsif (j1=\'1\')and(k1=\'0\') then d1 <= \'1\';
elsif (j1=\'1\')and(k1=\'1\') then d1 <= (not A);
end if;
end process;
process (j2,k2,d2)
begin
j2 <= (not A)and C and D;
k2 <= C and D;
if (j2=\'0\')and(k2=\'0\') then d2 <= B;
elsif (j2=\'0\')and(k2=\'1\') then d2 <= \'0\';
elsif (j2=\'1\')and(k2=\'0\') then d2 <= \'1\';
elsif (j2=\'1\')and(k2=\'1\') then d2 <= (not B);
end if;
end process;
process (j3,k3,d3)
begin
j3 <= D;
k3 <= D;
if (j3=\'0\')and(k3=\'0\') then d3 <= C;
elsif (j3=\'0\')and(k3=\'1\') then d3 <= \'0\';
elsif (j3=\'1\')and(k3=\'0\') then d3 <= \'1\';
elsif (j3=\'1\')and(k3=\'1\') then d3 <= (not C);
end if;
end process;
process (j4,k4,d4)
begin
j4 <= \'1\';
k4 <= \'1\';
if (j4=\'0\')and(k4=\'0\') then d4 <= D;
elsif (j4=\'0\')and(k4=\'1\') then d4 <= \'0\';
elsif (j4=\'1\')and(k4=\'0\') then d4 <= \'1\';
elsif (j4=\'1\')and(k4=\'1\') then d4 <= (not D);
end if;
end process;
end jkf;
⇒ VHDL에 의한 결과
⇒ logic diagram에 의한 결과
5. 결과
12진 카운터를 JK플립플롭으로 설계해봤습니다. VHDL을 사용하는 것이 아직은 익숙치 않아 힘들었지만 꽤 길게 짜여진거에 비하면 쉬웠습니다. 그리고 플립플롭의 사용 방법과 용도를 확실히 알 수 있는 계기가 된 것 같습니다.
3) Draw the logic diagram by Quartus
① logic diagram
② VHDL source
library ieee;
use ieee.std_logic_1164.all;
entity counter is
port ( clk,rst : in std_logic;
A,B,C,D : buffer std_logic);
end entity counter;
architecture jkf of counter is
signal j1,j2,j3,j4,k1,k2,k3,k4,d1,d2,d3,d4 : std_logic;
begin
process (clk,rst,d1,d2,d3,d4,A,B,C,D)
begin
if (rst =\'1\') then A<= \'0\';
elsif (rst =\'1\') then B<= \'0\';
elsif (rst =\'1\') then C<= \'0\';
elsif (rst =\'1\') then D<= \'0\';
elsif (rising_edge(clk)) then A <= d1;
elsif (rising_edge(clk)) then B <= d2;
elsif (rising_edge(clk)) then C <= d3;
elsif (rising_edge(clk)) then D <= d4;
end if;
end process;
process (j1,k1,d1)
begin
j1 <= B and C and D;
k1 <= C and D;
if (j1=\'0\')and(k1=\'0\') then d1 <= A;
elsif (j1=\'0\')and(k1=\'1\') then d1 <= \'0\';
elsif (j1=\'1\')and(k1=\'0\') then d1 <= \'1\';
elsif (j1=\'1\')and(k1=\'1\') then d1 <= (not A);
end if;
end process;
process (j2,k2,d2)
begin
j2 <= (not A)and C and D;
k2 <= C and D;
if (j2=\'0\')and(k2=\'0\') then d2 <= B;
elsif (j2=\'0\')and(k2=\'1\') then d2 <= \'0\';
elsif (j2=\'1\')and(k2=\'0\') then d2 <= \'1\';
elsif (j2=\'1\')and(k2=\'1\') then d2 <= (not B);
end if;
end process;
process (j3,k3,d3)
begin
j3 <= D;
k3 <= D;
if (j3=\'0\')and(k3=\'0\') then d3 <= C;
elsif (j3=\'0\')and(k3=\'1\') then d3 <= \'0\';
elsif (j3=\'1\')and(k3=\'0\') then d3 <= \'1\';
elsif (j3=\'1\')and(k3=\'1\') then d3 <= (not C);
end if;
end process;
process (j4,k4,d4)
begin
j4 <= \'1\';
k4 <= \'1\';
if (j4=\'0\')and(k4=\'0\') then d4 <= D;
elsif (j4=\'0\')and(k4=\'1\') then d4 <= \'0\';
elsif (j4=\'1\')and(k4=\'0\') then d4 <= \'1\';
elsif (j4=\'1\')and(k4=\'1\') then d4 <= (not D);
end if;
end process;
end jkf;
⇒ VHDL에 의한 결과
⇒ logic diagram에 의한 결과
5. 결과
12진 카운터를 JK플립플롭으로 설계해봤습니다. VHDL을 사용하는 것이 아직은 익숙치 않아 힘들었지만 꽤 길게 짜여진거에 비하면 쉬웠습니다. 그리고 플립플롭의 사용 방법과 용도를 확실히 알 수 있는 계기가 된 것 같습니다.
소개글