VHDL 4 Building blocks of a computer VHDL 4 : (ver.5a) 1.

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

Table 7.1 Verilog Operators.
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.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
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.
VHDL Coding Styles for Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh.
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.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 2 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
Fall 2007 L16: Memory Elements LECTURE 16: Clocks Sequential circuit design The basic memory element: a latch Flip Flops.
LECTURE 8: VHDL PROCESSES
Chapter 14 Introduction to Microprocessors. 2 Microcomputer A self-contained computer system that consists of CPU (central processing unit), memory (RAM.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
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.
ENG241 Digital Design Week #8 Registers and Counters.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
SEQUENTIAL LOGIC By Tom Fitch. Types of Circuits Combinational: Gates Combinational: Gates Sequential: Flip-Flops Sequential: Flip-Flops.
ECE 331 – Digital System Design Multiplexers and Demultiplexers (Lecture #13)
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
CS/EE 3700 : Fundamentals of Digital System Design
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.
VHDL Programming Fundamentals Presented By Dr. Pradyut Kumar Biswal Department of Electronics, IIIT Bhubaneswar.
Latches and Flip-Flops
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
CO5023 Latches, Flip-Flops and Decoders. Sequential Circuit What does this do? The OUTPUT of a sequential circuit is determined by the current output.
VHDL 7: use of signals v.5a1 VHDL 7 Use of signals In processes and concurrent statements.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
July 2, 2001Systems Architecture I1 Systems Architecture II (CS 282) Lab 3: State Elements, Registers, and Memory * Jeremy R. Johnson Monday July 2, 2001.
VHDL 4 Building blocks of a computer VHDL 4 : (ver.6a) 1.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Class Exercise 1B.
Registers and Counters
Figure 7.1 Control of an alarm system
Computer Architecture & Operations I
ENG2410 Digital Design “Combinational Logic Design”
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
FIGURE 5.1 Block diagram of sequential circuit
VHDL 5 FINITE STATE MACHINES (FSM)
In processes and concurrent statements
Sequential-Circuit Building Blocks
Field Programmable Gate Array
Field Programmable Gate Array
Field Programmable Gate Array
Computer Science 210 Computer Organization
Building blocks of a computer
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
VHDL (VHSIC Hardware Description Language)
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.
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
(Sequential-Circuit Building Blocks)
Presentation transcript:

VHDL 4 Building blocks of a computer VHDL 4 : (ver.5a) 1

VHDL 4 Building blocks of a computer Combinational circuit and sequential circuit Building blocks of a computer. Control units are state machines, which have Flip-flops, decoders, multiplexers etc. Beware that, there are usually more than one way to design the same digital system in VHDL VHDL 4 : (ver.5a) 2

Combinational Vs. Sequential ciruits Combinational circuit, it has no memory combining and/or inviters Sequential circuit, it has memory Circuits that change state and output according to some conditions, (input or clock) Examples: Sequential Latch, Flip-flops (FFs) with asynchronous or synchronous reset; Combinational tri state buffer; decoder; multiplexer, bi-directional buffer, VHDL 4 : (ver.5a) 3

A typical CPU FFs=Flip-flops A state machine contains FFs VHDL 4 : (ver.5a) 4 ALU (state machine) Control Unit State machine I/O control logic (state machine) Registers (FFs) data-bus Transceivers (bi-directional buffers ) Memory Address bus (latches)

Use VHDL to make digital system building blocks 1) latch, 2) flipflop with asynchronous reset, 3) flipflop with synchronous reset, 4) tri state buffer, 5) decoder, 6) multiplexer, 7) bi-directional buffer, VHDL 4 : (ver.5a) 5

