SlideShare a Scribd company logo
1 of 81
Download to read offline
FPGA
Department of Biomedical Engineering
Faculty of Engineering
University of Isfahan
Seyed Yahya Moradi
UI.FPGA@gmail.com
HOME WORK
• E- MAIL
oHW?_#STDNUM (SUBJECT) SPAM!
oWORD
• NAME
• TEMPLATE
• REFERECE
oEXE (ACTIE HDL)
oALL ZIP THAT NAME IS HW?_#STDNUM
Channel!
https://www.slideshare.net/yahyamoradi
HOME WORK 0
• INSTAL THE ACTIVE HDL=100
• MAIN OF VHDL
Main Error
Introduction
• A field-programmable gate array (FPGA) is an
integrated circuit designed to be configured by a
customer or a designer after manufacturing – hence
"field-programmable".
• The FPGA configuration is generally specified using a
hardware description language (HDL), similar to that
used for an application-specific integrated circuit
(ASIC).
Introduction
Introduction
VHDL VLSI VERILOG
Introduction
• Active Hdl
• Logic Works
Introduction
• CAD
• 1. Computer Aided Diagnose
• 2. Computer Aided Design
• 3. 3D and 2D Design
• ICCAD Conference
HOME WORK 1
• 1 ISI ARTICLE : Abstract
• Design and Idea about a “ Kitchen DEVICE”
For
Mother's Day :)
• Mother's Day is a celebration honoring the mother of the family, as well as motherhood,
maternal bonds, and the influence of mothers in society. It is celebrated on various days
in many parts of the world, most commonly in the months of February or everyday of the
week
ACTIVE HDL
HOME WORK 2
• WHAT IS :
• HALF ADDER=25
• FULL ADDER=25
• DECODER=25
• ENCODER=25
HOME WORK 3
• WHAT IS :
• CPU
• BIT OF CPU /8/16/64 BIT
• COMPONENT OF CPU
• ALUCURIGISTER
VHDL
• What is VHDL?
V H I S C  Very High Speed Integrated Circuit
Hardware
Description
Language
IEEE Standard 1076-1993
History of VHDL
• Designed by IBM, Texas Instruments, and Intermetrics as part of
the DoD funded VHSIC program
• Standardized by the IEEE in 1987: IEEE 1076-1987
• Enhanced version of the language defined in 1993: IEEE 1076-
1993
• Additional standardized packages provide definitions of data
types and expressions of timing data
o IEEE 1164 (data types)
o IEEE 1076.3 (numeric)
o IEEE 1076.4 (timing)
Usage
• Descriptions can be at different levels of abstraction
o Switch level: model switching behavior of transistors
o Register transfer level: model combinational and
sequential logic components
o Instruction set architecture level: functional behavior of
a microprocessor
• Descriptions can used for
o Simulation
• Verification, performance evaluation
o Synthesis
• First step in hardware design
Digital System Design Flow
Requirements
Functional Design
Register Transfer
Level Design
Logic Design
Circuit Design
Physical Design
Description for Manufacture
Behavioral Simulation
RTL Simulation
Validation
Logic Simulation
Verification
Timing Simulation
Circuit Analysis
Design Rule Checking
Fault Simulation
• Design flows operate at multiple
levels of abstraction
• Need a uniform description to
translate between levels
• Increasing costs of design and
fabrication necessitate greater
reliance on automation via CAD
tools
– $5M - $100M to design new
chips
– Increasing time to market
pressures
37
VHDL type classification
See SG p 51, DG p 47.
10 ns
“101110001110001”
‘1’
125
FALSE
‘A’
38
A VHDL program
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ABorC is
port (
A : in std_logic;
B : in std_logic;
C : in std_logic;
F : out std_logic);
end ABorC;
architecture arch of ABorC is
signal X : std_logic;
begin
X <= A and B after 1 ns;
F <= X or C after 1 ns;
end;
39
Operations that can be performed on type integer. See SG p 36, DG p 35
Use parentheses to force
desired
Precedence.
40
Constants
constant CONST_NAME: <type_spec> := <value>;
-- Examples of Declaration of Constants:
constant GO: BOOLEAN := TRUE;
constant Max: INTEGER := 31;
constant HexMax: INTEGER := 16#FF#; -- hex (base 16) integer
constant ONE: BIT := '1';
constant S0: BIT_VECTOR (3 downto 0) := "0000";
constant S1: bit_vector(15 downto 0) := X"AB3F“; -- hex string
constant HiZ: STD_LOGIC := 'Z'; -- Here Z is high impedance.
constant Ready: STD_LOGIC_VECTOR (3 downto 0) := "0-0-";
-- 0’s & don’t cares
Note: VHDL is not case sensitive. -- is used for comments.
• BOOLEAN, INTEGER, BIT, etc are examples of predefined VHDL types.
o VHDL is a strongly typed language.
o Cannot for example directly assign a bit or std_logic value to an integer type
41
Variables
VAR_NAME := <expression>;
-- example
Count := 10;
Vbit := '0';
• Declaration
variable VAR_NAME: <type_spec>;
-- example:
variable Test: BOOLEAN;
variable Count: INTEGER range 0 to 31 := 15; -- Set initial value to
15.
variable vBIT: BIT;
variable VAR: BIT_VECTOR (3 downto 0);
variable VAR_X: STD_LOGIC := ‘0’; -- Set initial value to ‘0’.
variable VAR_Y: STD_LOGIC_VECTOR (0 to 3);
42
Signals
SIG_NAME <= <expression>;
-- Examples
BitX <= ‘1’;
• Declaration
signal SIG_NAME: <type_spec>;
-- example:
signal Flag: BOOLEAN := TRUE; -- TRUE is the initial vlaue
signal intX: INTEGER range 0 to 31;
signal BitX: BIT := ‘1’;
signal Control_Bus: BIT_VECTOR (3 downto 0);
signal X: STD_LOGIC;
signal Y: STD_LOGIC_VECTOR (0 to 3) := “0000”;
43
VHDL example EX 1
--EX1.vhd
ENTITY tb is END tb;
ARCHITECTURE test OF tb IS
signal X : BIT;
BEGIN
X <= not X after 10 ns;
END test;
44
--EX2.vhd
ENTITY tb is END tb;
ARCHITECTURE test OF tb IS
signal X, Y : BIT;
BEGIN
X <= not X after 10 ns;
Y <= '1' after 5 ns, '0' after 12 ns, '1' after 25 ns;
END test;
45
std_logic_1164 multi-
value logic system
TYPE std_ulogic IS ( 'U', -- Uninitialized
'X', -- Forcing Unknown
'0', -- Forcing 0
'1', -- Forcing 1
'Z', -- High Impedance
'W', -- Weak Unknown
'L', -- Weak 0
'H', -- Weak 1
'-' -- Don't care
);
46
And Or gate in VHDL example
library IEEE;use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ABorC is
port (
A : in std_logic;
B : in std_logic;
C : in std_logic; F : out std_logic);
end ABorC;
architecture arch of ABorC is
signal X : std_logic;
begin
X <= A and B after 1 ns;
F <= X or C after 1 ns;
end;
1
2
3
C
FB
X
A
1
2
3
47
Process
• Process statements occur within an architecture.
• The syntax for a process is:
LABEL1: -- optional label
process (signal_name, …) is
-- declarations
begin
-- sequential statements
end process LABEL1;
48
Process example
• Without process statements
architecture ex_arc of ex4 is
signal X: BIT;
signal Y: BIT;
signal Z, V, W: BIT;
Begin
-- concurrent signals assignments
X <= not X after 10 ns;
Y <= not Y after 25 ns;
Z <= X and Y after 2 ns;
V <= (Z xor not W) nand X after 3
ns;
W <= X or Y after 1 ns;
end architecture ex_arc;
• With process statements
Process(X) begin
X <= not X after 10 ns;
End process;
P2: process(y) begin
Y <= not Y after 25 ns;
End process P2;
P3: Process(X,Y,Z,W)
begin
Z <= X and Y after 2 ns;
V <= (Z xor not W) nand X after 3
ns;
End process P3;
P4: process(X,Y) begin
W <= X or Y after 1 ns;
End process P4;
Basic Structure of a VHDL File
• Entity
o Entity declaration: interface
to outside world; defines
input and output signals
o Architecture: describes the
entity, contains processes,
components operating
concurrently
Entity Declaration
entity NAME_OF_ENTITY is
port (signal_names: mode type;
signal_names: mode type;
:
signal_names: mode type);
end [NAME_OF_ENTITY] ;
• NAME_OF_ENTITY: user defined
• signal_names: list of signals (both input
and output)
• mode: in, out, buffer, inout
• type: boolean, integer, character,
std_logic
Architecture
• Behavioral Model:
architecture architecture_name of NAME_OF_ENTITY
is
-- Declarations
…..
…..
begin
-- Statements
end architecture_name;
Entity Examples …
entity half_adder is
port(
x,y: in std_logic;
sum, carry: out std_logic);
end half_adder;
Half ADDER
X
Y
SUM
CARRY
Half Adder
library ieee;
use ieee.std_logic_1164.all;
entity half_adder is
port(
x,y: in std_logic;
sum, carry: out std_logic);
end half_adder;
architecture myadd of half_adder is
begin
sum <= x xor y;
carry <= x and y;
end myadd;
Entity Examples …
entity FULL_adder is
port(
A, B, C: in std_logic;
sum, carry: out std_logic);
end half_adder;
FULL ADDER
A
B
C
SUM
CARRY
Architecture Examples: Behavioral Description
• Entity FULLADDER is
port ( A, B, C: in std_logic;
SUM, CARRY: in std_logic);
end FULLADDER;
• Architecture CONCURRENT of FULLADDER is
begin
SUM <= A xor B xor C after 5 ns;
CARRY <= (A and B) or (B and C) or (A and C)
after 3 ns;
end CONCURRENT;
Architecture Examples: Structural Description …
• architecture STRUCTURAL of FULLADDER is
signal S1, C1, C2 : bit;
component HA
port (I1, I2 : in bit; S, C : out bit);
end component;
component OR
port (I1, I2 : in bit; X : out bit);
end component;
begin
INST_HA1 : HA port map (I1 => B, I2 => C, S => S1, C => C1);
INST_HA2 : HA port map (I1 => A, I2 => S1, S => SUM, C => C2);
INST_OR : OR port map (I1 => C2, I2 => C1, X => CARRY);
end STRUCTURAL;
I1 S
HA
I2 C
I1 S
HA
I2 C I1
OR
I2 x
A
C
B
CARRY
SUM
S1
C1
C2
!!!HW4!!!
58
U1: entity work.or3 port map
(A => AB, B => ACin , C => BCin , F => Cout);
U2: entity work.and2 port map
(A => A, B => B, F => AB);
U3: entity work.and2 port map
(A => B, B => Cin, F => BCin);
U4: entity work.and2 port map
(A => A, B => Cin, F => ACin);
U5: entity work.xor2 port map (A, B, AxorB);
U6: entity work.xor2 port map (Cin, AxorB, S);
AB
B
A
U5
XOR2
F
A
B
ACin
Cin
Cout
Cin
A
B
U4
AND2
F
A
B
U3
AND2
F
A
B
BCin
U6
XOR2
F
A
B S
U1
OR3
F
A
B
C
AxorB
U2
AND2
F
A
B
Problem Solving in Persian!
VHDL Code
-- STEP ONE
library ieee;
use ieee.std_logic_1164.all;
-- STEP TWO
entity PR1 is
port(
A,B,C: in std_logic;
F: out std_logic);
end PR1;
-- STEP THREE
architecture PRa of PR1 is
begin
Signal x,y,z; std_logic_vector (3 downto 0);
x <= a and b;
y <= a and c;
z <= b and c;
F <= x or y or z;
end PRa;
!!!HW5!!!
Previous problem
VHDL code’s
4 to 1 MUX
Mux
Sel
Inputs OutputsA
B
C
D
Q
4 to 1 MUX
library ieee;
use ieee.std_logic_1164.all;
-- 4 to 1 mux
entity mymux is
port (A, B, C, D : in
std_logic_vector(0 to 3);
Sel : in
std_logic_vector ( 0 to 1
);
Q : out
std_logic_vector(0 to 3) );
end mymux;
Library you need to include
Comment
entity “name_of_entity” is
port(all your input and output
signals);
end “name_of_entity”;
4 to 1 MUX
architecture mux4 of mymux is
constant delay : time := 100 ns;
begin
mux_proc : process ( A, B, C, D, Sel )
variable temp :
std_logic_vector(0 to 3);
begin
case Sel is
when "00" => temp := A;
when "01" => temp := B;
when "10" => temp := C;
when "11" => temp := D;
when others => temp :=
"XXXX";
end case;
Q <= temp after delay;
end process mux_proc;
end mux4;
mux4 is the name of my
architecture
Declaration of time as a constant
begin the architecture
Process mux_proc is initialized
Variable temp is declared
begin process mux_proc
case on the Sel singal
If anything else then temp is don’t
care
If there was a delay on the mux
end process
end architecture
TestBench for 4 to 1 MUX
library ieee;
use ieee.std_logic_1164.all;
entity mux_testbench is
end mux_testbench;
architecture test of mux_testbench
is
signal A : std_logic_vector(0 to 3);
signal B: std_logic_vector(0 to 3);
signal C: std_logic_vector(0 to 3);
signal D: std_logic_vector(0 to 3);
signal Sel: std_logic_vector(0 to 1);
signal Q: std_logic_vector(0 to
3);
still have to begin with entity
end the entity
test is the name of the
architecture
the signals have to be the same
as the port signals in your entity
declaration of the program you
want to test.
TestBench for 4 to 1 MUX
component mymux is
port (A, B, C, D : in
std_logic_vector(0to3);
Sel : in std_logic_vector ( 0 to 1 );
Q : out std_logic_vector(0 to 3));
end component;
begin
test_mux: mymux
port map( A =>
A , B => B,
C => C ,
D => D,
Sel => Sel,
Q => Q );
This component declaration tells
us that we have 5 inputs
A,B,C,D and Sel; we also
have one output Q
The port map is used to link the
signal A from your VHDL
program to the signal A in
your testbench
Used incase you want to use
different names
TestBench for 4 to 1 MUX
test_process: process
begin A<="1010";
B<="1011";
C<="1100";
D<="1101";
Sel<="00";
wait for 500 ns;
Sel<="01";
wait for 500 ns;
Sel<="10";
wait for 500 ns;
Sel<="11";
wait for 500 ns;
end process;
end test;
initialize your signal
when Sel is 00 it should let A
come through on Q with a
delay of 100ns
when Sel is 01 Q should be B
end the process test_process
end the test
8- Bit Shifter
Shifter
clk
rst
load
data 8 bits
8 bits
Q
Input Output
8 – Bit Shifter
-- 8-Bit Shift Register
library ieee;
use ieee.std_logic_1164.all;
entity shift is
port (CLK, RST, LOAD : in
bit;
Data : in bit_vector(0 to
7);
Q : out bit_vector(0 to
7));
end rotate;
Comment
Library you need to include
entity “name_of_entity” is
port(all your input and output
signals);
end “name_of_entity”;
8 – bit shifterarchitecture shifter1 of shift is
begin
reg : process(RST, CLK)
variable reg : bit_vector(0 to 7);
begin
if(RST = '1') then
reg := "00000000";
elsif(CLK = '1' and CLK'event)
then
if(LOAD = '1') then reg :=
Data;
. else
reg := reg(1 to 7) & reg(0);
end if;
end if;
Q <= reg;
end process;
end shifter1;
shifter1 is the name of my
architecture
shift is the name of my entity
reg is the name of my process
reg is also a local variable
Begin the process reg
if RST clear reg
else wait for a clock event then
reg = Data if LOAD signal is high
a bit shift
R gets the value of reg
end process
end architecture
TestBench for 8 bit
shifter
library ieee;
use ieee.std_logic_1164.all;
entity shift_testbench is
end shift_testbench;
architecture test of shift_testbench is
Signal CLK : bit;
signal RST : bit;
signal LOAD : bit;
signal Data :bit_vector(0 to 7);
signal Q :bit_vector(0 to 7);
still have to begin with entity
end the entity
test is the name of the
architecture
the signals have to be the
same as the port signals in
your entity declaration of
the program you want to
test.
TestBench for 8 bit Shifter
component shift is
port (CLK, RST, LOAD : in bit;
Data : in bit_vector(0 to 7);
Q : out bit_vector(0 to 7));
end component;
begin
test_shift: shift port map(
CLK => CLK ,
RST => RST,
LOAD => LOAD,
Data => Data,
Q => Q);
port has all the input and
output signals used in the
VHDL program
The port map is used to link the
signal Data from your VHDL
program to the signal Data in
your testbench
TestBench for 8 bit Shifter
clock_gen : process
begin
clk <= '0', '1' after 50 ns;
wait for 100 ns;
end process;
RST<='1', '0' after 200 ns;
test_process: process
begin
Data<="00000001";
LOAD<='1', '0' after 400 ns
wait;
end process;
end test;
creates a clock signal
this is a 10 MHz clock
end the process clock_gen
this is only done once to set it off
data is give a value
every 400 ns Data is reset to
“00000001”
end the process test_process
end the test
System Overview
Programmable
Logic Device
DIP Switches
Strobe
(pushbutton)
An open
switch will
have a
value of ‘1’
and closed
switch
value of ‘0’
LED
•PLD monitors data stream looking for commands
•PLD responds to On command by turning LED On
•PLD responds to Off command by turning LED Off
Functional Overview
On Off
“AB” “50”
THANK YOU

More Related Content

What's hot

Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderBharti Airtel Ltd.
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDLEutectics
 
Practical file
Practical filePractical file
Practical filerajeevkr35
 
Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)Alok Singh
 
Logic Gates & Related Device
Logic Gates & Related DeviceLogic Gates & Related Device
Logic Gates & Related DeviceMd. Nahidul Islam
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorialraju reddy
 
Vlsi lab manual exp:1
Vlsi lab manual exp:1Vlsi lab manual exp:1
Vlsi lab manual exp:1komala vani
 
343logic-design-lab-manual-10 esl38-3rd-sem-2011
343logic-design-lab-manual-10 esl38-3rd-sem-2011343logic-design-lab-manual-10 esl38-3rd-sem-2011
343logic-design-lab-manual-10 esl38-3rd-sem-2011e11ie
 
Basic structures in vhdl
Basic structures in vhdlBasic structures in vhdl
Basic structures in vhdlRaj Mohan
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
 

What's hot (20)

Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
VHDL CODES
VHDL CODES VHDL CODES
VHDL CODES
 
Vhdl
VhdlVhdl
Vhdl
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDL
 
Practical file
Practical filePractical file
Practical file
 
Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)Basics of digital verilog design(alok singh kanpur)
Basics of digital verilog design(alok singh kanpur)
 
Cse
CseCse
Cse
 
VHDL Programs
VHDL ProgramsVHDL Programs
VHDL Programs
 
Basics of Vhdl
Basics of VhdlBasics of Vhdl
Basics of Vhdl
 
Logic Gates & Related Device
Logic Gates & Related DeviceLogic Gates & Related Device
Logic Gates & Related Device
 
Session1
Session1Session1
Session1
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
2th year iv sem de lab manual
2th year iv sem de lab manual2th year iv sem de lab manual
2th year iv sem de lab manual
 
Chap 3
Chap 3Chap 3
Chap 3
 
Vlsi lab manual exp:1
Vlsi lab manual exp:1Vlsi lab manual exp:1
Vlsi lab manual exp:1
 
343logic-design-lab-manual-10 esl38-3rd-sem-2011
343logic-design-lab-manual-10 esl38-3rd-sem-2011343logic-design-lab-manual-10 esl38-3rd-sem-2011
343logic-design-lab-manual-10 esl38-3rd-sem-2011
 
Basic structures in vhdl
Basic structures in vhdlBasic structures in vhdl
Basic structures in vhdl
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
 

Similar to FPGA Department Biomedical Engineering Faculty Engineering University Isfahan

Similar to FPGA Department Biomedical Engineering Faculty Engineering University Isfahan (20)

L6_Slides_vhdl coures temporary hair dye for dark hair
L6_Slides_vhdl coures temporary hair dye for dark hairL6_Slides_vhdl coures temporary hair dye for dark hair
L6_Slides_vhdl coures temporary hair dye for dark hair
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
dokumen.tips_vhdl-0-introduction-to-vhdl.ppt
dokumen.tips_vhdl-0-introduction-to-vhdl.pptdokumen.tips_vhdl-0-introduction-to-vhdl.ppt
dokumen.tips_vhdl-0-introduction-to-vhdl.ppt
 
Lecture3 combinational blocks
Lecture3 combinational blocksLecture3 combinational blocks
Lecture3 combinational blocks
 
Vhdl new
Vhdl newVhdl new
Vhdl new
 
VHDL summer training (ppt)
 VHDL summer training (ppt) VHDL summer training (ppt)
VHDL summer training (ppt)
 
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLSeminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
 
Session 02 _rtl_design_with_vhdl 101
Session 02 _rtl_design_with_vhdl 101Session 02 _rtl_design_with_vhdl 101
Session 02 _rtl_design_with_vhdl 101
 
Verilog_ppt.pdf
Verilog_ppt.pdfVerilog_ppt.pdf
Verilog_ppt.pdf
 
Chapter 06 Combinational Logic Functions
Chapter 06 Combinational Logic FunctionsChapter 06 Combinational Logic Functions
Chapter 06 Combinational Logic Functions
 
VHDL_VIKAS.pptx
VHDL_VIKAS.pptxVHDL_VIKAS.pptx
VHDL_VIKAS.pptx
 
Verilogspk1
Verilogspk1Verilogspk1
Verilogspk1
 
1.ppt
1.ppt1.ppt
1.ppt
 
Digital Electronics .
Digital Electronics                                              .Digital Electronics                                              .
Digital Electronics .
 
