IN2305-II Embedded Programming Lecture 2: Digital Logic.

Slides:



Advertisements
Similar presentations
Tutorial 2 Sequential Logic. Registers A register is basically a D Flip-Flop A D Flip Flop has 3 basic ports. D, Q, and Clock.
Advertisements

VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Lecture #24 Page 1 EE 367 – Logic Design Lecture #24 Agenda 1.State Machines Review Announcements 1.n/a.
Sequential Circuits Storage elements
Introduction To VHDL for Combinational Logic
VHDL Structural Architecture ENG241 Week #5 1. Fall 2012ENG241/Digital Design2 VHDL Design Styles Components and interconnects structural VHDL Design.
Digital Logic Design Brief introduction to Sequential Circuits and Latches.
CSE 378 Computer Hardware Design Prof. Richard E. Haskell – –Tel: –Web site: Follow.
Nonlinear & Neural Networks LAB. CHAPTER 20 VHDL FOR DIGITAL SYSYEM DESIGN 20.1VHDL Code for a Serial Adder 20.2VHDL Code for a Binary Multiplier 20.3VHDL.
ECE 301 – Digital Electronics Circuit Design and Analysis (Lecture #9A) The slides included herein were taken from the materials accompanying Fundamentals.
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.
Latches Section 4-2 Mano & Kime. Sequential Logic Combinational Logic –Output depends only on current input Sequential Logic –Output depends not only.
CS 140 Lecture 6: Other Types of Gates Professor CK Cheng 1.
CSCE 211: Digital Logic Design
Lecture 1: Introduction to Digital Logic Design CK Cheng Thursday 9/26/02.
Latches Lecture L8.1 Section 7.1 – Book Sect. 8.1– Handout.
Lecture 1: Introduction to Digital Logic Design CK Cheng Tuesday 4/1/02.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
CSE 378 Computer Hardware Design Prof. Richard E. Haskell – –Tel: –Web site: Follow.
CS 140 Lecture 7 Professor CK Cheng 10/17/02. Combinational Logic  Complete set of gates  Other types of gates 1)XOR 2)NAND / NOR 3)Block Diagram Transfers.
Synchronous Sequential Circuit Design Digital Clock Design.
Synchronous Sequential Circuit Design
Components used in the the Project J-K Flip Flop Switch Power Alternator 7-Segment Display Coded Decimal (BCD) Display.
Flip_Flops  Logic circuits are classified ito two groups  1. The combinational logic circuits,using the basic gates AND,OR and NOT.  2. Sequential.
Circuit, State Diagram, State Table
E&CE % Final 30% Laboratory 20% Midterm ON LINE Course Notes! Lab Manual LabTechs/TAs Assignments extra probs/solns.
Digital Electronics Lecture 4 Simplification using Boolean Algebra, Combinational Logic Circuit Design.
ECE Advanced Digital Systems Design Lecture 12 – Timing Analysis Capt Michael Tanner Room 2F46A HQ U.S. Air Force Academy I n t e g r i.
Sequential Arithmetic ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
EE3A1 Computer Hardware and Digital Design Lecture 6 supplement Common misunderstandings about VHDL processes.
Unit 13 Analysis of Clocked Sequential Circuits Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
ECE 331 – Digital System Design Circuit Design and Analysis (Lecture #9A) The slides included herein were taken from the materials accompanying Fundamentals.
CEC 220 Digital Circuit Design Timing Analysis of State Machines
CEC 220 Digital Circuit Design Latches and Flip-Flops Monday, March 03 CEC 220 Digital Circuit Design Slide 1 of 19.
Latches and Flip-Flops
A sequential logic circuit (a.k.a. state machine) consists of both combinational logic circuit(s) and memory devices (flip flops). The combinational circuits.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
ECE 301 – Digital Electronics Brief introduction to Sequential Circuits and Latches (Lecture #14)
ECE 331 – Digital System Design Introduction to Sequential Circuits and Latches (Lecture #16)
基 督 再 來 (一). 經文: 1 你們心裡不要憂愁;你們信神,也當信我。 2 在我父的家裡有許多住處;若是沒有,我就早 已告訴你們了。我去原是為你們預備地去 。 3 我 若去為你們預備了地方,就必再來接你們到我那 裡去,我在 那裡,叫你們也在那裡, ] ( 約 14 : 1-3)
Sequential Logic Circuit Design Eng.Maha Alqubali.
TOPIC : Introduction to Sequential Circuits UNIT 1: Modeling and Simulation Module 4 : Modeling Sequential Circuits.
Instructor: Oluwayomi Adamo Digital Systems Design.
DIGITAL LOGIC CIRCUITS 조수경 DIGITAL LOGIC CIRCUITS.
Class Exercise 1B.
Introduction to Advanced Digital Design (14 Marks)
Digital Design Lecture 9
Overview Instruction Codes Computer Registers Computer Instructions
Digital Logic & Design Dr. Waseem Ikram Lecture No. 30.
RTL Design Methodology
Sequential logic circuits
Jeremy R. Johnson Mon. Apr. 3, 2000
Elec 2607 Digital Switching Circuits
CS341 Digital Logic and Computer Organization F2003
Digital Logic & Design Dr. Waseem Ikram Lecture No. 31.
Слайд-дәріс Қарағанды мемлекеттік техникалық университеті
Introduction to Digital Systems Lecturer: 潘欣泰
.. -"""--..J '. / /I/I =---=-- -, _ --, _ = :;:.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture No. 32 Sequential Logic.
II //II // \ Others Q.
I1I1 a 1·1,.,.,,I.,,I · I 1··n I J,-·
Combinational Circuits
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
CMPE212 Discussion 11/21/2014 Patrick Sykes
Logic Gates By: Asst Lec. Besma Nazar Nadhem
. '. '. I;.,, - - "!' - -·-·,Ii '.....,,......, -,
Presentation transcript:

IN2305-II Embedded Programming Lecture 2: Digital Logic

in2305-II: L22 Main Subjects Combinational logic: no memory (state) Sequential logic: state (clocked) VHDL implementation issues How to model / synthesize digital circuits

in2305-II: L23 VHDL in a Nutshell y <= x or c; c <= a and b; z <= y when p else not y when not p; process (s) begin a <= not s; end process; -- a <= not s; concurrent execution model: everything executes in parallel (data flow) behavioral versus structural specification: structural = composition (“wiring”) sequential behavior (state): z latch process (clk) begin y latch if clk = ‘1’ then q <= d; -- d-ff (pos edge-trig) end process; note: within process: sequential execution model

in2305-II: L24 Combinational Logic y <= a and b; a b y a b y ay y <= a or b; y <= not a; Essence of combinatorics: process triggered by the input events (y assignment is synchronous with a and b signal changes)

in2305-II: L25 Example Combinational Blocks with a select -- enc y <= “00” when “0001”, “01” when “0010”, “10” when “0100”, “11” when “1000”; a d y dec 2 4 ay enc 42 with a select -- dec z <= “0001” when “00”, “0010” when “01”, “0100” when “10”, “1000” when “11”; y <= z when d = ‘1’ else “0000”;

in2305-II: L26 Example Combinational Blocks a b y mux with s select -- mux y <= a when ‘0’, b when ‘1’; s a b 8 8 op 8 y with op select -- alu y <= a + b when ‘00’, a and b when ‘01’,...

in2305-II: L27 Sequential Logic process (clk) -- d-ff begin if rising_edge(clk) then q <= d; end if; end process; d Essence of state: assignment is NOT triggered by input events but by an auxiliary signal (usually called a clock) q clk process (d) -- buffer begin q combinational! end process; dff

in2305-II: L28 Comb. + Sequential: FSM process -- fsm begin wait until rising_edge(clk); case s is when 0x”00” => if (x = ‘1’) then s <= 0x”01”; end if; y <= ‘1’; when 0x”01” =>.. end case; end process; s clk dff cmb Mealy FSM: y = f( s, x ) Moore FSM: y = f( s ) xy

in2305-II: L29 Example Sequential Blocks (1) y ram process -- ram begin wait until rising_edge(clk); if (we = ‘1’) then mem(a) <= d; end if; y <= mem(a); end process; clk d a we

in2305-II: L210 Example Sequential Blocks (2) y ctr process -- counter begin wait until rising_edge(clk); if (rst = ‘1’) then c ‘0’); else c <= c + 1; end if; y <= c; end process; clk rst

in2305-II: L211 Tri-state Logic: Busses a y oe_a b oe_b y <= a when oe_a = ‘1’ else ‘Z’; y <= b when oe_b = ‘1’ else ‘Z’; More efficient than mux for n-bit data paths dec

in2305-II: L212 Simple Processor (Delta) r0r1 pc alu.. decrom a rn... data bus

in2305-II: L213 VHDL Implementation Issues Structural synthesis entities reg, tristate-buf, rom, enc, alu, connected by bus each entity behavioral example: Delta-1 source code Behavioral synthesis entities cpu, rom cpu entirely behavioral example: X32 source code pro: simple, understandable code, virtually no HW design con: more burden on synthesizer, less efficient HW (space), potentially larger critical path which may lead to slower freq. Trade-off depends on appl. and available resources

in2305-II: L214 Behavioral Approach process -- delta cpu (behavioral) begin wait until rising_edge(clk);.. case op is when.. => pc <= op(..); -- jp.. when.. => r(a) <= acc; -- st r.. when.. => acc <= acc + op(..); -- add #.. when.. => acc <= acc and r(a); -- and r.. when.. => if (zero = ‘1’) then -- bz.. pc <= op(..); end if; end case; if (-- not jp/bz/bc/..) then pc <= pc + 1; end process;

in2305-II: L215 Button Debouncer V cc GND x:x y: time x’ 10 x 2 t’ t,x t,x’ x x’ 0: output’, timer enable’ 1: output, timer enable 2: output, timer enable’ tmret clk

in2305-II: L216 Debouncer Code (1) process -- fsm (behavioral) begin wait until rising_edge(clk); case s is when “00” => if (x = ‘1’) then s <= ”01”; end if; when ”01” => if (t = ‘1’) then s <= “00” when (x = ‘0’) else “10” when (x = ‘1’); end if; when “10” => if (x = ‘0’) then s <= “00”; end if; end case; output <= ‘0’ when (s = “00”) else ‘1’; timer_enable <= ‘1’ when (s = “01”) else ‘0’; end process;

in2305-II: L217 Debouncer Code (2) process -- timer (behavioral) begin wait until rising_edge(clk); if (timer_enable = ‘0’) then counter ‘0’); t <= ‘0’; else if (counter < THRESHOLD) then counter <= counter + 1; else t <= ‘1’; end if; end process;

in2305-II: L218 Demo using FPGA board FPGAs are a flexible, low-cost “bread-board” to experiment with HW using SW (VHDL) instead of ICs and wires Xilinx Board: Cheap: $99

in2305-II: L219 Demo Demo.. (vhdl_projects.tgz, debouncer)

in2305-II: L220 Autorepeat input: output: time i’ /o/o’ i t1’.i t1.it2.i t2’.i i’ t1t2 t2’.i t2.i /o i’ t2 i’ clk t2

in2305-II: L221 Autorepeat Code process -- fsm, using counter is more simple begin wait until rising_edge(clk); case s is when “00” => if i = ‘1’ then c <=..; s <= ”01”; end if; when ”01” => if i = ‘0’ then s <= “00”; end if; c <= c + 1; if c >.. then c <=..; s <= “10”; end if; when “10” => if i = ‘0’ then s <= “00”; end if; c <= c + 1; if c >.. then c <=..; s <= “11”; end if; when “11” => if i = ‘0’ then s <= “00”; end if; c <= c + 1; if c >.. then c <=..; s <= “10”; end if; end case; output <= ‘1’ when s = “01” and s = “11” else ‘0’; end process;

in2305-II: L222 Demo Demo.. (vhdl_projects.tgz, reaction timer)