Digital Design using FPGAs and Verilog HDL

Slides:



Advertisements
Similar presentations
Digital System Design-II (CSEB312)
Advertisements

CDA 3100 Recitation Week 11.
Supplement on Verilog adder examples
Table 7.1 Verilog Operators.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
FSM examples.
Pulse-Width Modulated DAC
Useful Things to Know Norm. Administrative Midterm Grading Finished –Stats on course homepage –Pickup after this lab lec. –Regrade requests within 1wk.
Advanced Verilog EECS 270 v10/23/06.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
Registers CPE 49 RMUTI KOTAT.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Speaker: Tsung-Yi Wu FPGA Design Flow (Part 2) : Simulation.
Brief Verilog.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
1 Arithmetic, ALUs Lecture 9 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Introduction to ASIC flow and Verilog HDL
CEC 220 Digital Circuit Design Programmable Logic Devices
Introduction to FPGAs Getting Started with Xilinx.
Exp#7 Finite State Machine Design in Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Introduction to the FPGA and Labs
EECE6017C - Lab 0 Introduction to Altera tools and Basic Digital Logic
Figure 8.1. The general form of a sequential circuit.
Lottery Speaker: Tsung-Yi Wu.
Reg and Wire:.
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
Advance Skills TYWu.
Supplement on Verilog Sequential circuit examples: FSM
Learning Outcome By the end of this chapter, students are expected to be able to: Design State Machine Write Verilog State Machine by Boolean Algebra and.
ECE 4110–5110 Digital System Design
Electronics for Physicists
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Hardware Description Languages
Topics The logic design process..
Field Programmable Gate Array
Field Programmable Gate Array
Field Programmable Gate Array
Pulse-Width Modulation (PWM)
Week 5, Verilog & Full Adder
Basic Logic Gates and Truth Tables
SYNTHESIS OF SEQUENTIAL LOGIC
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
SystemVerilog Implementation of GCD
Test Fixture (Testbench)
Supplement on Verilog Sequential circuit examples: FSM
Register-Transfer Level Components in Verilog
The Verilog Hardware Description Language
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
Electronics for Physicists
The Verilog Hardware Description Language
CS 153 Logic Design Lab Professor Ian G. Harris
The Verilog Hardware Description Language
332:437 Lecture 9 Verilog Example
332:437 Lecture 9 Verilog Example
RTL Design Methodology Transition from Pseudocode & Interface
Digital Designs – What does it take
Introduction to Digital IC Design
Introduction to Verilog – Part-2 Procedural Statements
332:437 Lecture 9 Verilog Example
Lecture 7: Verilog Part II
Lecture 10: Sequential Blocks Arrays
Presentation transcript:

Digital Design using FPGAs and Verilog HDL Project IT – Autumn 2016 Mahdad Davari <mahdad.davari@it.uu.se>

Programmable Devices Since 1969: PROM, (E)EPROM, PAL, PLA, GAL, CPLD, FPGA Key Players in programmable-device industry: Altera (first CPLD) Xilinx (first FPGA)

FPGA from a Bird’s-Eye View

FPGA in a Nutshell

Logic Slice

Look-Up Table (LUT) SRAM cells 1 abc

FPGA Bird’s-Eye View

Roadmap Programmable Devices FPGA Design Flow FPGA vs GP-CPU vs ASIC Accelerator Design Example Verilog HDL Example

FPGA Design Flow Design Entry (RTL design using HDL) Behavioral Simulation (ModelSIM) Behaviour OK? NO Synthesis (Quartus II) Place and Route (PAR) (Quartus II) Timing Analysis (Quartus II) SpeedOK? NO Generate Bit Stream & Programme the Device (Quartus II)

Roadmap Programmable Devices FPGA Design Flow FPGA vs GP-CPU vs ASIC Accelerator Design Example Verilog HDL Example

CPU vs FPGA vs ASIC High Low

