Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.

Slides:



Advertisements
Similar presentations
Combinational Logic.
Advertisements

Lecture 6 Chap 8: Sequential VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
History TTL-logic PAL (Programmable Array Logic)
ECE C03 Lecture 18ECE C03 Lecture 61 Lecture 18 VHDL Modeling of Sequential Machines Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
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.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
Latches and Flip-Flops Discussion D4.1 Appendix J.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ELEN 468 Advanced Logic Design
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
1 Lecture 11 Chap 13: Test Benches Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Introduction to Counter in VHDL
Introduction to VHDL (part 2)
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Acknowledgements: LRS - UNI Erlangen-Nuremberg
Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University Computer Aided Circuit Design.
Finite State Machines. Binary encoded state machines –The number of flip-flops is the smallest number m such that 2 m  n, where n is the number of states.
Graduate Computer Architecture I VHDL Structure and Testing Michael Sorensen.
ENG241 Digital Design Week #6 Sequential Circuits (Part A)
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ELEC / Computer Architecture and Design Fall 2009 ELEC / Computer Architecture and Design Fall 2009 Modeling for Synthesis.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Copyright © 1997 Altera Corporation & 提供 What is VHDL Very high speed integrated Hardware Description Language (VHDL) –is.
Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Lecture 2 VHDL: Introduction Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
ENG241 Digital Design Week #8 Registers and Counters.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
Lecture 5 Chap 6 Package std_logic_arith Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Modern VLSI Design 4e: Chapter 8 Copyright  2008 Wayne Wolf Topics VHDL register-transfer modeling: –basics using traffic light controller; –synthesis.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
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.
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
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)
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
03/31/031 ECE 551: Digital System Design & Synthesis Lecture Set 8 8.1: Miscellaneous Synthesis (In separate file) 8.2: Sequential Synthesis.
VHDL Programming Fundamentals Presented By Dr. Pradyut Kumar Biswal Department of Electronics, IIIT Bhubaneswar.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
July 2, 2001Systems Architecture I1 Systems Architecture II (CS 282) Lab 3: State Elements, Registers, and Memory * Jeremy R. Johnson Monday July 2, 2001.
Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Registers and Counters
Last Lecture Talked about combinational logic always statements. e.g.,
B e h a v i o r a l to R T L Coding
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
VHDL 5 FINITE STATE MACHINES (FSM)
Sequential-Circuit Building Blocks
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
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
Sequntial-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
(Sequential-Circuit Building Blocks)
EEL4712 Digital Design (Midterm 1 Review).
Presentation transcript:

Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University

Registers registers: a flip-flop or a bank of flip-flops with comon control The register is contained within the process statement. Register: match the template wait until ck’event and ck = ‘1’; Example:

library ieee; use ieee.std_logic_1164.all; entity Dtype is port(d, ck: in std_logic; q: out std_logic); end; architecture behavior of Dtype is begin process begin wait until ck’event and ck=‘1’; q <= d; end process; end;

Registers: simulation model wait statement syntax: wait on sensitivity-list until condition; Thus wait until ck’event and ck=‘1’; =wait on ck until ck’event and ck=‘1’; Operation: A. the wait statement is activated by an event. B. the until condition is tested true: process execution false: wait statement is deactivated. (process remain suspended)

Registers: redundancy? The following example: wait until ck’event and ck=‘1’; =wait on ck until ck’event and ck=‘1’; the process will be executed once when ck =‘1’ and ck has a transition = (the rising edge on ck ) Redundancy: wait on ck until ck’event and ck=‘1’; “ck’event” and “ on ck” (ck is in the sensitivity list) means the same thing. However, synthesis tools need to match this pattern (register template) to recognize a register process.

Registers: synthesis model Hardware implementation: an edge-triggered register register process = a block of combinational logic(CL) + registers on every output of the CL All signal assignments in a registered process result in in registers on those target signals. Note that a latched process can have both latched and combinational outputs.

Registers register process: process begin wait until ck’event and ck=‘1’; z <= a and b; end process; -- compare to this process begin wait on a, b; z <= a and b; end process;

