Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.

Slides:



Advertisements
Similar presentations
LECTURE 4: The VHDL N-bit Adder
Advertisements

1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
Arbitrary Waveform Discussion 5.5 Example 34.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Mridula Allani Fall 2010 (Refer to the comments if required) ELEC Fall 2010, Nov 21(Adopted from Profs. Nelson and Stroud)
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL ECE 448 Lecture 10 Advanced Testbenches.
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 3 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
Random-Access Memory Distributed and Block RAM Discussion D10.3 Example 41.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
ECE 448: Spring 12 Lab Midterm Exam Review. Part 1: Detailed discussion of a selected midterm from Spring Part 2: Review & discussion of common.
Design Verification VHDL ET062G & ET063G Lecture 5 Najeem Lawal 2012.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
Finite State Machines VHDL ET062G & ET063G Lecture 6 Najeem Lawal 2012.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Main Project : Simple Processor Mini-Project : 3-bit binary counter (using 7400 series) Memory By Oluwayomi B. Adamo.
George Mason University ECE 545 – Introduction to VHDL Variables, Functions, Memory, File I/O ECE 545 Lecture 7.
1 ECE 545 – Introduction to VHDL Dataflow Modeling of Combinational Logic Simple Testbenches ECE 656. Lecture 2.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis Aleksandar Milenkovic
Joachim Rodrigues, EIT, LTH, Introduction to Structured VLSI Design VHDL IV Introduction to Structured VLSI Design - VHDL IV Joachim Rodrigues.
Mixed Style RTL Modeling
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 3: The VHDL N-bit Adder Instructor: Francis G. Wolff Case Western Reserve.
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
VHDL Hardware Description Language. GUIDELINES How to write HDL code: How to write HDL code:
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Controllers ENGIN 341 – Advanced Digital Design University of Massachusetts Boston Department of Engineering Dr. Filip Cuckov.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
CDA 4253 FPGA System Design Sequential Circuit Building Blocks Hao Zheng Dept of Comp Sci & Eng USF.
Unit 4 Structural Descriptions SYLLABUS Highlights of Structural descriptions Organization of the Structural descriptions Binding State Machines Generate(HDL),Generic(VHDL),
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Lecture 11 Xilinx FPGA Memories Part 2
George Mason University Advanced Testbenches Lecture 4.
Joal 2006 HT:1 Em3 Digital Electronics Design 1 Lecture 3-4 Sequential VHDLChap 4.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #19 –VHDL.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL.
Sequential statements (1) process
Combinational logic circuit
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Sequential-Circuit Building Blocks
ECE 434 Advanced Digital System L08
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
VHDL (VHSIC Hardware Description Language)
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Behavioral Modeling of Sequential-Circuit Building Blocks
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Data Flow Description of Combinational-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
Data Flow Description of Combinational-Circuit Building Blocks
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
Presentation transcript:

Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012

DATA STORAGE 2 OUTLINE –Counters –Shift registers –Memories –Generate –Generics –Error management –Line Buffers VHDL ET062G & ET063G Lecture 4 Najeem Lawal, 2012

COUNTERS IN VHDL 3 VHDL ET062G & ET063G Lecture 4 MODULO-256 COUNTER library ieee; use ieee.std_logic_1164.ALL; use work.numeric_std.ALL; entity modulo256 IS PORT(clk: in std_logic; cnt: buffer unsigned (7 downto 0)); END modulo256; architecture rtl of modulo256 is begin process (clk) begin if rising_edge(clk) then cnt <= cnt +1; end if end process; end rtl; Najeem Lawal, 2012

