Advertisement
giuliascott14

SevenSegmentDecoder

Mar 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.88 KB | None | 0 0
  1. --SEVEN-SEGMENT DECODER
  2. LIBRARY ieee;
  3. USE ieee.std_logic_1164.all;
  4. ENTITY SevenSegmentDecoder IS
  5.  PORT (SW : IN STD_LOGIC_VECTOR(0 TO 2); --INPUTS
  6.         HEX0: OUT STD_LOGIC_VECTOR(0 TO 6)); --SEGMENTS, HEX0 IS ON WHEN IT'S PUT TO 0
  7. END SevenSegmentDecoder;
  8. ARCHITECTURE structure OF SevenSegmentDecoder IS
  9. BEGIN --forcing to 1 the segments we need to turn off
  10.  HEX0(0)<=((SW(2) NOR SW(1))NOR SW(0)) OR ((SW(2) NOR SW(0)) AND SW(1))  OR SW(2);
  11.  HEX0(1)<=((SW(2) NOR SW(1)) AND SW(0)) OR ((SW(2) NOR SW(0)) AND SW(1)) OR SW(2);
  12.  HEX0(2)<=((SW(2) NOR SW(1)) AND SW(0)) OR ((SW(2) NOR SW(0)) AND SW(1)) OR SW(2);
  13.  HEX0(3)<=((SW(2) NOR SW(1))NOR SW(0)) OR SW(2);
  14.  HEX0(4)<= SW(2);
  15.  HEX0(5)<= SW(2);
  16.  HEX0(6)<=((SW(2) NOR SW(0)) AND SW(1)) OR ((SW(1) AND SW(0)) NAND(SW(2))) OR SW(2);
  17. END structure;
  18. --blank when 100,101,110,111, so when C2 is 1, that's why we need to add OR SW(2) everywhere
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement