INTRODUCTION TO VHDL ADVANCED COMPUTER ARCHITECTURES. Slides by: Pedro Tomás. Additional reading: - ARQUITECTURAS AVANÇADAS DE COMPUTADORES (AAC)

Size: px
Start display at page:

Download "INTRODUCTION TO VHDL ADVANCED COMPUTER ARCHITECTURES. Slides by: Pedro Tomás. Additional reading: - ARQUITECTURAS AVANÇADAS DE COMPUTADORES (AAC)"

Transcription

1 INTRODUCTION TO VHDL Slides by: Pedro Tomás Additional reading: - ADVANCED COMPUTER ARCHITECTURES ARQUITECTURAS AVANÇADAS DE COMPUTADORES (AAC)

2 Outline 2 Hardware Description Languages (HDL) VHDL Very High Speed Integrated Circuits (VHSIC) Hardware Description Language Typical VHDL structure General Tips and tricks Examples

3 What is VHDL 3 Hardware Description Language (HDL) Used to describe digital and mixed-signal systems such as Field-Programmable Gate Arrays (FPGAs) and Integrated Circuits (ICs) The advantage of such a language, regarding graphical editors, is that eases the creation process of complex digital circuits. However, one should have in mind that when programming In VHDL, you are actually designing digital circuits. Thus, a strong understanding of your code is more important than syntax and style.

4 VHDL Basics 4 In VHDL the description of a logic block is divided into two parts: Inputs and Outputs Entity defines the input and output ports (i.e., how the internal circuit interfaces with the outside world); A B C D Chip E Architecture: Defines the actual behavior/implementation/function of the component; A B Chip X E one entity can have more than one architectural definition. C D Y

5 Structure of a VHDL file 5 -- DECLARATION OF LIBRARIES library IEEE; use IEEE.std_logic_1164.all; -- IEEE Standard library use work.mylibrary.all; -- User defined library -- Definition of the component interface (input/output signals) entity <COMPONENTE_NAME> is port ( ); end <COMPONENTE_NAME>; -- Architecture definition (more than one type can co-exist) -- Just name the type whatever you want, e.g., behavior architecture <ARCHITECTURE_TYPE> of <COMPONENTE_NAME> is -- general declarations, such as signals (wires) and components -- used to define the architecture of this component Begin -- Description of the component architecture end <ARCHITECTURE_TYPE>;

6 VHDL Features 6 Case insensitive inputa, INPUTA and InputA refer to the same variable/signal/component Comments -- until end of line If you want to comment multiple lines, -- need to be put at the beginning of every single line Statements are terminated by ; Signal assignment: <= User defined names: letters, numbers, underscores ( _ ) start with a letter

7 Simple example 7 -- import std_logic from the IEEE library library IEEE; use IEEE.std_logic_1164.all; -- this is the entity entity ANDGATE is port ( A : in std_logic; B : in std_logic; S : out std_logic ); end ANDGATE; Library definitions, including signal type and some basic operation and functions Entity declaration, defines the interconnection to the outside world architecture Behavioral of ANDGATE is -- declare architecture specific types -- declare internal signals Begin -- describe architecture operation S <= A and B; end Behavioral; Specifies the ANDGATE operation

8 IEEE standard VHDL libraries 8 library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_textio.all; use IEEE.std_logic_arith.all; use IEEE.numeric_bit.all; use IEEE.numeric_std.all; use IEEE.std_logic_signed.all; use IEEE.std_logic_unsigned.all; use IEEE.math_real.all; use IEEE.math_complex.all; Provides enhanced signal types, e.g., std_ulogic, std_ulogic_vector, std_logic, std_logic_vector Provides interface to text files (usefull in simulations) Provides numerical computation (e.g., + (plus), - (minus), * (times)) on std_logic_vector, signed and unsigned types Provides computation on signed or unsigned arrays of type bit. Provides computation on signed or unsigned arrays of type std_logic. Provides signed computation on signals of type std_logic_vector. Provides unsigned computation on signals of type std_logic_vector. Provides numerical computation on type real. Provides numerical computation on type complex.

9 9 VHDL types: Standard type declarations type Bit is ('0', '1'); type Boolean is (false, true); type Integer is range --usually typical integer-- ; subtype Natural is Integer range 0 to Integer'high; subtype Positive is Integer range 1 to Integer'high; type Time is range --implementation defined-- ; units fs; -- femtosecond ps = 1000 fs; -- picosecond ns = 1000 ps; -- nanosecond us = 1000 ns; -- microsecond ms = 1000 us; -- millisecond sec = 1000 ms; -- second min = 60 sec ; -- minute hr = 60 min; -- hour end units;

10 VHDL types: IEEE type declarations 10 type std_logic is ( U, -- unitialized X, -- unknown 0, -- logic state 0 1, -- logic state 1 Z, -- high impedance W, -- weak signal (either 0 or 1) L, -- weak signal leaning 0 H, -- weak signal leaning 1 -, -- don t care ); type std_logic_vector is array (natural range <>) of std_logic;

11 11 VHDL types: Declaring new types Type declarations useful for state-machines: type mystate is (S1,S2,S3); Type declarations useful for counters: type count_int is range 0 to 35; Record type declarations: type InstructionType is record OPCODE : std_logic_vector(6 downto 0); DR : std_logic_vector(4 downto 0); AA : std_logic_vector(4 downto 0); BA : std_logic_vector(4 downto 0); end record;

12 VHDL signals: Declaring signals 12 signal X,Y,Z : std_logic; signal A : std_logic_vector(31 downto 0); -- A is a 32 bit bus signal B : std_logic_vector(15 downto 0); -- B is a 16 bit bus signal count_value : count_int; signal myinst : InstructionType;

13 13 VHDL architecture: Assignment and execution architecture behavior of my_circuit is -- signal declaration signal A, B, C : std_logic; signal vec1 : std_logic_vector(2 downto 0); signal vec2 : std_logic_vector(2 downto 0); begin A <= 0 ; -- assign logic value 0 B <= 1 ; -- assign logic value 1 C <= A; -- assign value of A to C Assignment can be moved around with no difference in the resulting operation Code is NOT sequential, but parallel vec1 <= 011 ; -- assign value of 3 vec2 <= A & B & C; -- assign the concatenation of A, B and C -- vec2 takes the values of 2. end behavior;

14 14 VHDL architecture: Assignment and execution -- 2-input AND gate S1 <= A and B; -- 3-input OR gate S2 <= A or B or C; -- XOR gate S3 <= A xor B; -- Combined gate S4 <= (A xor B) or (not (C and D)); -- Conditional assignment S5 <= 0 when A= 1 and B= 0 else 1 ; -- Conditional assignment ArrayValue <= 00 when State=S0 and ControlValue= 0000 else S1 xor S2 when State=S1 else S3 or S4 when State=S2 or State=S3 else S5 and S1;