Register Templates: basic Basic Template: A: implicit on clause process begin wait until ck’event and ck=‘1’; q <= d; end process; B. explicit on clause: wait on ck until ck’event and ck=‘1’;

Register Templates: short Short Template: (the most compact form of registered process) process begin wait until ck=‘1’; q <= d; end process; Note that the least likely to be recognized by all synthesisers. Explicit on clause: wait on ck until ck=‘1’;

Register Templates: if statement if statement Template: process begin wait on ck if ck’event and ck=‘1’ then q <= d; end if; end process; ck’event may be removed. if ck=‘1’ then … asynchronous reset (see section 9.8).

Register Templates: sensitivity list sensitivity list Template: process (ck) begin if ck’event and ck=‘1’ then q <= d; end if; end process; ck’event may be removed. if ck=‘1’ then … wait on ck;

Register: active edge falling-edge sensitivity register: process begin wait until ck=‘0’; q <= d; end process; testing the rising or falling edge: rising edge: 0 --> 1 but how about x --> 1? Rising-edge trigger process: wait until ck’event and ck=‘1’ and ck’last_value=‘0’; Check synthesiser documentation.

Register: active edge All signals are initialized with the leftmost value of the type. Signal ck: std_logic; The leftmost value of std_logic is ‘U’. This may cause false triggering of registers Preventing false triggering by initialization: Signal ck: std_logic:=‘0’; Signal ck: std_logic:=‘1’; Note that std_logic_1164 defines two functions wait on rising_edge(ck); wait on falling_edge(ck); Not all tool support these functions.

Registers of other types signal being registered can be: A. 1-bit signal B. integer (Ex. Counter) C. enumeration (Ex. State machines) D. array type (Ex. Buses) E. record type (Ex buses split into fields.) Example:

library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all; entity Dtype is port(d: in signed(7 downto 0); ck: in std_logic; q: out signed(7 downto 0)); end; architecture behavior of Dtype is begin process begin wait on ck until ck=‘1’; q <= d;-- 8-bit register end process; end;

Registers of other types any number of signals can be registered in the same registered process. Example: process begin wait on ck until ck=‘1’; q0 <= d0; q1 <= d1; q2 <= d2; end process;

Clock types So far all the examples have used a clock which is of type std_logic. Other logic types are OK for clock signal: A. bit B. boolean

Gated Registers So far all the registers have been ungated. In practice, it is very rare for a register to be ungated. A. clock gating -- in general not OK, rare B. data gating

Clock Gating In clock gating the clock signal is switched on or off by some other control signals. -- save power Clock gating is sometimes used in hand-crafted design. It is rarely used and considered bad practice to use clock gating in synthesisable design. Two reasons: A. Testing: (synchronous design) scan paths with built-in test patten generation to give a complete test. Scan techniques require directly control the clocks. B. Glitches: logic synthesis for logic minimization can not guarantee glitch-free logic. Glitches in the control signals would be disastrous.

Glitches (Hazards) Static hazards: Dynamic hazards O 1 O 11 O Static 0 hazard Static 1 hazard

Glitches (Hazards)

Clock gating Clock gating is often used in low-power circuits. Clock gating is used to effectively disable a register or a register bank. If clock gating is used, User has to check that synthesized clock circuits are safe. Example:

library ieee; use ieee.std_logic_1164.all; entity GDtype is port(d, en, ck: in std_logic; q: out std_logic); end; architecture behavior of GDtype is signal cken: std_logic; begin cken <= ck when en = ‘1’ else ‘1’; -- clock gating process begin wait until cken’event and cken=‘1’; q <= d; end process; end;

Data gating Data gating controls the data input of the register. Hardware implementation: multiplexer Example:

library ieee; use ieee.std_logic_1164.all; entity DGDtype is port(d, en, ck: in std_logic; q: out std_logic); end; architecture behavior of DGDtype is begin process begin wait until ck’event and ck=‘1’; if en = ‘1’ then -- data q <= d; -- gating end if; end process; end;

Data gating common pitfall: don’t combine if statements if ck’event and ck=‘1’ then; if en = ‘1’ then -- data gating q <= d; end if; Not OK: (register template ??) if ck’event and ck=‘1’ and en = ‘1’ then q <= d; endif ;

