Copyright © 1997 Altera Corporation download from: www.pld.com.cn 2014-6-3 P.1 One Hot State Machine vs Binary/Gray Code State Machine Danny Mok Altera.

Slides:



Advertisements
Similar presentations
MC542 Organização de Computadores Teoria e Prática
Advertisements

HDL Programming Fundamentals
HDL Programming Fundamentals
UNIT 8: Synthesis Basics
arquitectura – implementação
Flip-Flop J-K.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 3.1 Chapter 3.
Basic Finite State Machines 1. 2 Finite State Machines Binary encoded state machines –The number of flip-flops is the smallest number m such that 2 m.
3-13 Alternate Logic-Gate Representations
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
10/1/2014 Memory and I/O subsystem Reference: Introduction to Digital System by Ercegovac, Lang & Moreno, Wiley Publisher.
© 2003 Xilinx, Inc. All Rights Reserved Course Wrap Up DSP Design Flow.
Binary Lesson 3 Hexadecimal. Counting to 15 Base Base Base 16 Base Base Base 16 Two Ten (Hex) Two Ten (Hex)
ASIC 121: Practical VHDL Digital Design for FPGAs Tutorial 2 October 4, 2006.
Adders and Subtractors
Bottoms Up Factoring. Start with the X-box 3-9 Product Sum
©2004 Brooks/Cole FIGURES FOR CHAPTER 20 VHDL FOR DIGITAL SYSTEM DESIGN Click the mouse to move to the next page. Use the ESC key to exit this chapter.
ENGG1100 Ch7: Introduction To Engineering Design (Digital Logic)
陳慶瀚 機器智慧與自動化技術 (MIAT) 實驗室 國立中央大學資工系 2009 年 10 月 15 日 ESD-05 Grafcet-to-VHDL 硬體合成 Grafcet-to-VHDL Hardware Synthesis.
VHDL in digital circuit synthesis (tutorial) dr inż. Miron Kłosowski EA 309
General Sequential Design
Sequential Circuits Storage elements
Introduction To VHDL for Combinational Logic
Lecture #28 Page 1 ECE 4110– Sequential Logic Design Lecture #28 Agenda 1.Counters Announcements 1.HW #13 assigned 2.Next: Test #2 Review.
Digital Logic with VHDL EE 230 Digital Systems Fall 2006 (10/17/2006)
LECTURE 4: The VHDL N-bit Adder
1 Design a state machine to display a character of string HELLO using a seven segment display How many state we need? –Five, one for each character –In.
L18 – VHDL for other counters and controllers. Other counters  More examples Gray Code counter Controlled counters  Up down counter  Ref: text Unit.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
6/12/20151 Sequence Detectors Lecture Notes – Lab 4 Sequence detection is the act of recognizing a predefined series of inputs A sequence detector is a.
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Dr. H.v.d.Biggelaar / Mar3-Ver2 / 1 Engineering Technology Dr. H.v.d.Biggelaar March 22, 2000 State Machines in VHDL.
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.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Advanced Digital Circuits ECET 146 Week 7 Professor Iskandar Hack ET 221B,
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Danny Mok Altera HK FAE Tri-State vs MUX Danny Mok Altera HK FAE 4/23/2017 P.1.
Copyright © 1997 Altera Corporation 9/12/97 Mix Design Entry within Max+Plus II Danny Mok Altera HK FAE
Copyright © 1997 Altera Corporation 9/12/97 Asynchronous vs Synchronous Circuit Design Danny Mok Altera HK FAE
L16 – Testbenches for state machines. VHDL Language Elements  More examples HDL coding of class examples Testbench for example  Testing of examples.
Copyright © 1997 Altera Corporation 10/15/2015 How to use LPM within VHDL Entry Danny Mok Altera HK FAE
12004 MAPLDSynthesis Issues Synthesis Issues Demonstrated with a Simple Finite State Machine Using Gray Codes.
Copyright © 1997 Altera Corporation 10/21/2015 Third Party EDA Tools Interface with Altera Max+Plus II Danny Mok Altera HK FAE
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
ENG2410 Digital Design LAB #6 LAB #6 Sequential Logic Design (Flip Flops)
Copyright © 1997 Altera Corporation & 提供 What is VHDL Very high speed integrated Hardware Description Language (VHDL) –is.
Copyright © 1997 Altera Corporation 6/5/2016 P.1 AHDL Training Class Danny Mok Altera HK FAE
Advanced Digital Circuits ECET 146 Week 6 Professor Iskandar Hack ET 221G, Me as I typed this slides.
BR 1/991 Dice Game Implementation Why was dice game implemented in three 22V10 PLDs? What are the resources needed by the Dice Game? –Outputs: 6 for dice.
Copyright © 1997 Altera Corporation 11/20/2015 P.1 Beginner VHDL Training Class Danny Mok Altera HK FAE
Copyright © 1997 Altera Corporation 11/21/2015 P.1 Compilation is too Long Danny Mok Altera HK FAE
Copyright © 1997 Altera Corporation & 提供 Beginner VHDL Training Class Danny Mok Altera HK FAE
Hardware languages "Programming"-language for modelling of (digital) hardware 1 Two main languages: VHDL (Very High Speed Integrated Circuit Hardware Description.
 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.
COE4OI5 Engineering Design Chapter 1: The 15 minutes design.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Unit 4 Structural Descriptions SYLLABUS Highlights of Structural descriptions Organization of the Structural descriptions Binding State Machines Generate(HDL),Generic(VHDL),
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
Sequential statements (1) process
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Part II A workshop by Dr. Junaid Ahmed Zubairi
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Part IV: VHDL CODING.
Using CAD Tools to implement Digital Circuits
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
System Controller Approach
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Presentation transcript:

Copyright © 1997 Altera Corporation download from: P.1 One Hot State Machine vs Binary/Gray Code State Machine Danny Mok Altera HK FAE

Copyright © 1997 Altera Corporation download from: P.2 One Hot State Machine What is One Hot –each state within the State Machine is represent by ONE BIT e.g. Four State Machine : state0, state1, state2, state3 can be represented by –4 bits : (One Hot) One Hot State Machine –mainly gives us performance –but it consume more logic

Copyright © 1997 Altera Corporation download from: P.3 Binary State Machine What is Binary State Machine –each state within the State Machine is encode by bits e.g. Four State Machine : state0, state1, state2, state3 can be represented by –2 bits : (Binary) Binary State Machine –mainly consume less logic –but the performance usually is slower –can be more than one bit change from state to state (01 -> 10) both bits changed

Copyright © 1997 Altera Corporation download from: P.4 Gray Code State Machine What is Grey Code State Machine –each state within the State Machine is encode by bits e.g. Four State Machine : state0, state1, state2, state3 can be represented by –2 bits : (Grey Code) Gray Code State Machine –mainly consume less logic –but the performance usually is slower –ONLY one bit change from state to state (01 -> 11) one bit changed

Copyright © 1997 Altera Corporation download from: P.5 Default in Max+Plus II In Max+Plus II, the State Machine will be coding as –AHDL/VHDL Input One Hot for FLEX (no option to turn on or off) –because FLEX having a lot of LC(DFF) –so LC is not a problem –most likely is performance problem Binary Encoding for MAX (option to change to One Hot) –because MAX having limited MC (DFF) –so MC is a problem –most likely the performance is not a problem

Copyright © 1997 Altera Corporation download from: P.6 AHDL Design Entry

Copyright © 1997 Altera Corporation download from: P.7 AHDL Example subdesign state_machine ( clk, rst, go : input; q : output;) variable hold_bg:MACHINE OF BITS (hh[1..0]) WITH STATES(h0,h1,h2,h3); begin hold_bg.clk = CLK; hold_bg.reset = RST; hold_bg.ena = VCC; case hold_bg is when h0 => if (go) then hold_bg = h1; else hold_bg = h0; end if; when h1 => hold_bg = h2; when h2 => hold_bg = h3; when h3 => hold_bg = h0; end case; q = (hold_bg == h1); end;

Copyright © 1997 Altera Corporation download from: P.8 MAX 7K/9K - Max+Plus II Default

Copyright © 1997 Altera Corporation download from: P.9 MAX 7K/9K - One Hot Coding

Copyright © 1997 Altera Corporation download from: P.10 FLEX 8K/6K/10K - Max+Plus II Default

Copyright © 1997 Altera Corporation download from: P.11 VHDL Design Entry

Copyright © 1997 Altera Corporation download from: P.12 Altera Max+Plus II VHDL Compiler MAX the State Machine can be –BINARY CODING –ONE HOT FLEX the State Machine always –ONE HOT (no option to select) There is no option to direct Max+Plus II to do One Hot Coding in FLEX under Altera Max+Plus II VHDL Compiler

Copyright © 1997 Altera Corporation download from: P.13 Solution Work around solution –use 3rd compiler to generate EDIF Binary, Gray Code, One Hot or Random –import the EDIF to Max+Plus II –now Max+Plus II doesnt know it is State Machine, then it will do what EDIF is

Copyright © 1997 Altera Corporation download from: P.14 Sample State Machine library ieee; use ieee.std_logic_1164.all; package your_own_type is type t_state is (idle,state0,state01,state011, state0110,state01101, state011011, dummy0, dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7, dummy8, dummy9, dummy10); end your_own_type; library ieee; use ieee.std_logic_1164.all; use work.your_own_type.all; Entity stmh is port (clk, serial_in, reset : in std_logic; match : out std_logic); end stmh; architecture body_stmh of stmh is signal present_state : t_state; begin process(clk,serial_in, present_state) begin if (reset = '1') then present_state <= idle; elsif (clk'event and clk='1') then case present_state is when idle => if (serial_in = '0') then present_state <= state0; else present_state <= idle; end if; when state0 => if (serial_in = '1') then present_state <= state01; else present_state <= idle; end if; when state01 => if (serial_in = '1') then present_state <= state011; else present_state <= idle; end if; when state011 => if (serial_in = '0') then present_state <= state0110; else present_state <= idle; end if; when state0110 => if (serial_in = '1') then present_state <= state01101; else present_state <= idle; end if; when state01101 => if (serial_in = '1') then present_state <= state011011; else present_state <= idle; end if; when state => present_state <= dummy0; when dummy0 => present_state <= dummy1; when dummy1 => present_state <= dummy2; when dummy2 => present_state <= dummy3; when dummy3 => present_state <= dummy4; when dummy4 => present_state <= dummy5; when dummy5 => present_state <= dummy6; when dummy6 => present_state <= dummy7; when dummy7 => present_state <= dummy8; when dummy8 => present_state <= dummy9; when dummy9 => present_state <= dummy10; when dummy10 => present_state <= idle; when others => present_state <= idle; end case; end if; end process; process(present_state) begin if (present_state = state011011) then match <= '1'; else match <= '0'; end if; end process; end body_stmh;

Copyright © 1997 Altera Corporation download from: P.15 Altera Max+Plus II VHDL Compiler

Copyright © 1997 Altera Corporation download from: P.16 Force it to One Hot in Max+Plus II

Copyright © 1997 Altera Corporation download from: P.17 For FLEX devices in default

Copyright © 1997 Altera Corporation download from: P.18 Work Around with 3rd VHDL Compiler

Copyright © 1997 Altera Corporation download from: P.19 MAX/FLEX - 3rd Compiler

Copyright © 1997 Altera Corporation download from: P.20 Cont...

Copyright © 1997 Altera Corporation download from: P.21 Cont...

Copyright © 1997 Altera Corporation download from: P.22 Conclusion Select what kind of State Machine encoding –FLEX Device you want Performance : One Hot (Default) you want min LC : Binary/Gray Code (to be Smart) –MAX Device you want min MC : Binary (Default) you want Performance : One Hot (may help) Entry –Altera AHDL/VHDL compiler Binary for MAX (Default, but can changed) One Hot for FLEX (no option to change) –if VHDL : can work around with 3rd VHDL compiler for different kind of coding