Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

VHDL Tutorial – 9: Digital circuit design with a given Boolean equation

By Ashutosh Bhatt May 21, 2024

Note: it’s recommended to follow this VHDL tutorial series in order, starting with the first tutorial.

In previous tutorials VHDL tutorial – 8, we learned how to build different gates (such as AND, OR, NOR, NOT, etc.) by only using the NOR gate in VHDL. We were able to successfully prove that he NOR gate is universal.

In this tutorial, we will learn how to:

  • Write a VHDL program that can build a digital circuit from a given Boolean equation.
  • Verify the output waveform of the program (digital circuit) with the truth table of the Boolean equation.

1. The Boolean equation A + B’C + A’C + BC’

Circuit

Truth table

We will write a VHDL program, compile and simulate it, and get the output in a waveform. We’ll also verify the output waveforms with the given truth table.

First, it’s important to review the step-by-step procedure provided in VHDL Tutorial – 3. In that tutorial, we learn how to design a project, edit and compile a program, create a waveform file, simulate the program, and generate the final output waveforms.

VHDL program

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity boolean_equ is
    port ( a,b,c : in std_logic;
           y: out std_logic
           );
end boolean_equ;

architecture bool_equ_arch of boolean_equ is

begin
  y <= a or (not(b) and c) or (not(a) and c) or (not(c) and b);
end bool_equ_arch;

Note:

  • “entity” describes the input-output connections of the digital circuit. As per the circuit given above, there are three inputs: ‘a’, ‘b,’ and ‘c,’ with only one output ‘y.’
  • “architecture” describes the operation of the circuit, which refers to how the output is generated from the given input. 

To refresh your memory about how this works, go through the first two VHDL tutorials (1 and 2) of this series.

Next, compile the above program, creating a waveform file with all of the necessary inputs and outputs that are listed, and simulate the project. 

Here are the results…

Simulation waveform

Verify that the output for ‘y’ is always 1 and for all of the conditions of the inputs (a, b, and c) except when all of the inputs are 0.

Now let’s take at another Boolean equation…

2. Boolean equation AB + AC’ + BC

Circuit

Truth table

Now let’s write a VHDL program for this circuit, only this time we’ll use the structural-modeling style of the VHDL programming instead of the data-flow modeling style.

The previous program was written using the data-flow modeling style as it’s the simplest for designing circuits with VHDL and ideal for beginners. However, that style is not used for designing digital circuits using VHDL. The most widely used style for this is structural modeling because it divides complete circuits into smaller components and then integrates them to build a complete circuit. 

For this reason, structural modeling is useful for big or complex digital circuits. Users can start by designing small-small blocks (components) of the complete circuit and then simply integrate all of the blocks (components) together. 

Here is the VHDL program using the structural-modeling style.

VHDL program

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity bool_equ is
   port (a,b,c :in STD_LOGIC;
         y : out STD_LOGIC);
end bool_equ;

————architecture of boolean equation ckt ———–
architecture bool_equ_arch of bool_equ is

—————AND gate component ———————-
component and_gate is

port (p,q :in STD_LOGIC;
      x: out STD_LOGIC);
end component;
—————–OR gate component ———————
component or_gate is

port (p1,q1 :in STD_LOGIC;
      x1: out STD_LOGIC);
end component;
—————-NOT gate component ———————-
component not_gate is

port (w :in STD_LOGIC;
      z: out STD_LOGIC);
end component;
———————————————————-
signal s1,s2,s3,s4,s5 : STD_LOGIC;

   begin
     w1: and_gate port map (a,b,s1);
     w2: and_gate port map (b,c,s2);
     w3: not_gate port map (c,s3);
     w4: and_gate port map (a,s3,s4);
     w5: or_gate port map (s1,s2,s5);
     w6: or_gate port map (s4,s5,y);
  end bool_equ_arch;

————– AND gate entity and architecture ————–
library IEEE;

use IEEE.STD_LOGIC_1164.ALL;
entity and_gate is
  port(p,q :in STD_LOGIC;
        x: out STD_LOGIC);
end and_gate;

architecture and_arch of and_gate is
  begin
     x<=p and q;
  end and_arch;
————– OR gate entity and architecture —————
library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

entity or_gate is
  port(p1,q1 :in STD_LOGIC;
        x1: out STD_LOGIC);
end or_gate;

architecture or_arch of or_gate is
  begin
     x1<=p1 or q1;
  end or_arch;
————– NOT gate entity and architecture ————–
library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

entity not_gate is
port(w :in STD_LOGIC;
      z: out STD_LOGIC);
end not_gate;

architecture not_arch of not_gate is
  begin
     z <= not w;
  end not_arch;

To learn more about this structural-modeling style, please refer to Tutorial 2 of this series.

Next, compile the above program – create the waveform file with all of the inputs and outputs listed, apply the different input combinations, and save the waveform file. 

Simulate the project and you will get the following result:

Simulation waveform

Verify the output of ‘y’ by comparing it with the truth table given. It should match with the truth table. This means that by using VHDL, we can design a digital circuit for any given Boolean equation.

In the next tutorial, we’ll learn how to design half and full adder circuits using VHDL.

 

 

You may also like:

  • VHDL
    VHDL Tutorial 1: Introduction to VHDL
  • VHDL
    VHDL Tutorial 2: VHDL programs

  • What is an SoC?

  • What is electronic design automation?

  • What are field-programmable gate arrays (FPGAs)?

  • SPI: What is the Serial Peripheral Interface Protocol?

Filed Under: Featured Contributions, Tutorials, VHDL, VHDL

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • What is the purpose of using a VCVS?
  • Checking line impedance
  • Why do I hear whistling sounds in my vents?
  • Mains inverter with switching node going out on the mains cable!?

RSS Electro-Tech-Online.com Discussions

  • Why can't I breadboard this oscillator?
  • Failure of polypropylene motor-run capacitors
  • a point I can't understand about the sinc expression
  • Quick advice on remote car starter?
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection
  • Convection-cooled power controller integrates EtherCat connectivity

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe