Want this question answered?
Vhdl has got three models - programming styles. 1. data flow model 2. behavioral model 3. structural model.
Half adder is a combinational circuit which can add two bits. It contains two inputs and two outputs. The same is implemented in entity declaration of VHDL program. The outputs are related to inputs as follows: SUM output is obtained by XORing the inputs and CARRY output is obtained by ANDing the inputs i. e. multiplication. The VHDL code for half adder using data flow model is given below: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity had is Port ( a : in STD_LOGIC; b : in STD_LOGIC; s : out STD_LOGIC; c : out STD_LOGIC); end had; architecture df of had is begin s<= a xor b; c<= a and b; end df;
VHDL program follows IEEE library. This means that all the data types, commands, keywords etc. used in a VHDL program are stored in a library called IEEE library. This library will be available in the EDA tool which is executing the VHDL program. 1164 is a package where all the logic gates are defined. This is a sub part of IEEE library. As encoder program requires logic gates, we need to use 1164 package in the code.
VHDL is a hardware description language which is used to describe digital circuits or systems. The data involved digital systems is logical data i. e. 0 or 1. Hence, VHDL uses logical data as input and provides the same type of data in output.
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity fadf is Port ( ain : in STD_LOGIC; bin : in STD_LOGIC; cin : in STD_LOGIC; sum : out STD_LOGIC; cout : out STD_LOGIC); end fadf; architecture df of fadf is begin sum<= ain xor bin xor cin; cout<= (ain and bin) or ( bin and cin) or (ain and cin); end df;
VHDL can be written in three different models. They are calleddata flow modelbehavioral modelstructural modelBefore attempting a VHDL program, one should know the steps involced in these modeling styles.Data flow model:In this model, the input data simply flows into the output. THat is, we will be implementing the relation between input and output terminals directly.For example,c < = a and b;Here, the output c is an ANDing of a and b. We are actually implementing the direct relation between inputs and outputs. That is, c = a + b.Hence, we need not write any complex conditional statements here in data flow model.Simply implement the output expression. Thats all.Here, we are implementing the code at a very basic level i. e. circuit level or gate level.Behavioral model:Here, in behavioral model, one needs to code the behavior of the system to be designed. If we consider the same above example, the behavior is that, the output should be one (1) whenever both the inputs are one (1).we can code it like this:if (a=1 and b=1) thenc
VHDL can be written in three different ways. They are calleddata flow modelbehavioral modelstructural modelBefore attempting a VHDL program, one should know the steps involced in these modeling styles.Data flow model:In this model, the input data simply flows into the output. THat is, we will be implementing the relation between input and output terminals directly.For example,c < = a and b;Here, the output c is an ANDing of a and b. We are actually implementing the direct relation between inputs and outputs. That is, c = a + b.Hence, we need not write any complex conditional statements here in data flow model.Simply implement the output expression. Thats all.Here, we are implementing the code at a very basic level i. e. circuit level or gate level.Behavioral model:Here, in behavioral model, one needs to code the behavior of the system to be designed. If we consider the same above example, the behavior is that, the output should be one (1) whenever both the inputs are one (1).we can code it like this:if (a=1 and b=1) thenc
In VHDL, std_logic is a data type. It is assigned to input and / or output variables. It means that the variable is a standard logic type i. e. a logic bit which accepts or provides one bit data, either 1 or 0.
And when the ASIC industry needed a standard way to convey gatelevel design data and timing information in VHDL, one of Accelleras progenitors (VHDL International) sponsored the IEEE VHDL team to
Below code can implement NOT gate in VHDL. The code is written in data flow model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin c<=not a; end and1;
These are predefined words in VHDL standards. Bit indicates that the data type is a bit i. e. 0 or 1. A bit_vector is an array of bits. example: a: in bit; b: in bit_vector(1 downto 0);
Below code can implement AND gate in VHDL. The code is written in data flow model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a,b : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin c<=a and b; end and1;