------------------PART 3-------------------------
architecture dataflow of tri_state is
begin
output <= input when (enable = '0') else
(others => 'z');
end tri_state
------------------------------------------------------------
Explanations:
PART 1: all programs begin with these two statements. They make the standard ieee library visible to the program
PART 2: entity (the chip/circuit and its IO pins) - Primary unit
-declares all input output signals.
-std_logic is an enumerated data type defined in ieee.std_logic_1164.all.
-Besides '1' and '0', std_logic has the tri-state value 'z' and some other values. Pl see the library.
-std_logic_vector is an array of std_logic.
-note that the last io port does not end with a semicolon
PART 3: architecture (the internals of the chip/circuit) - Secondary unit
The two parts of architecture
-its body has two parts (a)declaration part before begin (b) description after begin.
-this program has nothing in declaration part. Usually signals and components are declared here.
-the body describes how the tri-state buffer works
The styles of programming
-vhdl allows 4 styles: dataflow, behavioral, structural, mixed.
-this is dataflow style. Each statement executes when its RHS signals change.
-In this case the RHS signals are input and enable. Any change in these will trigger the change in output.
-note the when statement. It is used in dataflow style
The arrows
-note others=>'z'. Others refer to all the remaining (in this case all 8) lines of output
-note the arrows <= (signal assignment) and =>(assign individual vector elements)
-another arrow is := (constant or variable assignment)
-Thus vhdl deals with constants, variables, signals, input-output ports, vector elements
-Out of these, all except input-output ports can be assigned in architecture body.
EXTRA: Bindings and Design units
The bindings
- An Entity can bind to any number of architectures (not the reverse tho)
- Here entity tri-state is automatically binded with architecture dataflow
- To bind with some other architecture, you need a Configuration declaration
The Units
- vhdl has two kinds of Design units: primary Independent) and secondary(dependent)
- It allows 3 kinds of primary units: entity, package and configuration
- it has two kinds of secondary units: architecture body and package body
SELF-STUDY
-Find out how you can test the circuit by writing test bench and using a simulation waveform viewer.
-Since IO ports cannot be assigned, we need to write another entity-architecture
design called Test-Bench which includes the tri_state-dataflow design as a component
-That would allow us to assign tri-state's IO ports
-Test bench is a good example of structural modeling
--
____________________________
Dr Shampa Chakraverty
Professor & Head, Deptt. of Computer Engineering
Netaji Subhas Institute of Technology
Dwarka, Sector 3, New Delhi-110078
Phone: 91-011-25099062(O)
09899568694 (M)