VHDL Exercise 4 1) Latch: when gate=1, output follows input (level sensitive) 1 entity latch_ex is 2 port (gate, in1 : in std_logic; 3 out1 : out std_logic); 4 end latch_ex; 5 architecture latch_ex_arch of latch_ex is 6 begin 7 process (gate,in1) 8 begin 9 if (gate = '1') then 10 out1 <= in1; 11 end if; 12 end process; 13 end latch_ex_arch; VHDL 4 : (ver.5a) 6 in1 gate out1 Latch 1-bit memory D Q C The process executes once when ‘gate’ or ‘in1’ changes sensitivity list hFilesTeaching/COE022_200/Chapter4_1.ht mhttp://faculty.kfupm.edu.sa/COE/ashraf/Ric hFilesTeaching/COE022_200/Chapter4_1.ht m, or P.72 Advanced Digital Design with the Veriolog HDL by M.D. Ciletti

Exercise 4.1 on latch: draw q VHDL 4 : (ver.5a) 7 in1 gate q q In1 gate Latch

2) Edge-triggered Flip-flop with asyn. reset : reset before clock statement 1 architecture dff_asyn_arch of dff_asyn is 2 begin 3 process(clock, reset) 4 begin 5 if (reset = '1') then 6 out1 <= '0'; 7 elsif clock = '1' and clock'event then 8 out1 <= in1; 9 end if; 10 end process; 11 end dff_asyn_arch; WS VHDL 4 : (ver.2b) 8 sensitivity list edge triggered clock or rising_edge(clock) CK D Draw (Q) Q in1 clock Edge (50%) Clock triggered FF Explain the meaning of “50 % clock trigger” for a Flip Flop. Reset

Exercise 4.3 on architecture dff_asyn_a When will line 3 be executed? Which is more powerful: clock or reset? 1 architecture dff_asyn_arch of dff_asyn is 2 begin 3 process(clock, reset) 4 begin 5 if (reset = '1') then 6 out1 <= '0'; 7 elsif clock = '1' and clock'event then 8 out1 <= in1; 9 end if; 10 end process; 11 end dff_asyn_arch; VHDL 4 : (ver.5a) 9 For asyn. reset flipflop asyn. reset and clock must be in the sensitivity list

3) Flip-flop with syn. reset: clock before reset statement 1 architecture dff_syn_arch of dff_syn is 2 begin process(clock,reset) – ‘reset’ can be removed, 4 begin– -- but allowed 5 if clock = '1' and clock'event then 6 if (reset = '1') then 7 out1 <= '0'; 8 else 9 out1 <= in1; 10 end if; 11 end if; 12 end process; 13 end dff_syn_arch; VHDL 4 : (ver.5a) 10 reset clock out1 D in1 Discuss why reset is not needed in the sensitivity list edge triggered clock

Difference between Syn. & Asyn. RESET flip-flops (FF) The order of the statements inside the process determines Syn. or Asyn. reset if clock = '1' and clock'event then if (reset = '1') then if (reset = '1') then q <= '0'; elsif clock = '1' and clock'event then VHDL 4 : (ver.5a) 11 Syn. Reset Flip-Flop (check clock first) Asyn. Reset Flip-Flop (check reset first)

Exercise 4.4 on different flip-flops **In Xilinx-Foundation all flip-flops are treated as 50% edge triggered flip-flops. What is the difference between synchronous reset (syn-reset) flip-flops and asynchronous reset (asyn-reset) flip-flops? Discuss the difference between a latch and a flip flop. VHDL 4 : (ver.5a) 12

4) Tri state buffer: using when-else (Use capital letter big Z for float, Z is a reserved character) 1 entity tri_ex is 2 port (in1, control : in std_logic; 3 out1 : out std_logic); 4 end tri_ex; 5 architecture tri_ex_arch of tri_ex is 6 begin 7 out1 <= in1 when control = '1' else 'Z'; 8 end tri_ex_arch; VHDL 4 : (ver.5a) 13 out1 control in1 remember: Z is a scissor Z=float

A decoder (N bits --> 2 N bits) VHDL 4 : (ver.5a) 14 Picture from:

5) Decoder: using if statements 1 architecture decoder_a of decoder is 2 begin 3 process (in1, in2) 4 begin 5 if in1 = '0' and in2 = '0' then 6 out00 <= '1'; 7 else 8 out00 <= '0'; 9 end if; 10 if in1 = '0' and in2 = '1' then 11 out01 <= '1'; 12 else 13 out01 <= '0'; 14 end if; VHDL 4 : (ver.5a) 15 in1 in2 out00 out10 out11 out01 sensitivity list in='1' and in2='0', open the safe case 2 case 1