15 VHDL architecture: Assignment and execution n-bit registers (i.e., n parallel flip-flops) Dout <= Din when rising_edge(clk); -- n-bit register with enable (i.e., n parallel flip-flops) Dout <= Din when rising_edge(clk) and en= 1 ; -- n-bit register with enable and asynchronous reset Dout <= (n-1 downto 0=> 0 ) when reset= 1 else Din when rising_edge(clk) and en= 1 ; -- n-bit register with enable and asynchronous set Dout <= (others=> 1 ) when set= 1 else Din when rising_edge(clk) and en= 1 ; VHDL standard Description Alternative VHDL description CLK event and CLK= 1 Rising edge of signal CLK rising_edge(clk) CLK event and CLK= 0 Falling edge of signal CLK falling_edge(clk)

16 VHDL architecture: Processes 16 Advanced behaviour descriptions can be made by using the process construction <optional process name>: process(<sensitivity list>) <variable declarations> Begin <multiple assignments> <multiple assignments> <multiple assignments> Inside processes code execution is serialized end process;

17 VHDL architecture: Example of processes 17 Advanced behaviour descriptions can be made by using the process construction <optional process name>: process(<sensitivity list>) <variable declarations> begin <multiple assignments> end process; -- register with asynchronous reset process(clk,reset) begin if reset= 1 then Dout <= (others=> 0 ); elsif rising_edge(clk) then Dout <= Din; end if; end process; -- register with synchronous reset process(clk) begin if rising_edge(clk) then if reset= 1 then Dout <= (others=> 0 ); else Dout <= Din; end if; end if; end process;

18 VHDL architecture: Example of processes 18 Advanced behaviour descriptions can be made by using the process construction <optional process name>: process(<sensitivity list>) <variable declarations> begin <multiple assignments> end process; -- multiplier (return only the least significant bits) process(a,b) variable aux: std_logic_vector(2*n-1 downto 0); Begin aux := A*B; Dout <= aux(n-1 downto 0); end process; Variable assignment is made by using a different operator :=

19 VHDL architecture: Example of processes 19 Advanced behaviour descriptions can be made by using the process construction <optional process name>: process(<sensitivity list>) <variable declarations> begin <multiple assignments> end process; Processes are handy and very useful in special occasions, however You are not sure the compiler will understand exactly what you want In general, hardware is better described (area, performance, ) by avoiding the use of processes

20 20 First useful example Creating a register file

21 Creating a register file 21 Consider that one wants to design a processor Assume the first block to be designed is the register file 8-bit registers 4 register in total A Address A Data B Address B Data Write Address Write Enable Write Data AA A BA B Asynchronous read ports RF Register file DA WE DATA Synchronous write ports CLK Clock

22 22 Creating a register file: Declaring the interface -- import std_logic from the IEEE library library IEEE; use IEEE.std_logic_1164.all; -- this is the entity entity RegisterFile is port ( -- Output port A AA : in std_logic_vector(1 downto 0); A : out std_logic_vector(7 downto 0); -- Output port B BA : in std_logic_vector(1 downto 0); B : out std_logic_vector(7 downto 0); -- input port D DA : in std_logic_vector(1 downto 0); WE : in std_logic; Data : in std_logic_vector(7 downto 0) ); end RegisterFile; The last line does not need a ; architecture Behavioral of RegisterFile is

23 23 Creating a register file: Architecture Destination Address DA log 2 (d) Decoder 0 Address 1 2 Write Enable WE EN d-1 Data n D EN D EN D EN D EN R(d-1) R2 R1 R0 A Address A Data B Address B Data Write Address Write Enable Write Data Q Q Q Q AA MUX Operand A Address A AA A BA B Asynchronous read ports RF Register file DA WE DATA Synchronous write ports CLK Clock MUX Operand B Address B BA

24 24 Creating a register file: Declaring the internal signals Destination Address DA log 2 (d) Decoder 0 Address 1 2 Write Enable WE EN d-1 Data n D EN D EN D EN D EN R(d-1) R2 R1 R0 entity RegisterFile is port ( ); end RegisterFile; Q Reg3 Q Reg2 Q Reg1 Q Reg0 AA MUX Operand A Address A architecture Behavioral of RegisterFile is MUX B signal Reg0, Reg1, Reg2, Reg3 : std_logic_vector(7 downto 0); BA Operand B Address begin end Behavioral;

25 25 Creating a register file: Describing the architecture entity RegisterFile is port ( ); end RegisterFile; Destination Address DA Decoder Address architecture Behavioral of Write RegisterFile is Enable signal Reg0, Reg1, Reg2, Reg3 WE : std_logic_vector(7 EN d-1 downto 0); begin Data log 2 (d) n A <= Reg0 when AA= 00 else Reg1 when AA= 01 else Reg2 when AA= 10 else Reg3 when AA= 11 ; B <= Reg0 when BA= 00 else Reg1 when BA= 01 else Reg2 when BA= 10 else Reg3 when BA= 11 ; end Behavioral; EN Q D R(d-1) Reg3 EN R2 Q D Reg2 EN R1 Q D Reg1 What happens when AA or BA is not one of those values? The synthesis tool will generate a latch EN R0 Q D Reg0 AA MUX MUX BA Operand A Address Operand B Address A B

26 26 Creating a register file: Describing the architecture entity RegisterFile is port ( ); end RegisterFile; Destination Address DA Decoder Address architecture Behavioral of Write RegisterFile is Enable signal Reg0, Reg1, Reg2, Reg3 WE : std_logic_vector(7 EN d-1 downto 0); begin Data log 2 (d) n A <= Reg0 when AA= 00 else Reg1 when AA= 01 else Reg2 when AA= 10 else Reg3; B <= Reg0 when BA= 00 else Reg1 when BA= 01 else Reg2 when BA= 10 else Reg3; D EN R(d-1) Q Reg3 EN R2 Q D Reg2 EN R1 Q D Reg1 EN R0 Q D Reg0 AA MUX MUX BA Operand A Address Operand B Address A B end Behavioral; Avoids the use of a latch

27 27 Creating a register file: Describing the architecture architecture Behavioral of RegisterFile is signal Reg0, Reg1, Reg2, Reg3 : std_logic_vector(7 downto 0); begin A <= Reg0 when AA= 00 else Reg1 when AA= 01 else Reg2 when AA= 10 else Reg3; Destination Address DA log 2 (d) Decoder 0 Address 1 2 B <= Reg0 when BA= 00 else Reg1 when BA= 01 else Reg2 when BA= 10 else Reg3; Write Enable WE Data n EN d-1 D EN R(d-1) D EN R2 D EN R1 D EN R0 Reg0 <= Data when DA= 00 and rising_edge(clk); Reg1 <= Data when DA= 01 and rising_edge(clk); Reg2 <= Data when DA= 10 and rising_edge(clk); Reg3 <= Data when DA= 11 and rising_edge(clk); Q Q Q Q A MUX end Behavioral; MUX

