Designing, Simulating and Implementing a Simple Car Alarm on a Xilinx FPGA – Part I


Design and simulate a simple car alarm on NI Multism 12.0 and implement on a Xilinx FPGA Spartan 3 Starter kit board from Digilent.

This is a two parts post. In this part we will design a logic circuit and simulate. In part II we will implement in an actual Xilinx FPGA.


FPGA (Field Programmable Gate Array) is a chip containing a matrix of logic cells with programmable interconnects, which can be configured by a user. By configuring the function of each logic cell and the way they are connected between each other, one can make FPGA implement any digital circuit (limited only by the capacity of the device).

Xilinx offers the broadest portfolio of FPGAs providing advanced features, lowest power, highest performance, and highest value for any FPGA-based design. Xilinx is the world’s leading provider of All Programmable FPGA’s, SoC’s and 3D ICs. These industry leading devices are coupled with a next-generation design environment and IP to serve a broad range of customer needs, from programmable logic to programmable systems integration.

Design and simulation is facilitated by easy-to-use and intuitive Electronic Design Automation (EDA)  tool Multisim 12.0 from National Instruments. NI Multisim (formerly known as Electronics Workbench) is an electronic schematic capture and simulation program which is part of a suite of circuit design programs, along with NI Ultiboard. Multisim is one of the few circuit design programs to employ the original Berkeley SPICE based software simulation. Multisim was originally created by a company named Electronics Workbench, which is now a division  of National Instruments. Multisim includes microcontroller simulation (formerly known as MultiMCU), PLD design (exporting VHDL code) as well as integrated import and export features to the Printed Circuit Board layout software in the suite, NI Ultiboard. Multisim is widely used in academia and industry for circuits education, electronic schematic design and SPICE simulation.

Implentation is made easy in FPGA boards from Digilent. Digilent’s Xilinx-based programmable logic boards are built around the latest FPGA technologies and time-tested solutions that offer robust performance at a very low price. Most boards feature on-board USB power & programming, and cost less than the price of a textbook.


NI Multisim 12.0
– Digilent Spartan 3 Starter Kit board
Xilinx ISE Design Suite 13.4 or superior

Design and Simulation

The alarm circuit will light up a LED (LD0) on Spartan 3 Starter kit board only when the key (SW1) is in the ignition and either the door (SW2) is open or the seatbelt (SW0) is not fastened. The variables are:

                                    Key = 0      key is not in the ignition
                                    Key = 1      key is in the ignition
                                    Door = 0    door is open
                                    Door = 1    door is closed
                                    Seat = 0     seat belt is not fastened
                                    Seat = 1     seat belt is fastened
                                    Alarm = 0   alarm is not ON
                                    Alarm = 1   alarm is ON

Hence the Truth table is:

Truth Table of Car Alarm

Where A = Door, B= Key and C = Belt

The Karnaugh map of this Truth table is:

Karnaugh Map of Car Alarm

The resulting Boolean expression is Y = A’B + BC’ which translated into logic circuit is:

Logic Circuit

We will next simulate and test the Truth table in MultiSim 12.0.

Run Multisim 12.0. Start a new design in menu File ->  New -> PLD Design…

In Step 1 choose

Create empty PLD window

Press Next > and then in Step 2 window in PLD Design name field write Car_Alarm. In PLD part number (optional) field write XC3S200 which is the FPGA on Spartan 3 Starter Kit.

Note: The option of Create empty PLD is a recent one in Multisim – it may not be available in earlier versions.

Step 2 of PLD design

Press Next > and the final step window will open

Step 3 of PLD design

Final Step of PLD Design windows

Do not change anything here. Just press the Finish button.

You will now see the Multisim workspace for PLD design. Add input and output connectors. The respective buttons are on the top left corner just below Multisim workspace’s menu bar:

Input output connectorsThe PLD design workspace should look like as follows:

Input output connector on Car_Alarm design