SHIFT-REGISTER IN VHDL 4 VHDL ET062G & ET063G Lecture 4 library ieee; use ieee.std_logic_1164.ALL; entity shift_l is port ( clk, resetn, d_in, shift_en : in std_logic; shift_out:out std_logic_vector(3 downto 0)); end shift_l; d_inshift_out shift_en resetn Alternative ways Najeem Lawal, 2012 architecture rtl of shift_l is signal shift_reg: std_logic_vector(3 downto 0); begin process (clk, resetn) begin if resetn = '0' then shift_reg '0'); elsif clk'event and clk = '1' then if shift_en='1' then shift_reg(3 downto 1)<=shift_reg(2 downto 0); -- shift_reg <= shl(shift_reg, "1"); -- shift_reg <= shift_reg sll 1; shift_reg(0) <= d_in; end if; end process; shift_out <= shift_reg; end rtl;

MEMORIES IN VHDL 5 VHDL ET062G & ET063G Lecture 4 MEMORIES OCCUR AS –Registers (signals, constants, variables or ports) –RAMs –ROMs A RAM OR ROM CAN BE DESIGNED IN TWO WAYS –Use the data-type array –Use a pre-defined macro cell for the memory device Najeem Lawal, 2012

MEMORIES IN VHDL 6 VHDL ET062G & ET063G Lecture 4 A RAM CAN BE DUAL PORT OR SINGLE PORT Najeem Lawal, 2012

MEMORIES IN VHDL 7 VHDL ET062G & ET063G Lecture 4 Address contention in dual port can be solved by specifying the order of execution for example, read first or write first. Najeem Lawal, 2012

MEMORIES IN VHDL 8 VHDL ET062G & ET063G Lecture 4 data path 1 writes to and read from Port A, data path 2 write to and read from Port B, data path 3 implements data transfer from Port A to Port B, data path 4 implements data transfer from Port B to Port A. Najeem Lawal, 2012

EXAMPLE: 4  8 ROM IN VHDL 9 VHDL ET062G & ET063G Lecture 4 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity ROM is port ( address : in std_logic_vector(1 downto 0); dout : out std_logic_vector(7 downto 0)); end ROM; architecture rtl of ROM is type rom_table is array (0 to 3) of std_logic_vector(7 downto 0); constant rom_contents : rom_table := rom_table'(" ", " ", " ", " "); begin -- rtl dout <= rom_contents(conv_integer(address)); end rtl; Najeem Lawal, 2012

EXAMPLE #1: RAM IN VHDL 10 VHDL ET062G & ET063G Lecture 4 Define existing RAM module existing in a library architecture rtl of rmodul is component RAM4_8 port ( din: in std_logic_vector(7 downto 0), address0, address1, we : in std_logic; dout : out std_logic_vector(7 downto 0); end component; begin -- rtl ram1: RAM4_8 port map ( din => d, address0 => a0, address1 => a1, we => we, dout => q); end rtl; dindout address0 address1 we RAM4_8 din a0 a1 we q Najeem Lawal, 2012

EXAMPLE #2: RAM IN VHDL 11 VHDL ET062G & ET063G Lecture 4 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity ram32_16 is port ( addr : in std_logic_vector(4 downto 0); clk, we_n : in std_logic; din : in std_logic_vector(15 downto 0); dout : out std_logic_vector(15 downto 0)); end ram32_16; din dout addr we_n RAM32_16 Najeem Lawal, 2012

EXAMPLE #2: RAM IN VHDL 12 VHDL ET062G & ET063G Lecture 4 Define an matrix Najeem Lawal, 2012 architecture rtl of ram32_16 is type ram_type is array (31 downto 0) of std_logic_vector(15 downto 0); signal ram_array : ram_type; begin process(clk) begin if clk'event and clk='1' then if we_n='0' then ram_array(conv_integer(addr)) <= din; end if; end process; dout <= ram_array(conv_integer(addr)); end rtl;

GENERATE COMMAND IN VHDL 13 VHDL ET062G & ET063G Lecture 4 If the same component is to be instantiated many time in the same architecture, the generate command is the most effective approach Syntax: : FOR Generate : port map ( ); End generate ; Najeem Lawal, 2012

