CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.

Slides:



Advertisements
Similar presentations
INTRO TO VHDL Appendix A: page page VHDL is an IEEE and ANSI standard. VHDL stands for Very High Speed IC hardware description language.
Advertisements

Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
History TTL-logic PAL (Programmable Array Logic)
Arbitrary Waveform Discussion 5.5 Example 34.
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
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.
HDL-Based Digital Design Part I: Introduction to VHDL (I) Dr. Yingtao Jiang Department Electrical and Computer Engineering University of Nevada Las Vegas.
Sequencing and Control Mano and Kime Sections 8-1 – 8-7.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Algorithmic State Machine (ASM) Charts
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
Introduction to VHDL (part 2)
CPE 626 Advanced VLSI Design Lecture 3: VHDL Recapitulation Aleksandar Milenkovic
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
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 Files & Text IO ECE4623/5623 Computer Hardware Design.
1 ECE 545—Digital System Design with VHDL Lecture 6 Behavioral VHDL Coding (for Synthesis): Finite State Machines and ASMs 9/30/08.
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
ENG241 Digital Design Week #8 Registers and Counters.
George Mason University ECE 545 – Introduction to VHDL Variables, Functions, Memory, File I/O ECE 545 Lecture 7.
CPE 626 Advanced VLSI Design Lecture 4: VHDL Recapitulation (Part 2) Aleksandar Milenkovic
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
VHDL for Finite State Machines. Sorry – no standard way One way –Use TYPE and SIGNAL ARCHITECTURE Behavior OF two_ones_fsm IS TYPE State_type IS ( A,
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
Algorithmic State Machines Sorting Signed & Unsigned Data Types
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
Chapter 8. Additional Topics in VHDL 권동혁.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Combinational logic circuit
Registers and Counters
Figure 7.1 Control of an alarm system
ENG2410 Digital Design “Combinational Logic Design”
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
ECE 4110–5110 Digital System Design
CPE 626 Advanced VLSI Design Lecture 2: VHDL Recapitulation Aleksandar Milenkovic
ECE 434 Advanced Digital System L17
CPE/EE 422/522 Advanced Logic Design L06
ECE 434 Advanced Digital System L08
CPE/EE 422/522 Advanced Logic Design L15
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
CPE/EE 422/522 Advanced Logic Design L14
VHDL (VHSIC Hardware Description Language)
CPE/EE 422/522 Advanced Logic Design L11
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.
UNIT 6: Mixed-Type Description
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
High-Low Guessing Game
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
Presentation transcript:

CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville

Sequential Network Models Outline Sequential Network Models FFs, Latches, Registers Counters FSMs Files 14/11/2018 UAH-CPE528

D-FFs library ieee; use ieee.std_logic_1164.all; entity flop is port(C, D : in std_logic; Q : out std_logic); end flop; architecture archi of flop is begin process (C) begin if (C'event and C='1') then Q <= D; end if; end process; end archi; library ieee; use ieee.std_logic_1164.all; entity flop is port(C, D, CLR : in std_logic; Q : out std_logic); end flop; architecture archi of flop is begin process (C, CLR) begin if (CLR = '1')then Q <= '0'; elsif (C'event and C='0')then Q <= D; end if; end process; end archi; 14/11/2018 UAH-CPE528

Latches library ieee; use ieee.std_logic_1164.all; entity latch is port(G, D : in std_logic; Q : out std_logic); end latch; architecture archi of latch is begin process (G, D) begin if (G='1') then Q <= D; end if; end process; end archi;   library ieee; use ieee.std_logic_1164.all; entity latch is port(G, D, CLR : in std_logic; Q : out std_logic); end latch; architecture archi of latch is begin process (CLR, D, G) begin if (CLR='1') then Q <= '0'; elsif (G='1') then Q <= D; end if; end process; end archi; 14/11/2018 UAH-CPE528

4-bit Register library ieee; use ieee.std_logic_1164.all; entity flop is port(C, CE, PRE : in std_logic; D : in std_logic_vector (3 downto 0); Q : out std_logic_vector (3 downto 0)); end flop; architecture archi of flop is begin process (C, PRE) begin if (PRE='1') then Q <= "1111"; elsif (C'event and C='1')then if (CE='1') then Q <= D; end if; end if; end process; end archi; 14/11/2018 UAH-CPE528

4-bit Unsigned Up Counter library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity counter is port(C, CLR : in std_logic; Q : out std_logic_vector(3 downto 0)); end counter; architecture archi of counter is signal tmp: std_logic_vector(3 downto 0); begin process (C, CLR) begin if (CLR='1') then tmp <= "0000"; elsif (C'event and C='1') then tmp <= tmp + 1; end if; end process; Q <= tmp; end archi; 14/11/2018 UAH-CPE528

General Form of a Sequential Network Combinational Combinational Flip-flops Z circuit circuit Q Clock 14/11/2018 UAH-CPE528

An Example ¤ ¤ ¤ Reset w = 1 w = A z = B z = w = w = w = 1 C z = 1 w = A ¤ z = B ¤ z = w = w = w = 1 C ¤ z = 1 w = 1 14/11/2018 UAH-CPE528

VHDL Model USE ieee.std_logic_1164.all ; ENTITY simple IS PORT (Clock, Resetn, w : IN STD_LOGIC ; z : OUT STD_LOGIC ) ; END simple ; ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y : State_type ; BEGIN PROCESS ( Resetn, Clock ) IF Resetn = '0' THEN y <= A ; ELSIF (Clock'EVENT AND Clock = '1') THEN -- cont’d ... 14/11/2018 UAH-CPE528

VHDL Model (cont’d) CASE y IS WHEN A => IF w = '0' THEN y <= A ; ELSE y <= B ; END IF ; WHEN B => y <= C ; WHEN C => END CASE ; END PROCESS ; z <= '1' WHEN y = C ELSE '0' ; END Behavior ; 14/11/2018 UAH-CPE528

VHDL Model – Alternative Style -- same as before ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y_present, y_next : State_type ; BEGIN PROCESS ( w, y_present ) CASE y IS WHEN A => IF w = '0' THEN y_next <= A ; ELSE y_next <= B ; END IF ; WHEN B => ELSE y_next <= C ; WHEN C => END CASE ; END PROCESS ; 14/11/2018 UAH-CPE528

VHDL Model – Alternative Style (cont’d) PROCESS ( Clock, Resetn ) BEGIN IF Resetn = '0' THEN y_present <= A ; ELSIF (Clock'EVENT AND Clock = '1') THEN y_present <= y_next ; ENDIF; END PROCESS ; z <= ‘1’ WHEN y_present = C ELSE ‘0’; END Behavior ; 14/11/2018 UAH-CPE528

File input/output in VHDL Used in test benches Files File input/output in VHDL Used in test benches Source of test data Storage for test results VHDL provides a standard TEXTIO package read/write lines of text 14/11/2018 UAH-CPE528

Files 14/11/2018 UAH-CPE528

Standard TEXTIO Package Contains declarations and procedures for working with files composed of lines of text Defines a file type named text: type text is file of string; Contains procedures for reading lines of text from a file of type text and for writing lines of text to a file 14/11/2018 UAH-CPE528

Reading TEXTIO file Readline reads a line of text and places it in a buffer with an associated pointer Pointer to the buffer must be of type line, which is declared in the textio package as: type line is access string; When a variable of type line is declared, it creates a pointer to a string Code variable buff: line; ... readline (test_data, buff); reads a line of text from test_data and places it in a buffer which is pointed to by buff 14/11/2018 UAH-CPE528

Extracting Data from the Line Buffer To extract data from the line buffer, call a read procedure one or more times For example, if bv4 is a bit_vector of length four, the call read(buff, bv4) extracts a 4-bit vector from the buffer, sets bv4 equal to this vector, and adjusts the pointer buff to point to the next character in the buffer. Another call to read will then extract the next data object from the line buffer. 14/11/2018 UAH-CPE528

Extracting Data from the Line Buffer (cont’d) TEXTIO provides overloaded read procedures to read data of types bit, bit_vector, boolean, character, integer, real, string, and time from buffer Read forms read(pointer, value) read(pointer, value, good) good is boolean that returns TRUE if the read is successful and FALSE if it is not type and size of value determines which of the read procedures is called character, strings, and bit_vectors within files of type text are not delimited by quotes 14/11/2018 UAH-CPE528

Writing to TEXTIO files Call one or more write procedures to write data to a line buffer and then call writeline to write the line to a file variable buffw : line; variable int1 : integer; variable bv8 : bit_vector(7 downto 0); ... write(buffw, int1, right, 6); --right just., 6 ch. wide write(buffw, bv8, right, 10); writeln(buffw, output_file); Write parameters: 1) buffer pointer of type line, 2) a value of any acceptable type, 3) justification (left or right), and 4) field width (number of characters) 14/11/2018 UAH-CPE528

Format of the data in the file An Example Procedure to read data from a file and store the data in a memory array Format of the data in the file address N comments byte1 byte2 ... byteN comments address – 4 hex digits N – indicates the number of bytes of code bytei - 2 hex digits each byte is separated by one space the last byte must be followed by a space anything following the last state will not be read and will be treated as a comment 14/11/2018 UAH-CPE528

An Example (cont’d) Code sequence: an example 12AC 7 (7 hex bytes follow) AE 03 B6 91 C7 00 0C (LDX imm, LDA dir, STA ext) 005B 2 (2 bytes follow) 01 FC_ TEXTIO does not include read procedure for hex numbers we will read each hex value as a string of characters and then convert the string to an integer How to implement conversion? table lookup – constant named lookup is an array of integers indexed by characters in the range ‘0’ to ‘F’ this range includes the 23 ASCII characters: ‘0’, ‘1’, ... ‘9’, ‘:’, ‘;’, ‘<‘, ‘=‘, ‘>’, ‘?’, ‘@’, ‘A’, ... ‘F’ corresponding values: 0, 1, ... 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15 14/11/2018 UAH-CPE528

VHDL Code to Fill Memory Array 14/11/2018 UAH-CPE528

VHDL Code to Fill Memory Array (cont’d) 14/11/2018 UAH-CPE528