Roadmap Programmable Devices FPGA Design Flow FPGA vs GP-CPU vs ASIC Accelerator Design Example Verilog HDL Example

One Monday Morning … FFT algorithm on CPU

Butterfly Operation

4-Point Butterfly Operation X0 2-Point BF 2-Point BF Y0 X2 Y1 X1 2-Point BF 2-Point BF Y2 X3 Y3

8-Point Butterfly Operation

16-Point Butterfly Operation

32-Point Butterfly Operation

Speedup ≈ 8*TMem. + 24*TALU CPU 8x Accel. 1*TMem. + 3*TALU ( CPU TMem. ≈ Accel. TMem. ) ( CPU TALU ≈ Accel. TALU )

Roadmap Programmable Devices FPGA Design Flow FPGA vs GP-CPU vs ASIC Accelerator Design Example Verilog HDL Example

Top-Down Design 8-Point FFT O0 O1 O2 O3 O4 O5 O6 O7 1 2 3 4 5 6 7

Top-Down Design

Top-Down Design i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 Top: 8-Point FFT i0 o0 i0 o0 i0 o0 O0 O1 O2 O3 O4 O5 O6 O7 1 2 3 4 5 6 7 2-Point BF 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0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3 4 5 6 7 1 2 3 4 5 6 7 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 Pipe1 Pipe2 Pipe3 FFT:Stage 1 FFT:Stage 2 FFT:Stage 3

Top-Down Design i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 Top: 8-Point FFT i0 o0 i0 o0 i0 o0 I0 I4 I2 I6 I1 I5 I3 I7 2-Point BF O0 O1 O2 O3 O4 O5 O6 O7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 FFT:Stage 1 FFT:Stage 2 FFT:Stage 3 Valid Ready Reset Clock Pipe1 Pipe2 Pipe3

Bottom-Up Implementation X0 Y0 2-Point BFY X1 Y1 module butterfly (x0, x1, y0, y1); input x0, x1; output y0, y1; assign y0 = x0 + x1; assign y1 = x0 – x1; endmodule Adder Add1 (y0, x0, x1); Subtractor Sub1 (y1, x0, x1);

Bottom-Up Implementation Y0 module fft (i0, i1, i2, i3, i4, i5, i6, i7, o0, o1, o2, o3, o4, o5, o6, o7); Input i0, i1, i2, i3, i4, i5, i6, i7; output o0, o1, o2, o3, o4, o5, o6, o7; butterfly bf1 (i0, i1, o0, o1); butterfly bf2 (i2, i3, o2, o3); butterfly bf3 (i4, i5, o4, o5); butterfly bf4 (.y0 (o6), .y1 (o7), .x0 (i6), .x1 (i7)); endmodule i0 o0 1 2 3 4 5 6 7 2-Point BF 1 2 3 4 5 6 7 i1 o1 X0 Y1 i0 o0 X1 i1 o1 i0 o0 i1 o1 i0 o0 i1 o1 FFT

Top-Down Design i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 Top: 8-Point FFT i0 o0 i0 o0 i0 o0 I0 I4 I2 I6 I1 I5 I3 I7 2-Point BF O0 O1 O2 O3 O4 O5 O6 O7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 i0 o0 i0 o0 i0 o0 i1 o1 i1 o1 i1 o1 FFT:Stage 1 FFT:Stage 2 FFT:Stage 3 Valid Ready Reset Clk Pipe1 Pipe2 Pipe3