Verilog
VerilogVerilog
Verilog
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
 
Data Flow Modeling
Data Flow ModelingData Flow Modeling
Data Flow Modeling
 

More from Seyed Yahya Moradi (18)

DC motor controlling
DC motor controllingDC motor controlling
DC motor controlling
 
Arduino
ArduinoArduino
Arduino
 
Verilog
VerilogVerilog
Verilog
 
Research
ResearchResearch
Research
 
Statistic Dist
Statistic DistStatistic Dist
Statistic Dist
 
Commercialization workshop
Commercialization workshop Commercialization workshop
Commercialization workshop
 
Fpga 2
Fpga 2Fpga 2
Fpga 2
 
ECG
ECGECG
ECG
 
Neuroanatomy
NeuroanatomyNeuroanatomy
Neuroanatomy
 
Fuzzy motor
Fuzzy motorFuzzy motor
Fuzzy motor
 
Mean cardiac axis (cardiac vector)
Mean cardiac axis (cardiac vector)Mean cardiac axis (cardiac vector)
Mean cardiac axis (cardiac vector)
 
Chaos and chaotic
Chaos and chaoticChaos and chaotic
Chaos and chaotic
 
Presentation
PresentationPresentation
Presentation
 
Ip mv workshop
Ip mv workshopIp mv workshop
Ip mv workshop
 
BCI
BCIBCI
BCI
 
مگس درمانی
مگس درمانیمگس درمانی
مگس درمانی
 
SSVEP-BCI
SSVEP-BCISSVEP-BCI
SSVEP-BCI
 
Bio Sensor
Bio SensorBio Sensor
Bio Sensor
 

Recently uploaded

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 

Recently uploaded (20)

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 

