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

PIC 18F452 Programming: LED blinking using assembly

Here is the basic program you need to start off with when you learn to use a microcontroller. We are using the microchip family PIC microcontroller. Which stands for Peripheral Interface Controller, PIC 18F452 is a 40 pin 8-bit microcontroller with 32 KBytes flash, 1536 Bytes of RAM and 256 Bytes EEPROM. It also boasts 4 timers, and three external interrupt pins. Coming to our first program, We will be using MPLAB for Building this project. Create a new project and select MPASM Suite for compiling. After writing the program, Dont forget to add the linker file and the source file in the source window. The linker file for the PIC 18F452 can be found in the  C:\Program Files\Microchip\MPASM Suite\LKR. search for 18f452. In this program, the Bit RB0, toggles continuously with some delay. Connect an LED to The RB0 Pin, i.e Pin 33.connect a 330E resistor in series with the LED. PROGRAM #INCLUDE p18f452.INC; CONFIG WDT=OFF; disabling the watchdog timer ORG 0; Specifing the st

PIC Programming: making a port bits toggle using assembly

CIRCUIT: Program: #INCLUDE p18f452.INC ORG 0 CLRF TRISD  L1 SETF PORTD CALL DELAY CLRF PORTD CALL DELAY GOTO L1 DELAY MOVLW 0xff MOVWF 0x10 L2 DECF 0x10,F BNZ L2 RETURN END