Timing in synchronous systems

Similar documents
Sequential Logic - Module 5

Sequential Statement

ECEU530. Homework 4 due Wednesday Oct 25. ECE U530 Digital Hardware Synthesis. VHDL for Synthesis with Xilinx. Schedule

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 6 Combinational and sequential circuits

Lecture 12 VHDL Synthesis

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

[VARIABLE declaration] BEGIN. sequential statements

VHDL in 1h. Martin Schöberl

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

Today. Comments about assignment Max 1/T (skew = 0) Max clock skew? Comments about assignment 3 ASICs and Programmable logic Others courses

Control and Datapath 8

VHDL Examples Mohamed Zaky

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

Summary of FPGA & VHDL

Control Unit: Binary Multiplier. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

CprE 583 Reconfigurable Computing

In our case Dr. Johnson is setting the best practices

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

Field Programmable Gate Array

VHDL And Synthesis Review

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

3 Designing Digital Systems with Algorithmic State Machine Charts

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

VHDL: RTL Synthesis Basics. 1 of 59

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

VHDL for Logic Synthesis

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

CS/EE Homework 7 Solutions

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

Sign here to give permission for your test to be returned in class, where others might see your score:

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Concurrent & Sequential Stmts. (Review)

VHDL for Logic Synthesis

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

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

Contents. Chapter 9 Datapaths Page 1 of 28

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. Behavioral Design Style: Registers & Counters.

Finite State Machines

CprE 583 Reconfigurable Computing

SEQUENTIAL STATEMENTS

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

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

Nanosistemų programavimo kalbos 5 paskaita. Sekvencinių schemų projektavimas

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs

Computer-Aided Digital System Design VHDL

Hardware Description Languages. Modeling Complex Systems

Inferring Storage Elements

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

CDA 4253 FPGA System Design Op7miza7on Techniques. Hao Zheng Comp S ci & Eng Univ of South Florida

8 Register, Multiplexer and

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

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

EITF35: Introduction to Structured VLSI Design

Lab 3. Advanced VHDL

EITF35: Introduction to Structured VLSI Design

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

Modeling Complex Behavior

Digital Design: An Embedded Systems Approach Using VHDL

Problem Set 10 Solutions

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

Hardware Description Language VHDL (1) Introduction

Problem Set 5 Solutions

EEL 4712 Digital Design Test 1 Spring Semester 2007

HDL Design Cube. Synthesis and VHDL

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

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

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

Actel HDL Coding. Style Guide

The University of Alabama in Huntsville Electrical and Computer Engineering CPE/EE 422/522 Spring 2005 Homework #6 Solution

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

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

EITF35: Introduction to Structured VLSI Design

COVER SHEET: Total: Regrade Info: 2 (6 points) 3 (8 points) 4 (10 points) 8 (12 points) 6 (6 points) 7 (6 points) 9 (30 points) 10 (4 points)

The VHDL Hardware Description Language

RTL Design (Using ASM/SM Chart)

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

Mealy and Moore examples

Lattice VHDL Training

EL 310 Hardware Description Languages Midterm

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

Digital Design with SystemVerilog

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

ECE 545 Lecture 11 Addendum

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

Test Benches - Module 8

Actel HDL Coding. Style Guide

Sequential Circuit Design: Principle

ELCT 501: Digital System Design

VHDL for Modeling - Module 10

ECE 545: Lecture 11. Programmable Logic Memories

ECE 545: Lecture 11. Programmable Logic Memories. Recommended reading. Memory Types. Memory Types. Memory Types specific to Xilinx FPGAs

Transcription:

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 in VHL Building blocks: counters, registers, RAM/ROM FSM FSM and ata path Copyright Bengt Oelmann 2002 1 Timing in synchronous systems General model for a synchronous system Q1 2 Q2 Combinational logic t C-Q and t SETUP are delays in the flip-flop t C-Q t SETUP C t LOGIK C On clock cycle is the sum of the delays: T = tc Q + tlogik + tsetup + tmarginal Q1 2 t C-Q t LOGIK t SETUP With no timing margin we have obtained the highest possible clock frequency: f max 1 = T min = t C Q + t 1 LOGIK + t SETUP t MARGIN Copyright Bengt Oelmann 2002 2

BO 2 Synchronous processes in VHL Synchronous processes Also called clocked processes All activated simultaneously at the active clock edge Signal assignments in a synchronous process results in flip-flops inputs outputs clock Copyright Bengt Oelmann 2002 3 Example: positive edge-triggered -FF in VHL dff library ieee; use ieee.std_logic_1164.all d q entity dff IS port (d, clk : in std_logic; q : out std_logic); end dff; architecture behavior of dff is process(clk) if (clk event and clk = 1 ) then q <= d; else q <= q; end behavior; clk clk event clk Latches the new value in the FF clk event and clk= 1 Keeps the old value Copyright Bengt Oelmann 2002 4