FPGA Department Biomedical Engineering Faculty Engineering University Isfahan

  • 1. FPGA Department of Biomedical Engineering Faculty of Engineering University of Isfahan Seyed Yahya Moradi UI.FPGA@gmail.com
  • 2. HOME WORK • E- MAIL oHW?_#STDNUM (SUBJECT) SPAM! oWORD • NAME • TEMPLATE • REFERECE oEXE (ACTIE HDL) oALL ZIP THAT NAME IS HW?_#STDNUM
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. HOME WORK 0 • INSTAL THE ACTIVE HDL=100 • MAIN OF VHDL Main Error
  • 14. Introduction • A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturing – hence "field-programmable". • The FPGA configuration is generally specified using a hardware description language (HDL), similar to that used for an application-specific integrated circuit (ASIC).
  • 18. Introduction • CAD • 1. Computer Aided Diagnose • 2. Computer Aided Design • 3. 3D and 2D Design • ICCAD Conference
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. HOME WORK 1 • 1 ISI ARTICLE : Abstract • Design and Idea about a “ Kitchen DEVICE” For Mother's Day :) • Mother's Day is a celebration honoring the mother of the family, as well as motherhood, maternal bonds, and the influence of mothers in society. It is celebrated on various days in many parts of the world, most commonly in the months of February or everyday of the week
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 31. HOME WORK 2 • WHAT IS : • HALF ADDER=25 • FULL ADDER=25 • DECODER=25 • ENCODER=25
  • 32. HOME WORK 3 • WHAT IS : • CPU • BIT OF CPU /8/16/64 BIT • COMPONENT OF CPU • ALUCURIGISTER
  • 33. VHDL • What is VHDL? V H I S C  Very High Speed Integrated Circuit Hardware Description Language IEEE Standard 1076-1993
  • 34. History of VHDL • Designed by IBM, Texas Instruments, and Intermetrics as part of the DoD funded VHSIC program • Standardized by the IEEE in 1987: IEEE 1076-1987 • Enhanced version of the language defined in 1993: IEEE 1076- 1993 • Additional standardized packages provide definitions of data types and expressions of timing data o IEEE 1164 (data types) o IEEE 1076.3 (numeric) o IEEE 1076.4 (timing)
  • 35. Usage • Descriptions can be at different levels of abstraction o Switch level: model switching behavior of transistors o Register transfer level: model combinational and sequential logic components o Instruction set architecture level: functional behavior of a microprocessor • Descriptions can used for o Simulation • Verification, performance evaluation o Synthesis • First step in hardware design
  • 36. Digital System Design Flow Requirements Functional Design Register Transfer Level Design Logic Design Circuit Design Physical Design Description for Manufacture Behavioral Simulation RTL Simulation Validation Logic Simulation Verification Timing Simulation Circuit Analysis Design Rule Checking Fault Simulation • Design flows operate at multiple levels of abstraction • Need a uniform description to translate between levels • Increasing costs of design and fabrication necessitate greater reliance on automation via CAD tools – $5M - $100M to design new chips – Increasing time to market pressures
  • 37. 37 VHDL type classification See SG p 51, DG p 47. 10 ns “101110001110001” ‘1’ 125 FALSE ‘A’
  • 38. 38 A VHDL program library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ABorC is port ( A : in std_logic; B : in std_logic; C : in std_logic; F : out std_logic); end ABorC; architecture arch of ABorC is signal X : std_logic; begin X <= A and B after 1 ns; F <= X or C after 1 ns; end;
  • 39. 39 Operations that can be performed on type integer. See SG p 36, DG p 35 Use parentheses to force desired Precedence.
  • 40. 40 Constants constant CONST_NAME: <type_spec> := <value>; -- Examples of Declaration of Constants: constant GO: BOOLEAN := TRUE; constant Max: INTEGER := 31; constant HexMax: INTEGER := 16#FF#; -- hex (base 16) integer constant ONE: BIT := '1'; constant S0: BIT_VECTOR (3 downto 0) := "0000"; constant S1: bit_vector(15 downto 0) := X"AB3F“; -- hex string constant HiZ: STD_LOGIC := 'Z'; -- Here Z is high impedance. constant Ready: STD_LOGIC_VECTOR (3 downto 0) := "0-0-"; -- 0’s & don’t cares Note: VHDL is not case sensitive. -- is used for comments. • BOOLEAN, INTEGER, BIT, etc are examples of predefined VHDL types. o VHDL is a strongly typed language. o Cannot for example directly assign a bit or std_logic value to an integer type
  • 41. 41 Variables VAR_NAME := <expression>; -- example Count := 10; Vbit := '0'; • Declaration variable VAR_NAME: <type_spec>; -- example: variable Test: BOOLEAN; variable Count: INTEGER range 0 to 31 := 15; -- Set initial value to 15. variable vBIT: BIT; variable VAR: BIT_VECTOR (3 downto 0); variable VAR_X: STD_LOGIC := ‘0’; -- Set initial value to ‘0’. variable VAR_Y: STD_LOGIC_VECTOR (0 to 3);
  • 42. 42 Signals SIG_NAME <= <expression>; -- Examples BitX <= ‘1’; • Declaration signal SIG_NAME: <type_spec>; -- example: signal Flag: BOOLEAN := TRUE; -- TRUE is the initial vlaue signal intX: INTEGER range 0 to 31; signal BitX: BIT := ‘1’; signal Control_Bus: BIT_VECTOR (3 downto 0); signal X: STD_LOGIC; signal Y: STD_LOGIC_VECTOR (0 to 3) := “0000”;
  • 43. 43 VHDL example EX 1 --EX1.vhd ENTITY tb is END tb; ARCHITECTURE test OF tb IS signal X : BIT; BEGIN X <= not X after 10 ns; END test;
  • 44. 44 --EX2.vhd ENTITY tb is END tb; ARCHITECTURE test OF tb IS signal X, Y : BIT; BEGIN X <= not X after 10 ns; Y <= '1' after 5 ns, '0' after 12 ns, '1' after 25 ns; END test;
  • 45. 45 std_logic_1164 multi- value logic system TYPE std_ulogic IS ( 'U', -- Uninitialized 'X', -- Forcing Unknown '0', -- Forcing 0 '1', -- Forcing 1 'Z', -- High Impedance 'W', -- Weak Unknown 'L', -- Weak 0 'H', -- Weak 1 '-' -- Don't care );
  • 46. 46 And Or gate in VHDL example library IEEE;use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ABorC is port ( A : in std_logic; B : in std_logic; C : in std_logic; F : out std_logic); end ABorC; architecture arch of ABorC is signal X : std_logic; begin X <= A and B after 1 ns; F <= X or C after 1 ns; end; 1 2 3 C FB X A 1 2 3
  • 47. 47 Process • Process statements occur within an architecture. • The syntax for a process is: LABEL1: -- optional label process (signal_name, …) is -- declarations begin -- sequential statements end process LABEL1;
  • 48. 48 Process example • Without process statements architecture ex_arc of ex4 is signal X: BIT; signal Y: BIT; signal Z, V, W: BIT; Begin -- concurrent signals assignments X <= not X after 10 ns; Y <= not Y after 25 ns; Z <= X and Y after 2 ns; V <= (Z xor not W) nand X after 3 ns; W <= X or Y after 1 ns; end architecture ex_arc; • With process statements Process(X) begin X <= not X after 10 ns; End process; P2: process(y) begin Y <= not Y after 25 ns; End process P2; P3: Process(X,Y,Z,W) begin Z <= X and Y after 2 ns; V <= (Z xor not W) nand X after 3 ns; End process P3; P4: process(X,Y) begin W <= X or Y after 1 ns; End process P4;
  • 49. Basic Structure of a VHDL File • Entity o Entity declaration: interface to outside world; defines input and output signals o Architecture: describes the entity, contains processes, components operating concurrently
  • 50. Entity Declaration entity NAME_OF_ENTITY is port (signal_names: mode type; signal_names: mode type; : signal_names: mode type); end [NAME_OF_ENTITY] ; • NAME_OF_ENTITY: user defined • signal_names: list of signals (both input and output) • mode: in, out, buffer, inout • type: boolean, integer, character, std_logic
  • 51. Architecture • Behavioral Model: architecture architecture_name of NAME_OF_ENTITY is -- Declarations ….. ….. begin -- Statements end architecture_name;
  • 52. Entity Examples … entity half_adder is port( x,y: in std_logic; sum, carry: out std_logic); end half_adder; Half ADDER X Y SUM CARRY
  • 53. Half Adder library ieee; use ieee.std_logic_1164.all; entity half_adder is port( x,y: in std_logic; sum, carry: out std_logic); end half_adder; architecture myadd of half_adder is begin sum <= x xor y; carry <= x and y; end myadd;
  • 54. Entity Examples … entity FULL_adder is port( A, B, C: in std_logic; sum, carry: out std_logic); end half_adder; FULL ADDER A B C SUM CARRY
  • 55. Architecture Examples: Behavioral Description • Entity FULLADDER is port ( A, B, C: in std_logic; SUM, CARRY: in std_logic); end FULLADDER; • Architecture CONCURRENT of FULLADDER is begin SUM <= A xor B xor C after 5 ns; CARRY <= (A and B) or (B and C) or (A and C) after 3 ns; end CONCURRENT;
  • 56. Architecture Examples: Structural Description … • architecture STRUCTURAL of FULLADDER is signal S1, C1, C2 : bit; component HA port (I1, I2 : in bit; S, C : out bit); end component; component OR port (I1, I2 : in bit; X : out bit); end component; begin INST_HA1 : HA port map (I1 => B, I2 => C, S => S1, C => C1); INST_HA2 : HA port map (I1 => A, I2 => S1, S => SUM, C => C2); INST_OR : OR port map (I1 => C2, I2 => C1, X => CARRY); end STRUCTURAL; I1 S HA I2 C I1 S HA I2 C I1 OR I2 x A C B CARRY SUM S1 C1 C2
  • 58. 58 U1: entity work.or3 port map (A => AB, B => ACin , C => BCin , F => Cout); U2: entity work.and2 port map (A => A, B => B, F => AB); U3: entity work.and2 port map (A => B, B => Cin, F => BCin); U4: entity work.and2 port map (A => A, B => Cin, F => ACin); U5: entity work.xor2 port map (A, B, AxorB); U6: entity work.xor2 port map (Cin, AxorB, S); AB B A U5 XOR2 F A B ACin Cin Cout Cin A B U4 AND2 F A B U3 AND2 F A B BCin U6 XOR2 F A B S U1 OR3 F A B C AxorB U2 AND2 F A B
  • 59. Problem Solving in Persian!
  • 60.
  • 61.
  • 62. VHDL Code -- STEP ONE library ieee; use ieee.std_logic_1164.all; -- STEP TWO entity PR1 is port( A,B,C: in std_logic; F: out std_logic); end PR1; -- STEP THREE architecture PRa of PR1 is begin Signal x,y,z; std_logic_vector (3 downto 0); x <= a and b; y <= a and c; z <= b and c; F <= x or y or z; end PRa;
  • 63.
  • 64.
  • 65.
  • 67. 4 to 1 MUX Mux Sel Inputs OutputsA B C D Q
  • 68. 4 to 1 MUX library ieee; use ieee.std_logic_1164.all; -- 4 to 1 mux entity mymux is port (A, B, C, D : in std_logic_vector(0 to 3); Sel : in std_logic_vector ( 0 to 1 ); Q : out std_logic_vector(0 to 3) ); end mymux; Library you need to include Comment entity “name_of_entity” is port(all your input and output signals); end “name_of_entity”;
  • 69. 4 to 1 MUX architecture mux4 of mymux is constant delay : time := 100 ns; begin mux_proc : process ( A, B, C, D, Sel ) variable temp : std_logic_vector(0 to 3); begin case Sel is when "00" => temp := A; when "01" => temp := B; when "10" => temp := C; when "11" => temp := D; when others => temp := "XXXX"; end case; Q <= temp after delay; end process mux_proc; end mux4; mux4 is the name of my architecture Declaration of time as a constant begin the architecture Process mux_proc is initialized Variable temp is declared begin process mux_proc case on the Sel singal If anything else then temp is don’t care If there was a delay on the mux end process end architecture
  • 70. TestBench for 4 to 1 MUX library ieee; use ieee.std_logic_1164.all; entity mux_testbench is end mux_testbench; architecture test of mux_testbench is signal A : std_logic_vector(0 to 3); signal B: std_logic_vector(0 to 3); signal C: std_logic_vector(0 to 3); signal D: std_logic_vector(0 to 3); signal Sel: std_logic_vector(0 to 1); signal Q: std_logic_vector(0 to 3); still have to begin with entity end the entity test is the name of the architecture the signals have to be the same as the port signals in your entity declaration of the program you want to test.
  • 71. TestBench for 4 to 1 MUX component mymux is port (A, B, C, D : in std_logic_vector(0to3); Sel : in std_logic_vector ( 0 to 1 ); Q : out std_logic_vector(0 to 3)); end component; begin test_mux: mymux port map( A => A , B => B, C => C , D => D, Sel => Sel, Q => Q ); This component declaration tells us that we have 5 inputs A,B,C,D and Sel; we also have one output Q The port map is used to link the signal A from your VHDL program to the signal A in your testbench Used incase you want to use different names
  • 72. TestBench for 4 to 1 MUX test_process: process begin A<="1010"; B<="1011"; C<="1100"; D<="1101"; Sel<="00"; wait for 500 ns; Sel<="01"; wait for 500 ns; Sel<="10"; wait for 500 ns; Sel<="11"; wait for 500 ns; end process; end test; initialize your signal when Sel is 00 it should let A come through on Q with a delay of 100ns when Sel is 01 Q should be B end the process test_process end the test
  • 73. 8- Bit Shifter Shifter clk rst load data 8 bits 8 bits Q Input Output
  • 74. 8 – Bit Shifter -- 8-Bit Shift Register library ieee; use ieee.std_logic_1164.all; entity shift is port (CLK, RST, LOAD : in bit; Data : in bit_vector(0 to 7); Q : out bit_vector(0 to 7)); end rotate; Comment Library you need to include entity “name_of_entity” is port(all your input and output signals); end “name_of_entity”;
  • 75. 8 – bit shifterarchitecture shifter1 of shift is begin reg : process(RST, CLK) variable reg : bit_vector(0 to 7); begin if(RST = '1') then reg := "00000000"; elsif(CLK = '1' and CLK'event) then if(LOAD = '1') then reg := Data; . else reg := reg(1 to 7) & reg(0); end if; end if; Q <= reg; end process; end shifter1; shifter1 is the name of my architecture shift is the name of my entity reg is the name of my process reg is also a local variable Begin the process reg if RST clear reg else wait for a clock event then reg = Data if LOAD signal is high a bit shift R gets the value of reg end process end architecture
  • 76. TestBench for 8 bit shifter library ieee; use ieee.std_logic_1164.all; entity shift_testbench is end shift_testbench; architecture test of shift_testbench is Signal CLK : bit; signal RST : bit; signal LOAD : bit; signal Data :bit_vector(0 to 7); signal Q :bit_vector(0 to 7); still have to begin with entity end the entity test is the name of the architecture the signals have to be the same as the port signals in your entity declaration of the program you want to test.
  • 77. TestBench for 8 bit Shifter component shift is port (CLK, RST, LOAD : in bit; Data : in bit_vector(0 to 7); Q : out bit_vector(0 to 7)); end component; begin test_shift: shift port map( CLK => CLK , RST => RST, LOAD => LOAD, Data => Data, Q => Q); port has all the input and output signals used in the VHDL program The port map is used to link the signal Data from your VHDL program to the signal Data in your testbench
  • 78. TestBench for 8 bit Shifter clock_gen : process begin clk <= '0', '1' after 50 ns; wait for 100 ns; end process; RST<='1', '0' after 200 ns; test_process: process begin Data<="00000001"; LOAD<='1', '0' after 400 ns wait; end process; end test; creates a clock signal this is a 10 MHz clock end the process clock_gen this is only done once to set it off data is give a value every 400 ns Data is reset to “00000001” end the process test_process end the test
  • 79. System Overview Programmable Logic Device DIP Switches Strobe (pushbutton) An open switch will have a value of ‘1’ and closed switch value of ‘0’ LED
  • 80. •PLD monitors data stream looking for commands •PLD responds to On command by turning LED On •PLD responds to Off command by turning LED Off Functional Overview On Off “AB” “50”