28 28 Instantiating a VHDL Module: Declaring the interface -- import std_logic from the IEEE library library IEEE; use IEEE.std_logic_1164.all; -- this is the entity entity RegisterFile is port ( -- Output port A architecture Behavioral of OF_Stage is AA : in std_logic_vector(1 downto 0); A : out std_logic_vector(7 downto component 0); RegisterFile -- Output port B port ( BA : in std_logic_vector(1 downto 0); B : out std_logic_vector(7 downto 0); -- input port D DA : in std_logic_vector(1 downto 0); WE : in std_logic; Data : in std_logic_vector(7 downto 0) ); end RegisterFile; ); entity OF_Stage is port ( ); end OF_Stage; end component; architecture Behavioral of RegisterFile is AA : in std_logic_vector(1 downto 0); A : out std_logic_vector(7 downto 0); BA : in std_logic_vector(1 downto 0); B : out std_logic_vector(7 downto 0); DA : in std_logic_vector(1 downto 0); WE : in std_logic; Data : in std_logic_vector(7 downto 0) The last line does not need a ; Begin -- describe architecture operation end Behavioral;

29 29 Instantiating a VHDL Module: Using an instance -- import std_logic from the IEEE library library IEEE; use IEEE.std_logic_1164.all; -- this is the entity entity RegisterFile is port ( -- Output port A entity OF_Stage is port ( ); end OF_Stage; architecture Behavioral of OF_Stage is AA : in std_logic_vector(1 downto 0); A : out std_logic_vector(7 downto component 0); RegisterFile -- Output port B port (); BA : in std_logic_vector(1 downto end component; 0); B : out std_logic_vector(7 downto 0); -- input port D begin DA : in std_logic_vector(1 downto -- use 0); as many instances as you want WE : in std_logic; <required instance_name> : RegisterFile ( Data : in std_logic_vector(7 downto AA 0) => <signal declared in OF_Stage>, ); BA => <signal declared in OF_Stage>, A => <signal declared in OF_Stage>, end RegisterFile; B => open, -- leave signal unconnected architecture Behavioral of RegisterFile is DA => <signal declared need in a OF_Stage>, ; Once the component is declared, multiple instances can be instantiated The last line does not WE => <signal declared in OF_Stage>, Data => <signal declared in OF_Stage> ); end Behavioral;

30 30 Generics and for generates How do we scale the architecture considering: a) Number of registers b) Word size

31 VHDL example: Register file port map 31 A Address A Data B Address B Data Write Address Write Enable Write Data AA A BA B Asynchronous read ports RF Register file DA WE DATA Synchronous write ports CLK Clock entity RegisterFile is Generic ( REG_ADD_WIDTH : NATURAL := 5; REG_DATA_WIDTH : NATURAL := 32 ); Port ( CLK: in STD_LOGIC; AA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); BA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); DA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); D : in STD_LOGIC_VECTOR (REG_DATA_WIDTH-1 downto 0); WE : in STD_LOGIC; A : out STD_LOGIC_VECTOR (REG_DATA_WIDTH-1 downto 0); B : out STD_LOGIC_VECTOR (REG_DATA_WIDTH-1 downto 0) ); end RegisterFile;

32 32 VHDL example: Register file architecture architecture Behavioral of RegisterFile is type RegisterTableType is array(2**reg_add_width-1 downto 0) of std_logic_vector(reg_data_width-1 downto 0); signal RegisterTable,RTaux : RegisterTableType; begin -- Asynchronous read process A <= RegisterTable(conv_integer(AA)); B <= RegisterTable(conv_integer(BA)); -- Register r[0] is always 0 RegisterTable(0) <= (others =>'0'); -- Synchronous write process to remaining registers (2**N 2^N) WriteUnit: for i in 1 to 2**REG_ADD_WIDTH-1 generate process(clk) begin if rising_edge(clk) then if WE='1' and conv_integer(da)=i then RegisterTable(i) <= D; end if; end if; end process; end generate; Requires: end Behavioral; use IEEE.STD_LOGIC_UNSIGNED.ALL;

33 33 Using VHDL Packages How do we scale the architecture considering: a) Number of registers b) Word size

34 VHDL Packages Library declarations library IEEE; use IEEE.STD_LOGIC_1164.all; package <package_name> is -- Declare constants -- Declare types -- Declare functions and procedures end <package_name>; package body <package_name> is ---- Example 1 -- function <function_name> (signal <signal_name> : in <type_declaration> ) -- return <type_declaration> is -- variable <variable_name> : <type_declaration>; -- begin -- <variable_name> := <signal_name> xor <signal_name>; -- return <variable_name>; -- end <function_name>; end <package_name>;

35 VHDL Packages Library declarations library IEEE; use IEEE.STD_LOGIC_1164.all; package processor_definitions is -- Declare constants constant word_width : integer := 32; constant reg_add_width : integer := 5; constant num_registers : integer := 32; -- Declare types type word is array (word_width-1 downto 0) of std_logic; type word_array is array (integer range <>) of word; type ID_EX_record is record A,B : word; AdderOperation : std_logic_vector(1 downto 0); end record; end processor_definitions; package body processor_definitions is end processor_definitions;

36 VHDL example: Register file port map 36 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use WORK.PROCESSOR_DEFINITIONS.ALL; entity RegisterFile is Port ( CLK: in STD_LOGIC; AA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); BA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); DA : in STD_LOGIC_VECTOR (REG_ADD_WIDTH-1 downto 0); D : in word; WE : in STD_LOGIC; A : out word; B : out word ); end RegisterFile;

37 VHDL example: Register file architecture 37 architecture Behavioral of RegisterFile is type RegisterTableType is word_array(2**reg_add_width-1 downto 0); signal RegisterTable,RTaux : RegisterTableType; begin -- Asynchronous read process A <= RegisterTable(conv_integer(AA)); B <= RegisterTable(conv_integer(BA)); -- Register r[0] is always 0 RegisterTable(0) <= (others =>'0'); -- Synchronous write process to remaining registers (2**N 2^N) WriteUnit: for i in 1 to 2**REG_ADD_WIDTH-1 generate process(clk) begin if rising_edge(clk) then if WE='1' and conv_integer(da)=i then RegisterTable(i) <= D; end if; end if; end process; end generate; end Behavioral;

38 38 Basic processor elements Logic unit Adder/subtractor Multiplier Simple Shift / Barrel Shifter Memories Instruction decoder

39 VHDL example: Logic unit 39 architecture Behavioral of RegisterFile is type RegisterTableType is word_array(2**reg_add_width-1 downto 0); signal RegisterTable,RTaux : RegisterTableType; begin -- Asynchronous read process A <= RegisterTable(conv_integer(AA)); B <= RegisterTable(conv_integer(BA)); -- Register r[0] is always 0 RegisterTable(0) <= (others =>'0'); -- Synchronous write process to remaining registers (2**N 2^N) WriteUnit: for i in 1 to 2**REG_ADD_WIDTH-1 generate process(clk) begin if rising_edge(clk) then if WE='1' and conv_integer(da)=i then RegisterTable(i) <= D; end if; end if; end process; end generate; end Behavioral;

40 VHDL architecture: Logic unit 40 OPER. SEL RESULT Operand A A S Result MOVB 00 S B AND 01 S A B Operand B B Logic Unit OR 10 S A B XOR 11 S A B Operation Select SEL Flags Flags (Z) S <= B when SEL= 00 else A and B when SEL= 01 else A or B when SEL= 10 else A xor B; -- all other undefined cases;