GENERATE COMMAND IN VHDL 14 VHDL ET062G & ET063G Lecture 4 Entity adder_4bit is Port (a, b : in std_logic_vector(3 donwto 0); cin : in std_logic; sum : out std_logic_vector(3 downto 0); cout : out std_logic); End entity adder_4bit; Najeem Lawal, 2012 USING GENERATE TO CREATE A 4-BIT ADDER FROM 1-BIT ADDER

GENERATE COMMAND IN VHDL 15 VHDL ET062G & ET063G Lecture 4 Architecture rtl of Adder_4bit is component adder_1bit port(a,b,cin : in std_logic; sum, cout : out std_logic); end component; Signal c_chain : std_logic_vector(4 downto 0); Begin c_chain(0) <= cin; cout <= c_chain(4); gen : for i in 0 to 3 generate u : adder_1bit port map (a(i), b(i), c_chain(i), sum(i), c_chain(i+1)); End architecture rtl; Najeem Lawal, 2012

GENERATE COMMAND IN VHDL 16 VHDL ET062G & ET063G Lecture Begin c_chain(0) <= cin; cout <= c_chain(4); gen : for i in 0 to 3 generate u : adder_1bit port map ( a <=a(i), b <=b(i), cin <= c_chain(i), sum <= sum(i), cout <= c_chain(i+1)); End architecture rtl; Najeem Lawal, 2012

GENERIC COMMAND 17 VHDL ET062G & ET063G Lecture 4 GENERICS The generic statement declares constants that are analogous to arguments in functions in procedural programming. These constants are set in the module that is hierarchically above the current one. If they are not set, they take the default value that you give it. Generic declarations are optional and their mapping. Najeem Lawal, 2012

GENERIC COMMAND 18 VHDL ET062G & ET063G Lecture 4 GENERICS Are used for –Timing: delays –Sizing: bus width –Limits: counter range SYNTAX: : TYPE [:= ];TYPE EXAMPLES: BUS_WIDTH: INTEGER := 8; MY_BOOLEAN: BOOLEAN := FALSE; DELAY: TIME :=5NS Najeem Lawal, 2012

GENERIC & GENERATE COMMAND 19 VHDL ET062G & ET063G Lecture 4 HOW CAN WE CREATE A 64-BIT ADDER OR 128-BIT OR N-BIT ADDER? WHERE N > 0. HINTS: GENERICS AND GENERATE Najeem Lawal, 2012

GENERIC & GENERATE COMMAND 20 VHDL ET062G & ET063G Lecture 4 Entity adder_Nbit is Generic (N : integer := 100); Port (a, b : in std_logic_vector(N - 1 donwto 0); cin : in std_logic; sum : out std_logic_vector(N - 1 downto 0); cout : out std_logic); End entity adder_Nbit; Architecture rtl of Adder_Nbit is component adder_1bit port(a,b,cin : in std_logic; sum, cout : out std_logic); end component; Signal c_chain : std_logic_vector(4 downto 0); Najeem Lawal, 2012

GENERIC & GENERATE COMMAND 21 VHDL ET062G & ET063G Lecture Begin c_chain(0) <= cin; cout <= c_chain(N); gen : for i in 0 to (N – 1) generate u : adder_1bit port map ( a <=a(i), b <=b(i), cin <= c_chain(i), sum <= sum(i), cout <= c_chain(i+1)); End architecture rtl; By combining generic and generate, it is possible to achieve a compact and variable number of construction. Here is an example of 100 bit adder. Najeem Lawal, 2012

ERROR MANAGEMENT IN VHDL 22 VHDL ET062G & ET063G Lecture 4 Assert statement Used to test constraint during simulation functional constraint time constraint If the condition is satisfied i.e. confirmed or asserted simulation continues If condition (functional or time) is not satisfied - print a report - specify the severity of the condition Najeem Lawal, 2012

ERROR MANAGEMENT IN VHDL 23 VHDL ET062G & ET063G Lecture 4 Assert statement Syntax: Assert Report Severity ; Message and Error Level are displayed in the simulator console as text. Assert statements can be both sequential and concurrent statements. Assert statements should only be in the test-benches because there are not synthesizable. Najeem Lawal, 2012

