[논리회로설계]FSM binary/gray counter
본 자료는 4페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
해당 자료는 4페이지 까지만 미리보기를 제공합니다.
4페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

[논리회로설계]FSM binary/gray counter에 대한 보고서 자료입니다.

목차

없음

본문내용

"101"이 되고, 이 상태 다음은 "100"이 되고, 다시 "000"이 된다. 이것이 계속 반복 된다.
5. Discuss how you test it.
'RoV-Lab 3000'이라는 Kit를 이용해서 test 했다.
일단 초기화를 시켜서 state를 "000"으로 만든다.
우선 모드를 '1'로 만들어서 'Binary Counter'로 만들기 위해 DIP_SW3를 off를 시킨다. dip switch는 on일 때 '0'이다. 그런 뒤 led를 확인한다. 그러면 led가 "001", "010", "011", "100", "101", "110", "111", "000"순서로 바뀐다.
우선 모드를 '1'로 만들어서 'Gray Counter'로 만들기 위해 DIP_SW3를 on을 시킨다. dip switch는 on일 때 '0'이다. 그런 뒤 led를 확인한다. 그러면 led가 "001", "011", "010", "110", "111", "101", "100", "000" 순서로 바뀐다.
KIT와 연결하여 LCD화면을 통해서 출력한다.
NET "mode" LOC="p16";
NET "rst" LOC="p205";
NET "clk" LOC="p79";
NET "cnt(0)" LOC="p2";
NET "cnt(1)" LOC="p3";
NET "cnt(2)" LOC="p4";
UCF파일로 KIT의 핀과 코드의 입 출력을 연결하고
기계에 implement 하여 결과 값을 눈으로 확인한다.
6. Provide the simulation result and the code
binary counter 000부터 111까지 실습 장면
000
001
010
011
100
101
110
111
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--입출력 선언부분
entity bin_gray_cnt is
port( clk, rst, mode : in std_logic;
cnt : out std_logic_vector( 2 downto 0 ) );
end bin_gray_cnt;
architecture Behavioral of bin_gray_cnt is
--내부신호선언
signal state : std_logic_vector(2 downto 0);
signal clk_d : std_logic;
begin
--분주회로
process(rst, clk)
--분주회로 변수 선언
variable count_clk : integer range 0 to 4000000;
begin
if (rst = '0') then
clk_d <= '0';
count_clk :=0;
elsif (clk'event and clk = '1')then
if (count_clk = 4000000) then
--count_clk가 4000000이되면 clk_d는 L에서 H로 H에서 L로 변함.
clk_d <= not clk_d;
count_clk :=0;
else
count_clk := count_clk+1;
end if;
end if;
end process;
--binary/gray counter 부분
process (clk_d, rst, mode)
begin
--비동기식 리셋 rst가 0이되면 state값은 000이된다.
if (rst = '0') then
state <= (others => '0');
elsif clk_d='1' and clk_d'event then
case state is
--counter 동작부분 state 000 ~ 111까지 mode에 따라 binary 또는 gray 로 동작.
when "000" =>
if mode = '1' then state <= "001";
else state <= "001";
end if;
when "001"=>
if mode = '1' then state <= "010";
else state <= "011";
end if;
when "010"=>
if mode = '1' then state <= "011";
else state <= "110";
end if;
when "011"=>
if mode = '1' then state <= "100";
else state <= "010";
end if;
when "100"=>
if mode = '1' then state <= "101";
else state <= "000";
end if;
when "101"=>
if mode = '1' then state <= "110";
else state <= "100";
end if;
when "110"=>
if mode = '1' then state <= "111";
else state <= "111";
end if;
when "111"=>
if mode = '1' then state <= "000";
else state <= "101";
end if;
when others => null;
end case;
end if;
end process;
--state를 cnt로 저장하여 출력하는 부분.
cnt <= state;
end Behavioral;
Conclusion
'Binary Counter'와 'Gray Counter'를 구분하고 설계하며 모드변경을 통해 2가지 Counter를 한꺼번에 구동되도록 설계할 수 있다. 모드 변경에는 'case'를 사용한다. Asynchronous reset은 clock과 상관없이 동작된다.
분주회로를 통해 clock을 느리게 하여 사용할 수 있다. (kit에서는 4MHz의 clk가 입력된다.) variable을 이용해서 코딩을 할 수 있다. variable은 signal과 비슷하지만 scheduling을 하지 않는다는 점에서 차이점을 보인다. 실제 Kit를 사용해서 설계한 회로를 실험하여 testbench 코드가 필요 없으며 출력값이 직관적이다.
Evaluation
state를 한정한 counter를 모드에 따라서 binary로 또는 gray로 동작하도록 하는 것으로 회로의 이해가 어렵거나 코딩이 복잡하지는 않았다.
분주회로나 비동기식 리셋도 경험해본 부분이라 전반적으로 실험이 빨리 이해되었고 끝날 수 있었다.

키워드

  • 가격1,500
  • 페이지수13페이지
  • 등록일2014.06.23
  • 저작시기2014.5
  • 파일형식한글(hwp)
  • 자료번호#925442
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니