Introduction to FPGAs using VHDL
I. Introduction
In the previous lab Xilinx was used to graphically draw the
circuit by connecting a series of AND gates and OR gates.
In this lab you will be taking the previously constructed
circuit and describe it in VHDL. To do this you will need to
construct entities which mimic the gates used. Then
connect the "gates" to construct the 7 segment decoder.
... -- first we want to declare the structure of the entity -- (i.e. the number of inputs and outputs to the entity) entity NAND2 is port ( input1, input2: in STD_LOGIC; output1: out STD_LOGIC ); end NAND2; -- then we describe the internal behavior of the entity -- (i.e. what the entitiy does to the inputs to ge the output) architecture beh_nand2 of NAND2 is begin output1 <= input1 nand input2; end beh_nand2; -- we do the same for the X0R2 gate entity XOR2 is port ( input1, input2: in STD_LOGIC; output1: out STD_LOGIC ); end OR2; architecture beh_xor2 of XOR2 is begin output1 <= input1 xor input2; end beh_xor2; -- now we declare CIRCUIT's structure -- (i.e. the number of inputs and output to the entity) entity CIRCUIT is port ( a, b, c : in STD_LOGIC; f: out STD_LOGIC; ); end CIRCUIT; -- the internal behvaior is describe here architecture struct of CIRCUIT is -- a signal has two purposes, as a wire or register -- in our example we use it as a wire whose purpose is -- to connect two components together (as seen in the above image) signal e: STD_LOGIC; -- we want to use the previously constructed gates so -- we declare them as components in our entity component NAND2 port ( input1, input2: in STD_LOGIC; output1: out STD_LOGIC ); end component; component XOR2 port ( input1, input2: in STD_LOGIC; output1: out STD_LOGIC ); end component; -- then we describe how the inputs and outputs of CIRCUIT -- are fed through the gates previously described begin X1: NAND2 port map(A, B, E); X2: XOR2 port map(E, D, F); end struct; ...
II. Implementation
III. Downloading