41 VHDL architecture: Arithmetic unit 41 OPER. SEL RESULT ADD 000 S A + 1 SUB 001 S A 1 INC DEC MULL MULH MULU MULUH 010 S A + B 011 S A B 100 S A * B (LSB, signed) 101 S A * B (MSB, signed) 110 S A * B (LSB, unsigned) 111 S A * B (MSB, unsigned) Operand A A S Result Operand B B Arithmetic Unit Operation Select SEL Flags Flags (Z,N,C,V)

42 VHDL architecture: Arithmetic unit 42 OPER. SEL RESULT ADDER (Option 1) ADD 000 S A + 1 SUB 001 S A 1 INC 010 S A + B Sum <= A + '1' when Sel(1 downto 0)="00" else A - '1' when Sel(1 downto 0)="01" else A + B when Sel(1 downto 0)="10" else DEC MULL MULH MULU MULUH 011 S A B 100 S A * B (LSB, signed) 101 S A * B (MSB, signed) 110 S A * B (LSB, unsigned) 111 S A * B (MSB, unsigned) A - B; Leads to the use of excessive functional units Operand A A S Result Operand B Operation Select B SEL Arithmetic Unit Flags Flags (Z,N,C,V) Requires: use IEEE.STD_LOGIC_SIGNED.ALL;

43 43 VHDL architecture: Arithmetic unit OPER. SEL RESULT ADDER (Option 2) ADD 000 S A + 1 SUB 001 S A 1 AddA <= A; INC DEC MULL MULH MULU MULUH 010 S A + B ugen: for i in 0 to word_width-1 generate 011 S A B AddB(i) <= (B(i) and Sel(1)) xor Sel(0); end generate; 100 S A * B (LSB, signed) 101 S A * B (MSB, signed) Cin <= Sel(1) xnor Sel(0); 110 S A * B (LSB, unsigned) Sum <= AddA + AddB + Cin; 111 S A * B (MSB, unsigned) Operand A A S Result Operand B Operation Select B SEL Arithmetic Unit Flags Flags (Z,N,C,V) Requires: use IEEE.STD_LOGIC_SIGNED.ALL;

44 44 VHDL architecture: Arithmetic unit OPER. SEL RESULT ADDER (Option 3) ADD 000 S A + 1 SUB 001 S A 1 INC 010 S A + B DEC 011 S A B AddA <= A; AddB <= (B and (word_width-1 downto 0=>Sel(1))) xor (word_width-1 downto 0=>Sel(0)); MULL MULH MULU MULUH 100 S A * B (LSB, signed) Cin <= Sel(1) xnor Sel(0); 101 S A * B (MSB, signed) Sum <= AddA + AddB + Cin; 110 S A * B (LSB, unsigned) 111 S A * B (MSB, unsigned) Operand A A S Result Operand B Operation Select B SEL Arithmetic Unit Flags Flags (Z,N,C,V) Requires: use IEEE.STD_LOGIC_SIGNED.ALL;

45 45 VHDL architecture: Arithmetic unit OPER. SEL RESULT ADD 000 S A + 1 SUB 001 S A 1 MULTIPLIER signal AuxA, AuxB : std_logic_vector(32 downto 0); signal Res : std_logic_vector(65 downto 0); INC 010 S A + B DEC MULL MULH MULU MULUH 011 S A B AuxA <= A(31) & A when Sel(1)='0' else '0' & A; 100 S A * B (LSB, signed) AuxB <= B(31) & B when Sel(1)='0' else '0' & B; 101 S A * B (MSB, signed) 110 S A * B (LSB, unsigned) Res <= AuxA * AuxB; 111 S A * B (MSB, unsigned) Prod <= Res(31 downto 0) when Sel(0)= 0 else Res(63 downto 32); Operand A A S Result Operand B Operation Select B SEL Arithmetic Unit Flags Flags (Z,N,C,V) Requires: use IEEE.STD_LOGIC_SIGNED.ALL;

46 VHDL architecture: Barrel Shifter 46 OPER. LSL LSR ASL ASR ROL ROR ROLC RORC SEL RESULT 000 S A << N 001 S A >> N 010 S A << N (arithmetic) 011 S A >> N (arithmetic) 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N)

47 VHDL architecture: Barrel Shifter 47 OPER. SEL RESULT LSL / ASL (1 times) LSL 000 S A << N LSR 001 S A >> N ASL ASR ROL 010 S A << N (arithmetic) 011 S A >> N (arithmetic) 100 S ROL(A,N) C Res <= A(width-2 downto 0) & 0; C <= A(width-1); ROR ROLC 101 S ROR(A,N) 110 S ROL(A,C,N) LSL / ASL (2 times) RORC 111 S ROR(A,C,N) C n <= conv_integer(sh); Res <= A(width-1-n downto 0) & (n-1 downto 0=> 0 ); C <= A(width-n);

48 VHDL architecture: Barrel Shifter 48 OPER. SEL RESULT LSR (1 times) LSL 000 S A << N LSR 001 S A >> N ASL ASR ROL ROR ROLC RORC 010 S A << N (arithmetic) 011 S A >> N (arithmetic) 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N) Res <= 0 & A(width-1 downto 1); C <= A(0); LSR (n times) Res <= (n-1 downto 0=> 0 ) & A(width-1 downto n); C C <= A(0);

49 VHDL architecture: Barrel Shifter 49 OPER. LSL LSR ASL ASR ROL ROR ROLC RORC SEL RESULT 000 S A << N 001 S A >> N 010 S A << N (arithmetic) 011 S A >> N (arithmetic) 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N) ASR (1 times) C Res <= A(width-1) & A(width-1 downto 1); C <= A(0); ASR (n times) Res <= (n-1 downto 0=> A(width-1)) & A(width-1 downto n); C <= A(0);

50 VHDL architecture: Barrel Shifter 50 OPER. SEL RESULT ROL ROR ROLC RORC 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N) C Res <= A(n-1 downto 0) & A(width-1 downto n) C <= A(n-1);

51 VHDL architecture: Barrel Shifter 51 OPER. SEL RESULT ROL ROR ROLC RORC 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N) Cr C Res <= A(width-1-n downto 0) & Cr & A(width-1 downto n) C <= A(width-n);

52 52 VHDL architecture: Multi-mode Barrel Shifter OPER. LSL LSR ASL ASR ROL ROR ROLC RORC SEL RESULT 000 S A << N 001 S A >> N 010 S A << N (arithmetic) 011 S A >> N (arithmetic) 100 S ROL(A,N) 101 S ROR(A,N) 110 S ROL(A,C,N) 111 S ROR(A,C,N) Aux <= A & (width-1 downto 0=> 0 ) A & A A & Cr & A(width-1 downto 1); when sel(2)= 0 else when sel(1)= 0 else Res <= Aux(2*width-1-n downto width-n); C <= A(2*width-n);

53 53 VHDL architecture: Dual Port Memory library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity DualPortMemory is Generic ( ADDR_SIZE : positive := 8 ); Port ( CLK_A : in STD_LOGIC; WE_A : in STD_LOGIC; Addr_A : in STD_LOGIC_VECTOR (ADDR_SIZE-1 downto 0); DI_A : in STD_LOGIC_VECTOR (31 downto 0); DO_A : out STD_LOGIC_VECTOR (31 downto 0); ); end DualPortMemory; CLK_B : in STD_LOGIC; WE_B : in STD_LOGIC; Addr_B : in STD_LOGIC_VECTOR (ADDR_SIZE-1 downto 0); DI_B : in STD_LOGIC_VECTOR (31 downto 0); DO_B : out STD_LOGIC_VECTOR (31 downto 0) architecture Behavioral of DualPortMemory is begin end Behavioral;