BO 3 More examples of FF s architecture dataflow of pos_dff is q <= d when (clk event and clk= 1 ) else q; end dataflow; Q architecture dataflow of neg_dff is q <= d when (clk event and clk= 0 ) else q; End dataflow; Q Copyright Bengt Oelmann 2002 5 Example: -latch architecture dataflow of dlatch is q <= d when (clk = 1 ) else q; end dataflow; Q Copyright Bengt Oelmann 2002 6

BO 4 Example: Code that introduces FF s in the design Write a function that stores an 8-bit number in a register if it is greater than 10. If it is less than 10 the register shall contain 10. entity load_ge_10 is port ( clk : in std_logic; d : in std_logic_vector (7 downto 0); q : out std_logic_vector (7 downto 0)); end load_ge_10; architecture rtl of load_ge_10 is process (clk) if (clk'event and clk = '1') then if d > 10 then q <= d; else q <= conv_std_logic_vector(10,8); end rtl; d 10 10 2:1 MUX Signal assignment leads to introduction of FF s 0 1 d>10 clk q Copyright Bengt Oelmann 2002 7 Initialization of FF s At system start the FF s needs to be initialized Two types of initializations Synchronous reset/preset Asynchronous reset/preset Example: synchronous reset if (clk event and clk = 1 ) then if reset = 1 then q <= 0 ; else q <= d; reset Q Copyright Bengt Oelmann 2002 8

BO 5 Cont. Initialization of FF s Exempel: Asynkron reset process (clk, reset) if reset = 1 then q <= 0 ; elsif (clk event and clk = 1 ) then q <= d; reset Q Exempel: Asynkron preset process (clk, preset) if preset = 1 then q <= 1 ; elsif (clk event and clk = 1 ) then q <= d; preset Q Copyright Bengt Oelmann 2002 9 esign of state machines Manual design work flow: evelop a state graph that captures the problem evelop a state graph that captures the problem evelop a state graph evelop a state graph Coding of states Coding of states Select register elements (-,T-,JK-?) Select register elements (-,T-,JK-?) evelop a transition table evelop a transition table evelop boolean functions for λ and δ evelop boolean functions for λ and δ esign circuitry at gate level esign circuitry at gate level Copyright Bengt Oelmann 2002 10

BO 6 esign of state machines Automatic synthesis evelop a state diagram for the problem evelop a state diagram for the problem Write VHL-code that captures the problem Write VHL-code that captures the problem Automatic Automatic synthesis synthesis will will perform perform coding coding of of state state graph graph and and generate generate a a gate gate level level netlist netlist Copyright Bengt Oelmann 2002 11 Example of state machine in VHL architecture rtl of fsm_simple is type state_type is (start, r1, r2); signal state : state_type; -- rtl update_state : process (clk, reset) -- process fsm if reset = '0' then state <= start; elsif clk'event and clk = '1' then case state is when start => if A = '0' then state <= start; else state <= r1; when r1 => if A = '0' then state <= r1; else state <= r2; when r2 => if A = '0' then state <= r2; else state <= start; end case; end process update_state; A=0 output_logic : process(state) case state is when start => z <= '0'; when r1 => z <= '1'; when r2 => z <= '0'; end case; end process output_logic; end rtl; A=0 start z=0 r2 z=0 A=1 r1 z=1 A=1 A=0 A=0 Copyright Bengt Oelmann 2002 12

BO 7 Mealy type in VHL ain=0/yout=0 architecture mealy of fsm2 is ain=1/yout=0 type state is (S1, S2, S3, S4); S1 S4 signal present_state, next_state: state; process (ain, present_state) ain=-/ ain=0/ CASE present_state IS yout=1 yout=1 ain=1/yout=1 when s1 => if (ain = 1 ) then yout <= 0 ; next_state <= s4; else yout <= 1 ; next_state <= s3; S3 S2 ain=-/yout=1 when s2 => yout <= 1 ; next_state <= s3; when s3 => yout <= 1 ; next_state <= s1; when s4 => if (ain = 1 ) then yout <= 1 ; next_state <= s2; else yout <= 0 ; next_state <= s1; end case; process wail until clk = 1 ; present_state <= next_state; end mealy; ain present_state yout next_state Copyright Bengt Oelmann 2002 13 Moore type in VHL library ieee; use ieee.std_logic_1164.all; entity fsm1 is port (ain, clk: in std_logic; yout: out std_logic); end fsm1; architecture moore of fsm1 is type state is (s1, s2, s3, s4); signal present_state, next_state: state; process (ain, present_state) case present_state is when s1 => yout <= 0 ; if (ain = 1 ) then next_state <= s1 else next_state <= s2; when s2 => yout <= 0 ; next_state <= s3; when s3 => yout <= 1 ; next_state <= s4; when s4 => yout <= 1 ; next_state <= s1; end case; process wait until clk = 1 ; present_state <= next_state; end moore; ain=1 ain=0 S1 yout=0 ain=0 S4 yout=1 ain=0 S2 yout=0 ain=0 S3 yout=1 Copyright Bengt Oelmann 2002 14

BO 8 Counters in VHL Modulo-8 counter library ieee; use ieee.std_logic_1164.all; use work.numeric_std.all; entity modulo8 IS PORT(clk: in std_logic; cnt: buffer unsigned (7 downto 0)); EN count8; architecture rtl of count8 is process (clk) if rising_edge(clk) then cnt <= cnt +1; end if end rtl; Copyright Bengt Oelmann 2002 15 Shift-register in VHL entity shift_r is port ( clk, resetn, d_in, shift_en : in std_logic; shift_out : out std_logic_vector(3 downto 0)); end shift_r; architecture rtl of shift_r is signal shift_reg: std_logic_vector(3 downto 0); process (clk, resetn) if resetn = '0' then shift_reg <= (others=>'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; d_in shift_out shift_en resetn Alternative ways shift_out <= shift_reg; end rtl; Copyright Bengt Oelmann 2002 16

BO 9 Memories in VHL A RAM or ROM can be designed in two ways Use the datatype array Use a pre-defined macro cell for the memory device Copyright Bengt Oelmann 2002 17 Example: 4 8 ROM in VHL 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'("00101111", "11010000", "01101010", "11101101"); -- rtl dout <= rom_contents(conv_integer(address)); end rtl; Copyright Bengt Oelmann 2002 18

BO 10 Example #1: RAM in VHL 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; efine existing RAM module existing in a library -- rtl ram1: RAM4_8 port map ( din => d, address0 => a0, address1 => a1, we => we, dout => q) end rtl; din a0 a1 we RAM4_8 din dout address0 address1 we q Copyright Bengt Oelmann 2002 19 Example #2: RAM in VHL 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; 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; process(clk) if clk'event and clk='1' then if we_n='0' then ram_array(conv_integer(addr)) <= din; efine an matrix RAM32_16 din dout addr we_n dout <= ram_array(conv_integer(addr)); end rtl; Copyright Bengt Oelmann 2002 20

BO 11 FSM and datapath Contents General design modell esign example Copyright Bengt Oelmann 2002 21 Components in an digital design A digital design consists of At least one control unit (FSM) At least one datapath unit For example, adder, multiplier, comparator Register for temporary storage of variables Often a design consists of many controllers and datapaths esign modell: FSM with datapath escribes the function of the designs containing both control unit and datapath Copyright Bengt Oelmann 2002 22

BO 12 FSM with datapath Control inputs Control signals ata inputs Control unit atapath control outputs Status signals ata outputs control inputs ata inputs FSM control outputs ata outputs Copyright Bengt Oelmann 2002 23 esign example esign a function computing: y = a x + b Type escription #bits in, data values, positive integer, for a, x and b in sequence 8 start in, control Activate computation of Y, aktive high 1 busy out, control indicate that unit is busy computing 1 Y out, data The computed value Y 17 reset in, control Initialize the unit 1 clk start a = 5 x = 3 b = 10 busy Y Y=25 Copyright Bengt Oelmann 2002 24

BO 13 Cont. esign example start reset clk Y = a x + b Y busy External control signals Controlling the unit External data signals reset start internal control signals Control unit storea storepr atapath External control signal busy Y Copyright Bengt Oelmann 2002 25 Cont. esign example Start=0 start busy = 0 storea = 0 storepr = 0 storea clk EN geta Start=1 busy = 1 storea = 1 storepr = 0 A X multax busy = 1 storea = 0 storepr = 1 storepr clk EN B addb busy = 1 storea = 0 storepr = 0 A X + Y A X+B Copyright Bengt Oelmann 2002 26

BO 14 Summary All digital designs follow the modell of FSM esign flow Specify the algorithm to be implemented Identify Which components are needed in the datapath Which states are needed in the control unit Which control signals are needed to the datapath Which status signals are needed to the control unit evelop State Transition Graph for the control unit Block diagram for the data path Copyright Bengt Oelmann 2002 27