firstcommit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
|
||||
# 7SEG
|
||||
|
||||
실습키트의 7SEGMENT의 출력이 정상적으로 되는지 확인한다.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## PIN 테이블
|
||||
|
||||
|
||||
| 핀 번호 | 신호 |
|
||||
|---------|------|
|
||||
| PIN_AA13 | led_out[0] |
|
||||
| PIN_AA14 | led_out[1] |
|
||||
| PIN_AA15 | led_out[2] |
|
||||
| PIN_AA16 | led_out[3] |
|
||||
| PIN_AA17 | led_out[4] |
|
||||
| PIN_AA18 | led_out[5] |
|
||||
| PIN_AA19 | led_out[6] |
|
||||
| PIN_AA20 | led_out[7] |
|
||||
| PIN_AB14 | seg[6] |
|
||||
| PIN_AB15 | seg[5] |
|
||||
| PIN_AB16 | seg[4] |
|
||||
| PIN_AB17 | seg[3] |
|
||||
| PIN_AB18 | seg[2] |
|
||||
| PIN_AB19 | seg[1] |
|
||||
| PIN_AB20 | seg[0] |
|
||||
|
||||
|
||||
|
||||
## VHDL 코드
|
||||
|
||||
```vhdl
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity seg_out is
|
||||
port(
|
||||
seg : out std_logic_vector(6 downto 0); -- 7-세그 출력 (g~a)
|
||||
led_out : out std_logic_vector(0 to 7) -- 기존 인덱스(0 to 7)
|
||||
);
|
||||
end seg_out;
|
||||
|
||||
architecture SegmentDecoder of seg_out is
|
||||
signal key : integer range 0 to 15 := 5; -- 표시할 숫자 (0~15)
|
||||
begin
|
||||
----------------------------------------------------------------
|
||||
-- with-select: key 값 → seg 패턴 매핑 (VHDL-93 호환)
|
||||
----------------------------------------------------------------
|
||||
with key select
|
||||
seg <=
|
||||
"100" & "0000" when 0, -- 0
|
||||
"111" & "1001" when 1, -- 1
|
||||
"010" & "0100" when 2, -- 2
|
||||
"011" & "0000" when 3, -- 3
|
||||
"001" & "1001" when 4, -- 4
|
||||
"001" & "0010" when 5, -- 5
|
||||
"000" & "0010" when 6, -- 6
|
||||
"111" & "1000" when 7, -- 7
|
||||
"000" & "0000" when 8, -- 8
|
||||
"001" & "0000" when 9, -- 9
|
||||
"000" & "1000" when 10, -- A
|
||||
"000" & "0011" when 11, -- b
|
||||
"100" & "0110" when 12, -- C
|
||||
"010" & "0001" when 13, -- d
|
||||
"000" & "0110" when 14, -- E
|
||||
"000" & "1110" when 15, -- F
|
||||
"111" & "1111" when others; -- blank
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- LED 개별 비트 설정: 기존 코드 그대로 유지
|
||||
----------------------------------------------------------------
|
||||
led_out(7) <= '1'; -- LED 7번 ON
|
||||
led_out(6) <= '1';
|
||||
led_out(5) <= '1';
|
||||
led_out(4) <= '0'; -- LED 4번 ON
|
||||
led_out(3) <= '0';
|
||||
led_out(2) <= '0';
|
||||
led_out(1) <= '1';
|
||||
led_out(0) <= '1'; -- LED 0번 ON
|
||||
|
||||
end architecture;
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user