Change the names of these connectors to DOOR, KEY, SEAT and ALARM and rearrange the layout of the connectors in a way to have ample space between input and output connectors.

Input output connectors renamed and rearranged in workspace

We will now use test and measurement tools in Multisim to generate the Boolean expression from Truth table, and then obtain our respective logic circuit.

Bring into Multisim workspace Logic converter instrument by pressing onto the icon for Logic converter found at instruments’ tool bar on the right side of Multisim worksapce. The image on workspace looks like this:

Multisim’s Logic converter instrument

Press onto the Logic converter instrument  and you will see the conversion setup.

Truth table in Logic converter

Fill up the Truth table by pressing onto A, B, and C buttons and change the question marks of results ? into respective 0s or 1s according to the Truth table at the beginnng of this post, and as shown in the image above. Now press the button:

Button to obtain Boolean expression

The result will be:

Boolean expression obtained from Truth table

This resulting Boolean expression A’B + BC’ is exactly the same as we obtained manually from Karnaugh map at the beginning of this post.

We are now ready for the automatic logic conversion offered by Multism 12.0. Press onto the button:

It will result in the same circuit as we have obtained manually at the top of this post from Boolean expression. 

We are now ready to simulate, and test the logic circuit. Bring into Multisim workspace Word generator instrument by pressing onto the icon of Word generator found at the instruments’ tool bar on the right side of Multisim workspace. Connect up the Word generator as shown and place the Probe found at the icons bar below the menu bar at top of the workspace:

Set up for simulation of the logic circuit

Press onto Word generator instrument. We will set the right word pattern. Press onto Set button:

Intial window. Press Set.. button to set up

The set up window will open. Change the Buffer size to 0010 and in Preset patterns choose Up counter:

Set up window of Word generator instrument

Press OK button. You will see the following window:Almost there  to simulate....

In Controls press Step button and in Display choose Binary. After you have done this, close the Word generator‘s window. And now place Probe – icon found at the top menu bar – into the PLD workspace and connect the circuit for simulation as shown:

Simulation circuit with Word generator and Probe

We are ready to simulate. Open the Word generator press onto the Step button and certify that the Truth table we have decided upon earlier is what is seen in the simulation:

Simulation to proof out the Truth table

As in our original Truth table, the logic circuit will behave as expected and results can be seen step by step on the Probe lighting up or switching off. We are now ready to export the Multisim circuit to VHDL.

Connect the logic circuit as shown, and remove the Word generator instrument, the Probe as well as any other remnants of our simultaion:

Layout and connections before export to VHDL

Now on the top of workspace’s menu choose Tools -> Export to PLD…

Export to PLD window will open:

Export to PLD window

Press the button Ok and the results will be shown, hopefully without any errors or warnings:

Export results and warnings

A Car_alarm.vhd file has been exported.


The Multisim simulation files and exported VHDL file can downloaded from here.


A special credit is due to Project Navigator Tutorial at Brigham Young University site, for the truth table that serves as the basis for tutorial. Our appraoch is completely different.


We have designed and simulated a logic circuit in Multisim 12.0 and exported the circuit as VHDL. In part II we will program and test the logic circuit in a Digilent Spartan 3 FPGA Starter kit board.


About Tayeb

Electronics engineer, part-time webmaster and owner of "Aliatron", a tech-oriented company registered in Portugal and Mozambique. Owner of "EU Halal", a trading and consulting company in Halal & Tayyib, 100% stun-free compliant.
This entry was posted in Electronic Projects, Electronic Simulation, Programming and tagged , , , , , , . Bookmark the permalink.

2 Responses to Designing, Simulating and Implementing a Simple Car Alarm on a Xilinx FPGA – Part I

  1. Pingback: Designing, Simulating and Implementing a Simple Car Alarm on a Xilinx FPGA – Part II | RedAcacia

  2. Pingback: Design and Simulate a Digital Circuit in NI Multisim and Implement on a Digilent Basys 2 Spartan-3E FPGA Board | RedAcacia

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s