ERROR MANAGEMENT IN VHDL 24 VHDL ET062G & ET063G Lecture 4 Assert assert in /= '0' assert in1 /= '0' AND in2 = '1' assert now = 200 ns Report report “Values of input in1 and in2 are invalid!” report “Simulation completed” report “Output x is out of range” Najeem Lawal, 2012

ERROR MANAGEMENT IN VHDL 25 VHDL ET062G & ET063G Lecture 4 Severity severity Note Warning Error Failure Najeem Lawal, 2012

ERROR MANAGEMENT IN VHDL 26 VHDL ET062G & ET063G Lecture 4 Entity assert_ex is port ( a,b : in std_logic; q : out std_logic); end entity assert_ex; architecture ex of assert_ex is Najeem Lawal, 2012 architecture ex of assert_ex is begin assert a /= '1' or b /= '1' report “a='1' and b='1' at the same time!” severity Warning; P1 : process(a,b)‏ begin if a ='1' and b = '1' then assert false report “a='1' and b='1'”; end if end process P1; end architecture ex;

LINE BUFFERS 27 VHDL ET062G & ET063G Lecture 4 –Memories used to buffer a set of repitive data –Implemented as a read first then write block RAM –A First-In-First-Out shift register (FIFO) that can be implemented as a circular buffer –An example of a modulo-8 data set memory buffer Najeem Lawal, 2012

LINE BUFFERS 28 VHDL ET062G & ET063G Lecture 4 entity linebuffer is generic ( ADDR_WIDTH: integer := 10; DATA_WIDTH: integer := 8; WINDOW_SIZE: integer := 3; ROW_BITS : integer := 9; COL_BITS : integer := 10; NO_OF_ROWS: integer := 480; NO_OF_COLS: integer := 752 ); port( clk : in std_logic; fsynch_in : in std_logic; rsynch_in: in std_logic; pdata_in : in std_logic_vector(DATA_WIDTH-1 downto 0); fsynch_out : out std_logic; rsynch_out : out std_logic; pdata_out1 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out2 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out3 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out4 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out5 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out6 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out7 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out8 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out9 : out std_logic_vector(DATA_WIDTH -1 downto 0) ); end linebuffer; Najeem Lawal, 2012

LINE BUFFERS 29 VHDL ET062G & ET063G Lecture 4 entity linebuffer is generic ( ADDR_WIDTH: integer := 10; DATA_WIDTH: integer := 8; WINDOW_SIZE: integer := 3; ROW_BITS : integer := 9; COL_BITS : integer := 10; NO_OF_ROWS: integer := 480; NO_OF_COLS: integer := 752 ); port( ); end linebuffer; Najeem Lawal, 2012

LINE BUFFERS 30 VHDL ET062G & ET063G Lecture 4 entity linebuffer is generic ( ); port( clk : in std_logic; fsynch_in : in std_logic; rsynch_in: in std_logic; pdata_in : in std_logic_vector(DATA_WIDTH-1 downto 0); fsynch_out : out std_logic; rsynch_out : out std_logic; pdata_out1 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out2 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out3 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out4 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out5 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out6 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out7 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out8 : out std_logic_vector(DATA_WIDTH -1 downto 0); pdata_out9 : out std_logic_vector(DATA_WIDTH -1 downto 0) ); end linebuffer; Najeem Lawal, 2012

QUESTIONS Najeem Lawal, VHDL ET062G & ET063G Lecture 4 ABOUT FPGA / VHDL ABOUT VGA DISPLAY / TIMING ABOUT IMAGE SENSOR TIMING ABOUT RANGE SENSOR ABOUT LINE BUFFERS ABOUT MEMORIES & COUNTERS

END OF LECTURE 4 Najeem Lawal, VHDL ET062G & ET063G Lecture 4 OUTLINE –Counters –Shift registers –Memories –Generate –Generics –Error management –Line Buffers