54 VHDL architecture: Dual Port Memory 54 entity DualPortMemory is end DualPortMemory; architecture Behavioral of DualPortMemory is -- declare a type of matrix of words the memory type MEM_TYPE is array (0 to (2**ADDR_SIZE)-1) of STD_LOGIC_VECTOR(31 downto 0); -- declare a constant with the memory initial value constant InitValue : MEM_TYPE := ( 0 => " ", -- Binary value for address 0 1 => " ", 3 => " ", 4 => "000011" & "00100" & "00011" & "00010" & " ", 5 => "000001" & "00101" & "00100" & "00010" & " ", -- value for address 5 17 => X"000001AB", -- Hexadecimal value for address 17 others => x" "); -- value for all addresses not previously defined -- declare the signal correspondent to the RAM memory -- and define an initial value shared variable myram : MEM_TYPE := InitValue0; begin end Behavioral;

55 VHDL architecture: Dual Port Memory 55 architecture Behavioral of DualPortMemory is begin -- architecture for port A process (CLK_A) begin if rising_edge(clk_a) then if WE_A='1' then RAM(conv_integer(Addr_A)) := DI_A; end if; DO_A <= RAM(conv_integer(Addr_A)); end if; end process; -- architecture for port B process (CLK_B) begin if rising_edge (CLK_B) then if WE_B='1' then RAM(conv_integer(Addr_B)) := DI_B; end if; DO_B <= RAM(conv_integer(Addr_B)); end if; end process; To ensure that the synthesis tool infers a Block RAM, the memory reading ports must be synchronous end Behavioral;

56 56 Testbenches Creating a stimulus generator to validate the described architecture

57 Circuit validation 57 To fully validate the correct behavior of the circuit, it is necessary to test the circuit output value for all combinations of: Input signals Circuit internal state In practice this means describing a signal generator capable of reproducing all combinations of such values (i.e., of the truth table)

58 Description of a Testbench 58 Similar to all other VHDL modules, except that: It does not require the description of any input/output ports library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity my_testbench is end my_testbench; architecture Behavioral of my_testbench is Declare the VHDL module(s) to be tested and all required signals begin end Behavioral; Instantiate all VHDL module(s) to be tested and describe Generate the signals that allow you to test the VHDL module

59 Typical testbench signals 59 Clock signal with period of 50 ns process begin clk <= 0 ; wait for 25 ns; clk <= 1 ; wait for 25 ns; end process; Counter with period of 10 ns process begin code <= code + 1; wait for 10 ns; end process;

60 Typical testbench signals 60 Other cases process begin -- state the value signals wait for clk_period; -- state the value of the same or other signals wait for 1.5*clk_period; -- state the value of the same or other signals wait for clk_period/5; wait; -- forever end process;

Hardware Description Language VHDL (1) Introduction

Hardware Description Language VHDL (1) Introduction Hardware Description Language VHDL (1) Introduction Digital Radiation Measurement and Spectroscopy NE/RHP 537 Introduction Hardware description language (HDL) Intended to describe circuits textually, for

More information

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University Hardware description language (HDL) Intended to describe circuits textually, for a computer to read Evolved starting in the 1970s and 1980s Popular languages today include: VHDL Defined in 1980s by U.S.

More information

VHDL And Synthesis Review

VHDL And Synthesis Review VHDL And Synthesis Review VHDL In Detail Things that we will look at: Port and Types Arithmetic Operators Design styles for Synthesis VHDL Ports Four Different Types of Ports in: signal values are read-only

More information

Review of Digital Design with VHDL

Review of Digital Design with VHDL Review of Digital Design with VHDL Digital World Digital world is a world of 0 and 1 Each binary digit is called a bit Eight consecutive bits are called a byte Hexadecimal (base 16) representation for

More information

In our case Dr. Johnson is setting the best practices

In our case Dr. Johnson is setting the best practices VHDL Best Practices Best Practices??? Best practices are often defined by company, toolset or device In our case Dr. Johnson is setting the best practices These rules are for Class/Lab purposes. Industry

More information

ELCT 501: Digital System Design

ELCT 501: Digital System Design ELCT 501: Digital System Lecture 4: CAD tools (Continued) Dr. Mohamed Abd El Ghany, Basic VHDL Concept Via an Example Problem: write VHDL code for 1-bit adder 4-bit adder 2 1-bit adder Inputs: A (1 bit)

More information

Control and Datapath 8

Control and Datapath 8 Control and Datapath 8 Engineering attempts to develop design methods that break a problem up into separate steps to simplify the design and increase the likelihood of a correct solution. Digital system

More information

Computer-Aided Digital System Design VHDL

Computer-Aided Digital System Design VHDL بس م اهلل الر حم ن الر حی م Iran University of Science and Technology Department of Computer Engineering Computer-Aided Digital System Design VHDL Ramin Rajaei ramin_rajaei@ee.sharif.edu Modeling Styles

More information

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles ECE 448 Lecture 4 Sequential-Circuit Building Blocks Mixing Description Styles George Mason University Reading Required P. Chu, FPGA Prototyping by VHDL Examples Chapter 4, Regular Sequential Circuit Recommended

More information

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language) Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits Hardware Description Language) 1 Standard ICs PLD: Programmable Logic Device CPLD: Complex PLD FPGA: Field Programmable

More information

Lecture 12 VHDL Synthesis

Lecture 12 VHDL Synthesis CPE 487: Digital System Design Spring 2018 Lecture 12 VHDL Synthesis Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 1 What is Synthesis?

More information

Contents. Appendix D VHDL Summary Page 1 of 23

Contents. Appendix D VHDL Summary Page 1 of 23 Appendix D VHDL Summary Page 1 of 23 Contents Appendix D VHDL Summary...2 D.1 Basic Language Elements...2 D.1.1 Comments...2 D.1.2 Identifiers...2 D.1.3 Data Objects...2 D.1.4 Data Types...2 D.1.5 Data

More information

ECE 545 Lecture 4. Simple Testbenches. George Mason University

ECE 545 Lecture 4. Simple Testbenches. George Mason University ECE 545 Lecture 4 Simple Testbenches George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 2.2.4, Testbenches 2 Testbenches ECE 448 FPGA and ASIC Design with VHDL 3 Testbench

More information

CDA 4253 FPGA System Design VHDL Testbench Development. Hao Zheng Comp. Sci & Eng USF

CDA 4253 FPGA System Design VHDL Testbench Development. Hao Zheng Comp. Sci & Eng USF CDA 4253 FPGA System Design VHDL Testbench Development Hao Zheng Comp. Sci & Eng USF art-4- > 70% projects spent > 40% time in verification 2 Validation, Verification, and Testing Validation: Does the

More information

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Cengage Learning Design Flow 418_02 2 VHDL Modules 418_02 3 VHDL Libraries library IEEE; use IEEE.std_logic_1164.all; std_logic Single-bit

