Part III: SYSTEM DESIGN

Slides:



Advertisements
Similar presentations
VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Advertisements

Arbitrary Waveform Discussion 5.5 Example 34.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
Decoders and Encoders Lecture L4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.
Logic Design Fundamentals - 3 Discussion D3.2. Logic Design Fundamentals - 3 Basic Gates Basic Combinational Circuits Basic Sequential Circuits.
Registers VHDL Tutorial R. E. Haskell and D. M. Hanna T2: Sequential Logic Circuits.
Integer Square Root.
Simple Sequential Circuits in VHDL. Contents Sequential circuit examples: - SR latch in dataflow style - D flip-flop in behavioral style - shift register.
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.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
Binary-to-BCD Converter
Registers Lab 5 Mano and Kime Sections 5-2, 5-3, 5-7.
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Binary-to-BCD Converter
Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Main Project : Simple Processor Mini-Project : 3-bit binary counter (using 7400 series) Memory By Oluwayomi B. Adamo.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
Hardware languages "Programming"-language for modelling of (digital) hardware 1 Two main languages: VHDL (Very High Speed Integrated Circuit Hardware Description.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
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.
Controllers ENGIN 341 – Advanced Digital Design University of Massachusetts Boston Department of Engineering Dr. Filip Cuckov.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
INF H131 Clock and Reset Unit (CRU) module library ieee; use ieee.std_logic_1164.all; entity cru is port ( arst : in std_logic; -- Asynch. reset.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Registers and Counters Discussion D8.1. Logic Design Fundamentals - 3 Registers Counters Shift Registers.
Sequential statements (1) process
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Main Project : Simple Processor Mini-Project : Vending Machine Memory
UNIT 8: Synthesis Basics
Part II A workshop by Dr. Junaid Ahmed Zubairi
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Hardware Description Languages
Part IV: VHDL CODING.
ECE 4110–5110 Digital System Design
Sequential-Circuit Building Blocks
Field Programmable Gate Array
Field Programmable Gate Array
Field Programmable Gate Array
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
ECE-C 302 Lecture 15 Prawat Nagvajara
A Data Stack CoreGen Discussion 12.1.
VHDL (VHSIC Hardware Description Language)
ECE 448 Lecture 13 Multipliers Timing Parameters
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Fibonacci Sequence Lecture L4.1 Lab 3.
Multiplication Discussion 11.1.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Modeling of Circuits with a Regular Structure
ECE 448: Lab 4 FIR Filters.
UNIT 6: Mixed-Type Description
Modeling of Circuits with Regular Structure
Sequntial-Circuit Building Blocks
High-Low Guessing Game
4-Input Gates VHDL for Loops
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
(Simple Testbenches & Arithmetic Operations)
EEL4712 Digital Design (Midterm 1 Review).
Presentation transcript:

Part III: SYSTEM DESIGN

Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs

Example 1: Digital Filters FIR

1 ----------------------------------------------------------- 2 LIBRARY ieee; 3 USE ieee.std_logic_1164.all; 4 USE ieee.std_logic_arith.all; -- package needed for SIGNED 5 ----------------------------------------------------------- 6 ENTITY fir2 IS 7 GENERIC (n: INTEGER := 4; m: INTEGER := 4); -- n = # of coef., m = # of bits of input and coef. Besides n 9 and m, CONSTANT (line 19) also need adjust 10 PORT ( x: IN SIGNED(m-1 DOWNTO 0); 11 clk, rst: IN STD_LOGIC; 12 y: OUT SIGNED(2*m-1 DOWNTO 0)); 13 END fir2; 14 ----------------------------------------------------------- 15 ARCHITECTURE rtl OF fir2 IS 16 TYPE registers IS ARRAY (n-2 DOWNTO 0) OF SIGNED(m-1 DOWNTO 0); 17 TYPE coefficients IS ARRAY (n-1 DOWNTO 0) OF SIGNED(m-1 DOWNTO 0); 18 SIGNAL reg: registers; 19 CONSTANT coef: coefficients := ("0001", "0010", "0011", "0100"); 20 BEGIN 21 PROCESS (clk, rst) 22 VARIABLE acc, prod: SIGNED(2*m-1 DOWNTO 0) := (OTHERS=>'0'); 23 VARIABLE sign: STD_LOGIC; 24 BEGIN 25 ----- reset: -------------------------- 26 IF (rst='1') THEN 27 FOR i IN n-2 DOWNTO 0 LOOP 28 FOR j IN m-1 DOWNTO 0 LOOP 29 reg(i)(j) <= '0'; 30 END LOOP; 31 END LOOP; 32 ----- register inference + MAC: ------- 33 ELSIF (clk'EVENT AND clk='1') THEN 34 acc := coef(0)*x; 35 FOR i IN 1 TO n-1 LOOP 36 sign := acc(2*m-1); 37 prod := coef(i)*reg(n-1-i); 38 acc := acc + prod; 39 ---- overflow check: ------------ 40 IF (sign=prod(prod'left)) AND 41 (acc(acc'left) /= sign) THEN 42 acc := (acc'LEFT => sign, OTHERS => 43 NOT sign); 44 END IF; 45 END LOOP; 46 reg <= x & reg(n-2 DOWNTO 1); 47 END IF; 48 y <= acc; 49 END PROCESS; 50 END rtl; 51 -----------------------------------------------------------

Example 2: Neural Networks

1 ----------------------------------------------------------- 2 LIBRARY ieee; 3 USE ieee.std_logic_1164.all; 4 USE ieee.std_logic_arith.all; -- package needed for SIGNED 5 ----------------------------------------------------------- 6 ENTITY nn IS 7 GENERIC ( n: INTEGER := 3; -- # of neurons 8 m: INTEGER := 3; -- # of inputs or weights per neuron 9 b: INTEGER := 4); -- # of bits per input or weight 10 PORT ( x1: IN SIGNED(b-1 DOWNTO 0); 11 x2: IN SIGNED(b-1 DOWNTO 0); 12 x3: IN SIGNED(b-1 DOWNTO 0); 13 w: IN SIGNED(b-1 DOWNTO 0); 14 clk: IN STD_LOGIC; 15 test: OUT SIGNED(b-1 DOWNTO 0); -- register test output 16 y1: OUT SIGNED(2*b-1 DOWNTO 0); 17 y2: OUT SIGNED(2*b-1 DOWNTO 0); 18 y3: OUT SIGNED(2*b-1 DOWNTO 0)); 19 END nn; 20 ----------------------------------------------------------- 21 ARCHITECTURE neural OF nn IS 22 TYPE weights IS ARRAY (1 TO n*m) OF SIGNED(b-1 DOWNTO 0); 23 TYPE inputs IS ARRAY (1 TO m) OF SIGNED(b-1 DOWNTO 0); 24 TYPE outputs IS ARRAY (1 TO m) OF SIGNED(2*b-1 DOWNTO 0); 25 BEGIN 26 PROCESS (clk, w, x1, x2, x3) 27 VARIABLE weight: weights; 28 VARIABLE input: inputs; 29 VARIABLE output: outputs; 30 VARIABLE prod, acc: SIGNED(2*b-1 DOWNTO 0); 31 VARIABLE sign: STD_LOGIC; 32 BEGIN 33 ----- shift register inference: ------------- 34 IF (clk'EVENT AND clk='1') THEN 35 weight := w & weight(1 TO n*m-1); 36 END IF; 37 --------- initialization: ------------------- 38 input(1) := x1; 39 input(2) := x2; 40 input(3) := x3; 41 ------ multiply-accumulate: ----------------- 42 L1: FOR i IN 1 TO n LOOP 43 acc := (OTHERS => '0'); 44 L2: FOR j IN 1 TO m LOOP 45 prod := input(j)*weigth(m*(i-1)+j); 46 sign := acc(acc'LEFT); 47 acc := acc + prod; 48 ---- overflow check: ----------------- 49 IF (sign=prod(prod'left)) AND 50 (acc(acc'left) /= sign) THEN 51 acc := (acc'LEFT => sign, OTHERS => NOT sign); 52 END IF; 53 END LOOP L2; 54 output(i) := acc; 55 END LOOP L1; 56 --------- outputs: -------------------------- 57 test <= weight(n*m); 58 y1 <= output(1); 59 y2 <= output(2); 60 y3 <= output(3); 61 END PROCESS; 62 END neural; 63 -----------------------------------------------------------------