Resettable Registers Register reset: Asynchronous and synchronous Asynchronous resets: A. override the clock and act immediately to change the value of the register. B. global system-level resets enforced from off-chip C. sensitive to glitches (asynchronous reset controls are in effect always.) Synchronous resets: A. take effect on the active edge of the clock B. insensitive to glitches

Asynchronous Reset Asynchronous resets require special register template Many different ways to write models that act like asynchronous resets during simulation Only those that conform to the templates will be synthesisable. The templates vary from synthesizer to synthesizer. Example

Asynchronous Reset An asynchronous reset example: process(ck,rst) begin if rst = ‘1’ then q <=0; elsif ck’event and ck=‘1’ then; q <= d; end if; end;

Asynchronous Reset Some synthesizer requires attributed entity to declare an asynchronous reset example: library ieee; use ieee.std_logic_1164.all; library synthesis; use synthesis.attributes.all; entity RDtype is port(d, rst, ck: in std_logic; q: out std_logic); attribute signal_kind of ck: signal is clock; attribute signal_kind of rst: signal is set_reset; end;

Asynchronous Reset Reset value can be any constant value. process(ck,rst) begin if rst = ‘1’ then q <= to_unsigned(10, q’length); elsif ck’event and ck=‘1’ then; q <= d; end if; end;

Asynchronous Set and Reset Asynchronous set and reset controls may not be synthesisable. process(ck,rst, set) begin if rst = ‘1’ then q <= ‘0’; elsif set = ‘1’ then q <= ‘1’; else ck’event and ck=‘1’ then; q <= d; end if; end;

Resettable Counter module-16 counter signal ck, rst: std_logic; signal q: unsigned( 3 downto 0); …. process(ck,rst) begin if rst = ‘1’ then count <= to_unsigned(0, count’length); elsif ck’event and ck=‘1’ then; count <= count +1; end if; end;

Synchronous Reset signal d, ck, rst: std_logic; signal q: std_logic; …. process begin wait until ck’event and ck=‘1’; if rst = ‘1’ then q <= 0; else; q <= d; end if; end;

signal d: unsigned(2 downto 0); signal ck, rst: in std_logic; signal q: out unsigned(2 downto 0); …. process begin wait until ck’event and ck=‘1’; if rst = ‘1’ then q <= to_unsigned(5, q’length); else; q <= d; end if; end;

Synchronous Resettable Counter signal ck, rst: std_logic; signal q: unsigned(3 downto 0); …. process (ck) begin if ck’event and ck=‘1’ then; if rst = ‘1’ then count <= to_unsigned(0, count’length); else count <= count+1; endif end if; end;

Simulation model of Asynchronous Reset Asynchronous reset behavior is more complex. process (ck, rst) begin if rst=‘1’ then; q <= ‘0’; elsif ck’event and ck=‘1’ then q <= d; end if; end; two signals, ck (the clock signal) and rst (asynchronous reset signal) are in the sensitivity list.

Simulation model of Asynchronous Reset if rst goes high, q will be reset to zero. If ck goes high, q will be set to d. If both rst and ck go high then reset signal overrides the clock signal Note that asynchronous reset acts as a level sensitive control signal. The reset is activated immediately and is not synchronized with the clock. VHDL synthesizers recognize an asynchronous reset by matching an asynchronous reset template.

Asynchronous Reset Templates Asynchronous reset templates: A. sensitivity-list template process (ck, rst) begin if rst=‘1’ then; q <= ‘0’; elsif ck’event and ck=‘1’ then q <= d; end if; end;

Asynchronous Reset Templates Asynchronous reset templates: B. if-statement template process begin wait on ck, rst; if rst=‘1’ then; q <= ‘0’; elsif ck’event and ck=‘1’ then q <= d; end if; end;

Registered Variables process variable count : unsigned(7 downto 0); begin wait until ck’event and ck=‘1’; if rst = ‘1’ then count := to_unsigned(0, count’length); else count := count+1; end if; result <= count; -- two registers are created end;