HDL Programming Through FPGA
HDL Programming Through FPGA
Through
FPGA
Prepared by
Prof. Tejal Deshpande
Asst. Professor
EXTC Dept.
VHDL
VHDL <= VHSICHDL.
Very High Speed Integrated Circuit Hardware
Descriptive Language.
Use
Features
VHDL is …
Concurrent language
Sequential language
Netlist Language
Timing specification
Simulation language
Test language
Hierarchical language
Supports design libraries
Tool independent & portable
History
Instituteof Defense Analysis(IDA) had
arranged a workshop in 1981 to study
Various Hardware Description methods
Need for a standard language
A team of three companies,IBM,Texas
Instruments and Intermetrics were awarded
contract by DoD to develop a language.
Version 7.2 of VHDL was released in 1985
along with its LRM
Standardized by IEEE in 1987 as IEEE Std
1076-1987.
CAPABILITIES
Design specification
Design capture
Design simulation
Design documentation
Alternative to schematics
Alternative to proprietary languages
Why VHDL?
LEVELS OF ABSTRACTION
• ABSTRACTION
– It defines the details about the design
specified in a particular description.
• ‘U’ : Un-initialized
• ‘X’ : Unknown
• ‘0’ : Logic 0
• ‘1’ : Logic 1
• ‘Z’ : High Impedance
• ‘W’ : Unknown
• ‘L’ : Low Logic 0
• ‘H’ : Low Logic 1
• ‘-’ : Don’t Care
A FIRST LOOK AT VHDL
Package Declaration
Package Body
Library Declaration
Entity Declaration
Architecture Declaration
Writing First Program
Entity Nand_dataflow is
Port ( a_in : in bit;
A_in
b_in : in bit;
Nand_o
Nand_out : out bit); ut
end Nand_dataflow;
B_in
Architecture dataflow of
Nand_dataflow is
Begin
end dataflow;
I/O PORTS
Mode “IN”
Value can be read but not assigned.
Mode “OUT”
Value can be assigned but not
read.
Mode “INOUT”
Value can be read and also
assigned.
Mode “BUFFER”
Value can be assigned and read
back.
13
VHDL PROGRAMMING
STYLES
1. Dataflow
2. Behavioral
3. Structural
DATAFLOW
BEHAVIORAL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
architecture Behavioral of
entity Nand_dataflow is Nand_behave is
Port ( a_in : in STD_LOGIC;
b_in : in STD_LOGIC; begin
Nand_out : out ---Process Statement
STD_LOGIC); nand_process :
end Nand_dataflow; Process(a_in,b_in) -------
Senesitivity List
architecture dataflow of begin
Nand_dataflow is if(a_in = '1' and b_in =
begin '1') then
nand_out <= a_in nand b_in; nand_out <= '0';
else
end dataflow; nand_out <= '1';
end if;
end process;
end Behavioral;
COMPONENTS
DEFINATION
library IEEE;
library ieee; use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_1164.all;
end Behavioral;
STRUCTURAL
library IEEE;
use
IEEE.STD_LOGIC_1164.ALL;
Architecture structural of
entity nand_gate_struct is nand_gate_struct is
Port ( a_in : in --- Component Declaration
STD_LOGIC; component not_gate is
b_in : in STD_LOGIC; Port ( not_in : in STD_LOGIC;
nand_out : out not_out : out
STD_LOGIC); STD_LOGIC);
end nand_gate_struct; end component;
component and_gate is
entity not_gate is port(a,b : in std_logic;
Port ( not_in : in STD_LOGIC; y : out std_logic );
not_out : out end component;
STD_LOGIC);
end not_gate; --- Signal Declaration
entity and_gate is signal and_sig : std_logic;
port(a,b : in std_logic; begin
y : out std_logic );
end and_gate;
--- Port Mapping
-----Associative mapping
-- and_gate ports => nand_gate_ports
--Positional mapping
end structural;
How to Test ?
How to Apply
Stimulus?
M := A ; M<= A ;
N := B ; N<= B ;
Z<= M+N ; Z<= M + N ;
M := C ; M<= C ;
Y<= M+N ; Y<= M+N ;
end process; end process;
Signals v/s Variables
Architecture sig of par is
signal temp : std_logic ;
begin
process (a)
begin
temp<= ‘0’ ; [7] p
a[7:0]
for i in 0 to n loop
temp<=temp xor a(i) ;
end loop ;
p<=temp ;
end process ;
end sig ;
Signals v/s Variables
Architecture var of parity is
begin [7]
process (a) [6]
variable temp : std_logic ; [5]
begin [4]
temp := ‘0’ ;
p
for i in 0 to n loop
[3]
temp :=temp xor a(i) ;
[2]
end loop ; [0]
p<=temp ; [1]
a[7:0]
end process ;
end var ;
Signals v/s Variables
A Signal has three properties attached: Type, Value
and Time.
1-J: 11001-J: d_
o
32
Splitting into a controller and
datapath
go_i
10105-J:
1011 9: d_ld = 1
11001-J:
33