More information

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic George Mason University Reading Required P. Chu, FPGA Prototyping by VHDL Examples Chapter 3, RT-level

More information

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic George Mason University Reading Required P. Chu, FPGA Prototyping by VHDL Examples Chapter 3, RT-level

More information

Lattice VHDL Training

Lattice VHDL Training Lattice Part I February 2000 1 VHDL Basic Modeling Structure February 2000 2 VHDL Design Description VHDL language describes a digital system as a set of modular blocks. Each modular block is described

More information

VHDL for FPGA Design. by : Mohamed Samy

VHDL for FPGA Design. by : Mohamed Samy VHDL for FPGA Design by : Mohamed Samy VHDL Vhdl is Case insensitive myvar = myvar = MYVAR IF = if = if Comments start with -- Comments can exist anywhere in the line Semi colon indicates the end of statements

More information

EEL 4783: Hardware/Software Co-design with FPGAs

EEL 4783: Hardware/Software Co-design with FPGAs EEL 4783: Hardware/Software Co-design with FPGAs Lecture 9: Short Introduction to VHDL* Prof. Mingjie Lin * Beased on notes of Turfts lecture 1 What does HDL stand for? HDL is short for Hardware Description

More information

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University ECE 545 Lecture 8 Data Flow Description of Combinational-Circuit Building Blocks George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 7, Combinational Circuit Design:

More information

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden Synthesis from VHDL Krzysztof Kuchcinski Krzysztof.Kuchcinski@cs.lth.se Department of Computer Science Lund Institute of Technology Sweden March 23, 2006 Kris Kuchcinski (LTH) Synthesis from VHDL March

More information

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture Assignment Last time Project 4: Using synthesis tools Synplify Pro and Webpack Due 11/11 ning of class Generics Used to parameterize models E.g., Delay, bit width Configurations Configuration specification

More information

Introduction to VHDL. Main language concepts

Introduction to VHDL. Main language concepts Introduction to VHDL VHSIC (Very High Speed Integrated Circuit) Hardware Description Language Current standard is IEEE 1076-1993 (VHDL-93). Some tools still only support VHDL-87. Tools used in the lab

More information

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs Logic and Computer Design Fundamentals VHDL Part Chapter 4 Basics and Constructs Charles Kime & Thomas Kaminski 24 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Overview

More information

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents VHDL Testbench Tutorial 1 Contents 1 VHDL Testbench 2 Test Bench Syntax 3 Testbench Example: VHDL Code for Up Down Binary Counter 4 VHDL Testbench code for up down binary counter 5 Testbench Waveform for

More information

COE 405 Design Methodology Based on VHDL

COE 405 Design Methodology Based on VHDL COE 405 Design Methodology Based on VHDL Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Outline Elements of VHDL Top-Down Design Top-Down Design with

More information

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 Anurag Dwivedi Digital Design : Bottom Up Approach Basic Block - Gates Digital Design : Bottom Up Approach Gates -> Flip Flops Digital

More information

VHDL simulation and synthesis

VHDL simulation and synthesis VHDL simulation and synthesis How we treat VHDL in this course You will not become an expert in VHDL after taking this course The goal is that you should learn how VHDL can be used for simulation and synthesis

More information

IT T35 Digital system desigm y - ii /s - iii

IT T35 Digital system desigm y - ii /s - iii UNIT - V Introduction to Verilog Hardware Description Language Introduction HDL for combinational circuits Sequential circuits Registers and counters HDL description for binary multiplier. 5.1 INTRODUCTION

More information

HDL. Hardware Description Languages extensively used for:

HDL. Hardware Description Languages extensively used for: HDL Hardware Description Languages extensively used for: Describing (digital) hardware (formal documentation) Simulating it Verifying it Synthesizing it (first step of modern design flow) 2 main options:

More information

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1 Lecture 1: VHDL Quick Start Digital Systems Design Fall 10, Dec 17 Lecture 1 1 Objective Quick introduction to VHDL basic language concepts basic design methodology Use The Student s Guide to VHDL or The

More information

VHDL in 1h. Martin Schöberl

VHDL in 1h. Martin Schöberl VHDL in 1h Martin Schöberl VHDL /= C, Java, Think in hardware All constructs run concurrent Different from software programming Forget the simulation explanation VHDL is complex We use only a small subset

More information

Sequential Statement

Sequential Statement Sequential Statement Sequential Logic Output depends not only on current input values but also on previous input values. Are building blocks of; Counters Shift registers Memories Flip flops are basic sequential

More information

Contents. Chapter 9 Datapaths Page 1 of 28

Contents. Chapter 9 Datapaths Page 1 of 28 Chapter 9 Datapaths Page of 2 Contents Contents... 9 Datapaths... 2 9. General Datapath... 3 9.2 Using a General Datapath... 5 9.3 Timing Issues... 7 9.4 A More Complex General Datapath... 9 9.5 VHDL for

More information

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006 310/1780-10 ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006 VHDL & FPGA - Session 2 Nizar ABDALLH ACTEL Corp. 2061 Stierlin Court

More information

Microcomputers. Outline. Number Systems and Digital Logic Review

Microcomputers. Outline. Number Systems and Digital Logic Review Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded

More information

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University ECE 545 Lecture 6 Behavioral Modeling of Sequential-Circuit Building Blocks George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 5.1, VHDL Process Chapter 8, Sequential

More information

CprE 583 Reconfigurable Computing

CprE 583 Reconfigurable Computing Recap Moore FSM Example CprE / ComS 583 Reconfigurable Computing Moore FSM that recognizes sequence 10 0 1 0 1 S0 / 0 S1 / 0 1 S2 / 1 Prof. Joseph Zambreno Department of Electrical and Computer Engineering

More information

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009 2065-15 Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis 26 October - 20 November, 2009 FPGA Architectures & VHDL Introduction to Synthesis Nizar Abdallah ACTEL Corp.2061

More information

Design units can NOT be split across different files

Design units can NOT be split across different files Skeleton of a Basic VHDL Program This slide set covers the components to a basic VHDL program, including lexical elements, program format, data types and operators A VHDL program consists of a collection

More information

Getting Started with VHDL

Getting Started with VHDL Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component Entities can be primitive objects or complex objects Architectures are associated

More information

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems EE 3610: Digital Systems 1 Lecture 3: Modeling in VHDL VHDL: Overview 2 VHDL VHSIC Hardware Description Language VHSIC=Very High Speed Integrated Circuit Programming language for modelling of hardware

More information

Writing VHDL for RTL Synthesis

Writing VHDL for RTL Synthesis Writing VHDL for RTL Synthesis Stephen A. Edwards, Columbia University December 21, 2009 The name VHDL is representative of the language itself: it is a two-level acronym that stands for VHSIC Hardware

More information

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX Outline CPE/EE 422/522 Advanced Logic Design L07 Electrical and Computer Engineering University of Alabama in Huntsville What we know How to model Combinational Networks in VHDL Structural, Dataflow, Behavioral

More information

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