Bottom-Up Implementation module top (i0, i1, i2, i3, i4, i5, i6, i7, valid, rst, clk, o0, o1, o2, o3, o4, o5, o6, o7, ready); input i0, i1, i2, i3, i4, i5, i6, i7, valid, rst, clk; output o0, o1, o2, o3, o4, o5, o6, o7, ready; endmodule module top (input [7:0] i, input valid, rst, clk, output [7:0] o, output ready); reg [8:0] pipe1; reg [8:0] pipe2; reg [8:0] pipe3; wire [7:0] w1; wire [7:0] w2; wire [7:0] w3; fft stage1 (i[0], i[4], i[2], i[6], i[1], i[5], i[3], i[7], w1[0:7]); fft stage2 (pipe1[0], pipe1[2], pipe1[1], pipe1[3], pipe1[4], pipe1[6], pipe1[5], pipe1[7], w2[0:7]); fft stage3 (pipe2[0], pipe2[4], pipe2[2], pipe2[6], pipe2[1], pipe2[5], pipe2[3], pipe2[7], w3[0:7]); // continued in the next slide … Y0 Y1

Bottom-Up Implementation // continued from the previous slide … always @ (posedge clk) begin if (rst) pipe1 <= 9’b000000000; pipe2 <= 9’d0; pipe3 <= 0; end else pipe1 <= {valid, w1}; pipe2 <= {pipe1[8], w2}; pipe3 <= {pipe2[8], w3}; // continued in the next slide … Y0 Y1

Bottom-Up Implementation // continued from the previous slide … always @ (w3 or pipe3[8]) // also always @ (w3, pipe3[8]), or simply always @ (*) for all the signals Begin {ready, o} = pipe3; end // assign {ready,o} = pipe3; endmodule Y0 Y1

Testbench Testbench Top (Design Under Test) Input Generator Expected Result == Input Output Test OK!

Testbench module fft_tb; reg clk, rst, valid; reg [8:0] i; wire [8:0] o; wire ready; top dut (.i(i), .valid(valid), .rst(rst), .clk(clk), .o(o), .ready(ready)); always #5 clk = !clk; initial begin rst=0; clk=0; valid=0; rst = #20 1’b1; i = #20 8’hff; valid = 1’b1; valid = #10 1’b0; #50 $finish; end endmodule

Net Types in Verilog Wire Reg Used only as connectors, or left-hand side of “assign”, e.g. “assign w = a & b” Reg Implements combinatorial or sequential logic Used inside “always” blocks

Combinatorial vs. Sequential wire myWire; assign myWire = a | b; reg myReg; always @ (a or b) // also @ (a, b) myReg = a | b; N.B. always @ (a or b) begin if (a == 1 or b == 1) myReg = 1; else end // sequential reg myReg; always @ (posedge Clk) myReg <= a | b; N.B. a net should be assigned ONLY in a single block combinatorial: = sequential: <=

Two-Dimensional Input Ports module myModule (input [7:0] i [0:3], output [7:0] o [0:3]); module myModule (input [31:0] i, output [31:0] o); wire [7:0] myArray [0:3]; assign {myArray [3], myArray [2], myArray [1], myArray [0]} = i; assign o = {myArray [0], myArray [1], myArray [2], myArray [3]}

Useful References https://www.doulos.com/knowhow/verilog_designers_guide/ (good starting point into Verilog) https://inst.eecs.berkeley.edu/~cs150/Documents/Nets.pdf (net types in Verilog, wire vs. reg) http://www.asic-world.com/tidbits/blocking.html (blocking vs. non-blocking assignmets, see the example) http://web.mit.edu/6.111/www/f2007/handouts/L06.pdf (another reference for blocking vs. non-blocking assignments and finite-state-machine design; slides 1 to 7 and slides 11 to 15) http://www.asic-world.com/verilog/art_testbench_writing1.html (writing testbenches in Verilog) http://www.rfwireless-world.com/source-code/ (useful source code examples; jump to Verilog part) http://www.fpl2016.org/slides/Gupta%20--%20Accelerating%20Datacenter%20Workloads.pdf (HARP-related material) http://web.cs.ucla.edu/~haoyc/pdf/dac16.pdf (HARP-related paper) https://pdfs.semanticscholar.org/8b8f/8cb7885bc751fa919d216d96caf4a0234717.pdf (HARP-related paper)

Thank you!