(contin.)Decoder 15 if in1 = '1' and in2 = '0' then 16 out10 <= '1'; 17 else 18 out10 <= '0'; 19 end if; 20 if in1 = '1' and in2 = '1' then 21 out11 <= '1'; 22 else 23 out11 <= '0'; 24 end if; 25 end process; 26 end decoder_a; VHDL 4 : (ver.5a) 16 case 3 (open the safe) case 4

6) Multiplexer (2 N bits --> N bits) (the reverse of decoder) 1 architecture mux_arch of mux is 2 begin 3 process (in1, in2, ctrl) 4 begin 5 if ctrl = '0' then 6 out1 <= in1; 7 else 8 out1 <= in2; 9 end if; 10 end process; end mux_arch; VHDL 4 : (ver.5a) 17 Mux out1 in1 in2 crtl in1 in2 out1 crtl

Note:7) Bi-directional bus: using data flow concurrent statements 1 entity inout_ex is 2 port (io1, io2 : inout std_logic; 3 ctrl : in std_logic); 4 end inout_ex; 5 6 architecture inout_ex_a of inout_ex is 7 --signal outbuf, inbuf : std_logic; 8 begin 9 io1 <= io2 when ctrl = '1' else 'Z'; 10 io2 <= io1 when ctrl = '0' else 'Z'; 11 end inout_ex_a; VHDL 4 : (ver.5a) 18 io1 ctrl io2 concurrent statements

Exercise 4.5 for Bi-directional bus Crt=1, “io1” follows “io2_in” Crt=0, “io2” follows “io1_in” Plot io1 io2 VHDL 4 : (ver.5a) 19 Io1_in io1 Io2_in Io2 ctrl io1 ctrl io2 Io1_in Io2_in R=10K

Exercise 4.6 VHDL 4 : (ver.5a) 20 List whether the following circuits are sequential or combinational and discuss the reasons Circuit name Sequential or combinational Condition for state change if sequential discussion latch Flip flop tri state buffer Decoder Multiplexer, Bi-directional buffer

(ANSWER ) Exercise 4.6 VHDL 4 : (ver.5a) 21 List whether the following circuits are sequential or combinational and discuss the reasons Circuit name Sequential or combinational Condition for state change if sequential discussion latchSequentialInput stateHas memory Flip flopSequentialClock edgeHas memory tri state buffer combinationalN.A.No memory DecodercombinationalN.A.No memory Multiplexer,combinationalN.A.No memory Bi-directional buffer combinationalN.A.No memory

Quick revision You should know how to design asynchronous, synchronous reset flip-flops tri state buffers, Combination logics decoders, multiplexers, bi-directional buffers, VHDL 4 : (ver.5a) 22

Appendix: do variables in processes have memory. (Good practice: Initialize variables before use; assign values to variables from input first) library IEEE; use IEEE.std_logic_1164.all; entity test is port (a,reset_v1: in std_logic; b,c: out std_logic); end test; architecture test_arch of test is begin label_proc1: process (a,reset_v1) variable v1 : std_logic; begin if reset_v1 ='1' then v1:= not a; end if; b<=a; c<=v1; end process label_proc1; end test_arch; **The answer is yes. That means after a process is called, the state of a variable will be stored for the next time the process is being run again. VHDL 4 : (ver.5a) 23 V1 stays at two different levels depending on previous result

Turn VHDL into schematic Use Schematic viewer in ISE project navigator VHDL 4 : (ver.5a) 24

How to represent binary and hex numbers Type Standard logic( with initialized values): signal code_bit : std_logic := ‘1’; --for one bit, init to be ‘1’, or ‘0’ signal codex : std_logic_vector (1 downto 0) :=“01”; -- 2-bit signal codey : std_logic_vector (7 downto 0) :=x“7e”; --8-bit hex 0x7e VHDL 4 : (ver.5a) 25