!#$%&&'(')*+%,%-.#'/'.001$$ !"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"!!"#$%&'#()#*+"+#,-."/0110#230#4."50",+"+#)6# 6+-+#(.6+-0#)4475.8)60#0/#.65-0#230#9+**+"+# 2.48).-0#(.6+-0#! 2+"*5."5*:#,."/0110#;)**0! *),".6*:#-.99-0*0"5."+#2+660,.40"5)#;)*)2)#

More information

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized Multi-valued Logic Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized X, unknown 0, logic 0 1, logic 1 Z, high impedance W, unknown L, logic 0 weak H, logic 1 weak - ); don t care Standard

More information

Sequential Logic - Module 5

Sequential Logic - Module 5 Sequential Logic Module 5 Jim Duckworth, WPI 1 Latches and Flip-Flops Implemented by using signals in IF statements that are not completely specified Necessary latches or registers are inferred by the

More information

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language VHDL Introduction to Structured VLSI Design VHDL I Very High Speed Integrated Circuit (VHSIC) Hardware Description Language Joachim Rodrigues A Technology Independent, Standard Hardware description Language

More information

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design Two HDLs used today Introduction to Structured VLSI Design VHDL I VHDL and Verilog Syntax and ``appearance'' of the two languages are very different Capabilities and scopes are quite similar Both are industrial

More information

VHDL: RTL Synthesis Basics. 1 of 59

VHDL: RTL Synthesis Basics. 1 of 59 VHDL: RTL Synthesis Basics 1 of 59 Goals To learn the basics of RTL synthesis. To be able to synthesize a digital system, given its VHDL model. To be able to relate VHDL code to its synthesized output.

More information

Introduction to VHDL #1

Introduction to VHDL #1 ECE 3220 Digital Design with VHDL Introduction to VHDL #1 Lecture 3 Introduction to VHDL The two Hardware Description Languages that are most often used in industry are: n VHDL n Verilog you will learn

More information

Chapter 6 Combinational-Circuit Building Blocks

Chapter 6 Combinational-Circuit Building Blocks Chapter 6 Combinational-Circuit Building Blocks Commonly used combinational building blocks in design of large circuits: Multiplexers Decoders Encoders Comparators Arithmetic circuits Multiplexers A multiplexer

More information

Digital Design with SystemVerilog

Digital Design with SystemVerilog Digital Design with SystemVerilog Prof. Stephen A. Edwards Columbia University Spring 25 Synchronous Digital Design Combinational Logic Sequential Logic Summary of Modeling Styles Testbenches Why HDLs?

More information

ECE 545 Lecture 12. FPGA Resources. George Mason University

ECE 545 Lecture 12. FPGA Resources. George Mason University ECE 545 Lecture 2 FPGA Resources George Mason University Recommended reading 7 Series FPGAs Configurable Logic Block: User Guide Overview Functional Details 2 What is an FPGA? Configurable Logic Blocks

More information

C-Based Hardware Design

C-Based Hardware Design LECTURE 6 In this lecture we will introduce: The VHDL Language and its benefits. The VHDL entity Concurrent and Sequential constructs Structural design. Hierarchy Packages Various architectures Examples

More information

Inthis lecture we will cover the following material:

Inthis lecture we will cover the following material: Lecture #8 Inthis lecture we will cover the following material: The standard package, The std_logic_1164 Concordia Objects & data Types (Signals, Variables, Constants, Literals, Character) Types and Subtypes

More information

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1] FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language Reference: [] FIELD PROGRAMMABLE GATE ARRAY FPGA is a hardware logic device that is programmable Logic functions may be programmed

More information

Digital Systems Design

Digital Systems Design Digital Systems Design Review of Combinatorial Circuit Building Blocks: VHDL for Combinational Circuits Dr. D. J. Jackson Lecture 2-1 Introduction to VHDL Designer writes a logic circuit description in

More information

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used.

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used. Filename= ch5.doc 5. 0 VHDL OPERATORS There are seven groups of predefined VHDL operators: 1. Binary logical operators: and or nand nor xor xnor 2. Relational operators: = /= < >= 3. Shifts operators:

More information

Lecture 4. VHDL Basics. Simple Testbenches

Lecture 4. VHDL Basics. Simple Testbenches Lecture 4 VHDL Basics Simple Testbenches George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 2, Overview of Hardware Description Languages Chapter 3, Basic Language

More information

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes) Last (family) name: Answer Key First (given) name: Student I.D. #: Department of Electrical and Computer Engineering University of Wisconsin - Madison ECE 551 Digital System Design and Synthesis Midterm

More information

Digital Design with FPGAs. By Neeraj Kulkarni

Digital Design with FPGAs. By Neeraj Kulkarni Digital Design with FPGAs By Neeraj Kulkarni Some Basic Electronics Basic Elements: Gates: And, Or, Nor, Nand, Xor.. Memory elements: Flip Flops, Registers.. Techniques to design a circuit using basic

More information

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2 VHDL 2 Combinational Logic Circuits Reference: Roth/John Text: Chapter 2 Combinational logic -- Behavior can be specified as concurrent signal assignments -- These model concurrent operation of hardware

More information

Very High Speed Integrated Circuit Har dware Description Language

Very High Speed Integrated Circuit Har dware Description Language Very High Speed Integrated Circuit Har dware Description Language Industry standard language to describe hardware Originated from work in 70 s & 80 s by the U.S. Departm ent of Defence Root : ADA Language

More information

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1 ACS College of Engineering Department of Biomedical Engineering Logic Design Lab pre lab questions (2015-2016) Cycle-1 1. What is a combinational circuit? 2. What are the various methods of simplifying

More information

Basic Language Constructs of VHDL

Basic Language Constructs of VHDL Basic Language Constructs of VHDL Chapter 3 1 Outline 1. Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators Chapter 3 2 1. Basic VHDL program Chapter 3 3 Design

More information

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University ECE 545 Lecture 5 Data Flow Modeling in VHDL George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 4, Concurrent Signal Assignment Statements of VHDL 2 Types of VHDL Description

More information

ECE 459/559 Secure & Trustworthy Computer Hardware Design

ECE 459/559 Secure & Trustworthy Computer Hardware Design ECE 459/559 Secure & Trustworthy Computer Hardware Design VHDL Overview Garrett S. Rose Spring 2016 Recap Public Key Encryption (PKE) RSA (Rivest, Shamir and Adelman) Encryption Advanced Encryption Standard

More information

Summary of FPGA & VHDL

Summary of FPGA & VHDL FYS4220/9220 Summary of FPGA & VHDL Lecture #6 Jan Kenneth Bekkeng, University of Oslo - Department of Physics 16.11.2011 Curriculum (VHDL & FPGA part) Curriculum (Syllabus) defined by: Lectures Lecture6:

More information

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit VHDL VHDL Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit VHDL Alternative (Student Generated) Definition Very Hard Digital Logic language VHDL Design

More information

[VARIABLE declaration] BEGIN. sequential statements

[VARIABLE declaration] BEGIN. sequential statements PROCESS statement (contains sequential statements) Simple signal assignment statement

More information

Introduction to VHDL #3

Introduction to VHDL #3 ECE 322 Digital Design with VHDL Introduction to VHDL #3 Lecture 7 & 8 VHDL Modeling Styles VHDL Modeling Styles Dataflow Concurrent statements Structural Components and interconnects Behavioral (sequential)

