# Technology comparison: Using FPGA and logic gates

FPGA is a breakthrough technology for logic circuits designing on electronic system applications. To be easy to understand applications of fpga, here will be explained a simple comparison of a digital circuit design using:

• Logic gates
• FPGA chip

Here would seem clear about the implementation of technological breakthroughs on digital systems embedded in the fpga. Okay, back on a simple logic circuits shown on left.  The logic output of Q will depend on the logic combination of inputs A, B, C and D. The simplify logic function of this circuit will be: Q(A,B,C,D) = A’.B’.C.D. The meaning is Q = 1 only if A = B = 0 and C = D = 1.

## Using Logic Gate Chip

If using logic gates to implement the circuit, you will need a chip logic gates are available in the market. The chip of the type 74XX, namely: 74HC21 chip contains two AND with 4 input, 74HC04 chip contains 6 inverter (not). The two chips are assembled as mentioned above circuit.
The following video will give further details of the implementation of logic circuits using a logic gate chips.
DEMO

As you look at video above, to build the logic circuit as implementation on digital gate chips is assembled manually by cable connecting or soldering on each pins of chips using PCB or other. On video, 4 leds is used to verify the logical of the output. 4 Leds will turn on if output have logical 1, otherwise will turn off if have logical 0.

## Using FPGA

Using fpga technology to implement the system logic circuits will be very rapidly from disains up to implementations.

why this can be done rapidly ?

Here I just clarify the comparison of design technology, logic circuits using logic gates and fpga chip. To design the logic circuits as described above using fpga, we only use with software for designing fpga. Here I will use the fpga evaluation board from Xilinx Spartan 3, for more details click here.  Software for designing fpga, I use Xilinx ISE version 10.2. You can get ISE freely on the web, namely ISE Webpack. To download the latest free ISE please clik here.

Here, you just imagine in your mind that the ISE can soldering or connecting the many components of logic gates available in fpga chip. But only use the software and computer, you will sit with a relaxing, thinking about the  logic circuits what would you design. You will explore your all idea by typing some code using vhdl or verilog language. ISE allows you to build logic circuits in a schematic or state. Also you can design method combines both behavioral (typing by code), schematic and state.

### Writing VHDL Code ……..

In ISE, you should write some VHDL codes as follows:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity blackbox is
Port (  A : in STD_LOGIC;
B : in STD_LOGIC;
C : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC );
end blackbox;

architecture Behavioral of blackbox is

begin
– begin here to build a circuit by typing VHDL code
Q <= not A and not B and C and D; – must ending by ; char
– building circuit finished

end Behavioral;

Some of the code generated automatically by the ISE, so you just add some code that relate to your design. After you finished writing the code, need to check the program for there are no some errors, by compiling the program that you created.

DEMO

As you can see in the video above, circuit design written in ‘bevavioral’, which is written using vhdl program. Each design series called ‘modules’, which has the definition of input and output channels. Furthermore, the logic circuit is defined in the syntax ‘begin’.

Before compiling, you should first check whether the syntax is correct according to the rules vhdl.

Okay … until here I think the program has compiled correctly. In addition to direct input channels A, B, C, D and Q output to the physical pins of the fpga, need to read the table of the pins are in accordance with fpga evaluation board is used.

Here is used the evaluation board fpga spartan 3, click here for more details. And data pins can be obtained here.  will utilize the existing switch in the evaluation board as an input channel A, B, C and D. As the output Q, I will use a single LED that is on the evaluation board as well.

Here are excerpts list fpga pins on the evaluation board to switch and LED, as shown on pages 19-20.

I will use the switch SW0-SW3 as input channel A, B, C and D, output Q channel using led LD0.
Pins used for A, B, C, D are: F12, G12, H14 and H13 and pin used for Q is K12. Here I will not explain how the directing pins and how the compilation was transferred to the evaluation board fpga.

Then I just demonstrate the results of these logic circuits which have been embedded into the evaluation board fpga.See also the following video:

DEMO

Last updated by at .