Skip to main content

VHDL

VHDL stands for Very high speed integrated circuit Hardware Descriptive Language.

VHDL is a hardware descriptive language used to describe the behavior and structure of a digital system.
Entity specifies the input and output of a particular device.

Primary constants:

  • Entity declaration.
  • architecture body
  • configuration declaration
  • package declaration
  • package body

Rules:

  • It is case insensitive. ex: a and A mean the same. half_adder and Half_ADDER are same.
  • File name should always start with a alphabet
  • '_' and other special characters can be used in file names
  • The declaration include name,type of input and output.

Entity declaration:

Lets take an example, of half adder.
sum is given by a xor b.
and carry is given by a*b.

entity declaration starts with the keyword entity.
port is a keyword to specify input and output.

input and output is represented as in bit or out bit. here bit is used to specify that it is one bit of information. either level 1 or level 0.

example:

entity half_adder is
port ( a,b : in bit ; 
          sum,carry : out bit);
end half_adder ;


The above code is the entity declaration for half adder.
half_adder is the entity name chosen by the user.
at the end, end half_adder; is used to terminate the entity.

Note: keywords cannot be kept as file name.

Architecture body:

here architecture, of and is are keywords.
lets take the same example of half adder.

architecture HA of half_adder is
begin
sum <= a xor b;
carry <= a and b;
end HA;

here HA is the architecture name set by the user. of is a keyword used to indicate the entity.
architecture contains begin. and two or more begin can be present in the architecture.
note that for and operation, I have used a and b instead of a*b. because and is a predefined keyword.
end HA; is used to end the architecture.

Example: having entity declaration and architecture body.

program to find AND, OR, XOR, NOR, NAND.

solution:

entity gates is
port ( a,b : in bit ;
         and_g, or_g, xor_g, nor_g, nand_g : out bit);
end gate;

architecture all_gates of gates is
begin
and_g <= a and b;
or_g <= a or b;
xor_g <= a xor b;
nor_g <= a nor b;
nand_g <= a nand b;
end all_gates;



Comments

Popular posts from this blog

Switch debouncer using SR Latch

We use switch in our day to day life to switch ON/OFF a bulb or a fan or  any electrical devices. But when we use switches in digital circuits, we observe a phenomenon called bouncing. This occurs because, when we turn the switch, the mechanical parts vibrate. i.e It toggles between ON and OFF state for some time until the mechanical contact attain equilibrium. this vibrations are minute and are not at all noticeable in electrical circuit. where as in digital circuits, these vibrations create pulses. which are detected by circuits which results in an error.               In the above circuit, there is a switch connected to VCC. You can toggle it between terminal 'a' and terminal 'b'. which as a voltage drop of 'Va' and 'Vb' respectively. In digital circuits if you can observe, it takes a finite amount of time to toggle between terminal 'a' and 'b'. which might approximately take 15ns. Now let us consider the terminal is at 'a'. we...

ADXL 355 Accelerometer

A few days ago I went to get components for a project I was building. and came across a 3-axis accelerometer. So I decided to test it and make a post to give you an idea of things work and how you can use it. ADXL 355                   The accelerometer I have is ADXL 355 v2.0 board. there is are 5 headder pins, ground, 5V supply, X-axis output,Y-axis output and Z-axis output. It is quite compact. The one I have measured around 15mm x 15mm. These sensors are low cost. And can be incorporated in Projects or robots we build. The ADXL 355 board I have has an onboard Red led (smd) for the indication of power. The accelerometer has a wide range of applications. ADXL 355 is a basic accelerometer which gives analog values for all the three axis depending upon the position of the IC. ADXL 345 is an advanced accelerometr which can detect free-fall,activity,tap,double tap and communicates via I2C. The ADXL is a a ultra-lowpower as it consumes only 25 u...

Latch using JK Flip Flop

In this post we will learn how to use JK flip flop as a latch. i.e. for one pulse, the circuit continues to stay in the ON state until the next pulse. and the circuit continues to be in the OFF state till the next pulse. This can be achieved by using toggle mode in JK flip flop. TRUTH TABLE: IC 7476 J       k       set '      reset'        Q      Q' 1       1        1            1               Toggle IC CD4026 J       k       set       reset         Q      Q' 1       1        0           0               Toggle Note: Set is referred as PRE or preset. Reset is referred as CLR or clear. Refer the Datasheet of the JK flip flop you are using ...