More information

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory Instructor John Chandy Office: ITEB 437 Office Hours: W10-12 Tel: (860) 486-5047 Email: john.chandy@uconn chandy@uconn.edu Class home page: HuskyCT

More information

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory CS211 Digital Systems/Lab Introduction to VHDL Hyotaek Shim, Computer Architecture Laboratory Programmable Logic Device (PLD) 2/32 An electronic component used to build reconfigurable digital circuits

More information

Lecture 4. VHDL Fundamentals. George Mason University

Lecture 4. VHDL Fundamentals. George Mason University Lecture 4 VHDL Fundamentals George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 3, Basic Language Constructs of VHDL 2 Design Entity ECE 448 FPGA and ASIC Design with

More information

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group Hardware Modeling VHDL Syntax Vienna University of Technology Department of Computer Engineering ECS Group Contents Identifiers Types & Attributes Operators Sequential Statements Subroutines 2 Identifiers

More information

Timing in synchronous systems

Timing in synchronous systems BO 1 esign of sequential logic Outline Timing in synchronous networks Synchronous processes in VHL VHL-code that introduces latches andf flip-flops Initialization of registers Mealy- and Moore machines

More information

The VHDL Hardware Description Language

The VHDL Hardware Description Language The VHDL Hardware Description Language p. 1/? The VHDL Hardware Description Language CSEE W4840 Prof. Stephen A. Edwards Columbia University The VHDL Hardware Description Language p. 2/? Why HDLs? 1970s:

More information

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs. CPE 626 Lecture 4: VHDL Recapitulation (Part 2) Aleksandar Milenkovic http://www.ece.uah.edu/~milenka http://www.ece.uah.edu/~milenka/cpe626-04f/ milenka@ece.uah.edu Assistant Professor Electrical and

More information

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits M1 Informatique / MOSIG Introduction to Modeling and erification of Digital Systems Part 4: HDL for sequential circuits Laurence PIERRE http://users-tima.imag.fr/amfors/lpierre/m1arc 2017/2018 81 Sequential

More information

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013 MARIE CURIE IAPP: FAST TRACKER FOR HADRON COLLIDER EXPERIMENTS 1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013 Introduction to VHDL Calliope-Louisa Sotiropoulou PhD Candidate/Researcher Aristotle University

More information

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL IE24 Digital Design L7: Combinational circuits, Introduction to VHDL Elena Dubrova KTH / ICT / ES dubrova@kth.se This lecture BV 38-339, 6-65, 28-29,34-365 IE24 Digital Design, HT 24 2 The multiplexer

More information

Lecture 3 Introduction to VHDL

Lecture 3 Introduction to VHDL CPE 487: Digital System Design Spring 2018 Lecture 3 Introduction to VHDL Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 1 Managing Design

More information

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library : UNIT I Introduction to VHDL VHDL stands for very high-speed integrated circuit hardware description language. Which is one of the programming languages used to model a digital system by dataflow, behavioral

More information

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks. Outline CPE/EE 422/522 Advanced Logic Design L05 Electrical and Computer Engineering University of Alabama in Huntsville What we know Combinational Networks Sequential Networks: Basic Building Blocks,

More information

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools ECE U530 Digital Hardware Synthesis Prof. Miriam Leeser mel@coe.neu.edu Sept 13, 2006 Lecture 3: Basic VHDL constructs Signals, Variables, Constants VHDL Simulator and Test benches Types Reading: Ashenden

More information

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\ CSCI 250 - Lab 3 VHDL Syntax Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\ Objectives 1. Learn VHDL Valid Names 2. Learn the presentation of Assignment and Comments 3. Learn Modes, Types, Array,

More information

EEL 4712 Digital Design Test 1 Spring Semester 2008

EEL 4712 Digital Design Test 1 Spring Semester 2008 IMPORTANT: Please be neat and write (or draw) carefully. If we cannot read it with a reasonable effort, it is assumed wrong. Also, as always, the best answer gets the most points. COVER SHEET: Problem:

More information

8 Register, Multiplexer and

8 Register, Multiplexer and 8 Register, Multiplexer and Three-State Inference HDL Compiler can infer Registers (latches and flip flops) Multiplexers Three state gates This chapter discusses methods of inferring different types of

More information

VHDL: A Crash Course

VHDL: A Crash Course VHDL: A Crash Course Dr. Manuel Jiménez With contributions by: Irvin Ortiz Flores Electrical and Computer Engineering Department University of Puerto Rico - Mayaguez Outline Background Program Structure

More information

3 Designing Digital Systems with Algorithmic State Machine Charts

3 Designing Digital Systems with Algorithmic State Machine Charts 3 Designing with Algorithmic State Machine Charts An ASM chart is a method of describing the sequential operations of a digital system which has to implement an algorithm. An algorithm is a well defined

More information

Concurrent Signal Assignment Statements (CSAs)

Concurrent Signal Assignment Statements (CSAs) Concurrent Signal Assignment Statements (CSAs) Digital systems operate with concurrent signals Signals are assigned values at a specific point in time. VHDL uses signal assignment statements Specify value

More information

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2 VHDL: Modeling RAM and Register Files Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2 Memory Synthesis Approaches: Random logic using flip-flops or latches Register files in datapaths RAM standard components

More information

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators VHDL Part 2 Some of the slides are taken from http://www.ece.uah.edu/~milenka/cpe428-02s/ What is on the agenda? Basic VHDL Constructs Data types Objects Packages and libraries Attributes Predefined operators

More information

Field Programmable Gate Array

Field Programmable Gate Array Field Programmable Gate Array System Arch 27 (Fire Tom Wada) What is FPGA? System Arch 27 (Fire Tom Wada) 2 FPGA Programmable (= reconfigurable) Digital System Component Basic components Combinational

More information

EITF35: Introduction to Structured VLSI Design

EITF35: Introduction to Structured VLSI Design EITF35: Introduction to Structured VLSI Design Part 2.2.2: VHDL-3 Liang Liu liang.liu@eit.lth.se 1 Outline Inference of Basic Storage Element Some Design Examples DFF with enable Counter Coding Style:

More information

A Brief Introduction to Verilog Hardware Definition Language (HDL)

A Brief Introduction to Verilog Hardware Definition Language (HDL) www.realdigital.org A Brief Introduction to Verilog Hardware Definition Language (HDL) Forward Verilog is a Hardware Description language (HDL) that is used to define the structure and/or behavior of digital

More information

Subprograms, Packages, and Libraries

Subprograms, Packages, and Libraries Subprograms, Packages, and Libraries Sudhakar Yalamanchili, Georgia Institute of Technology ECE 4170 (1) function rising_edge (signal clock: std_logic) return boolean is declarative region: declare variables

More information

Chapter 2 Using Hardware Description Language Verilog. Overview

Chapter 2 Using Hardware Description Language Verilog. Overview Chapter 2 Using Hardware Description Language Verilog CSE4210 Winter 2012 Mokhtar Aboelaze based on slides by Dr. Shoab A. Khan Overview Algorithm development isa usually done in MATLAB, C, or C++ Code

More information