ECE 111 (Spring 2017) Professor Bill Lin

Slides:



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

Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Verilog Intro: Part 1.
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
Professor Bill Lin Office hours: TBD, 4310 Atkinson Hall Lectures:
Copyright © 2007 Elsevier4- Chapter 4 :: Hardware Description Languages Digital Design and Computer Architecture David Money Harris and Sarah L. Harris.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Topics We are going to discuss the following topics for roughly 3 weeks from today Introduction to Hardware Description Language (HDL) Combinational Logic.
ECE 2372 Modern Digital System Design
Lecture 4. Verilog HDL 1 (Combinational Logic Design)
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
1 COMP541 Verilog Primer Montek Singh Aug 28, 2015 (draft version  to be updated)
Module 1.2 Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
1 COMP541 Hierarchical Design & Verilog Montek Singh Aug 29, 2014.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
Introduction to Combinational Verilog EECS270 rev 9/25/12.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
ECE 111, Winter Professor Bill Lin – Office hours: TBD, 4310 Atkinson Hall Lectures: – Section.
Introduction to Verilog. Data Types A wire specifies a combinational signal. – Think of it as an actual wire. A reg (register) holds a value. – A reg.
Chapter 4 Computer System Architectures Chapter 4 Based on Digital Design and Computer Architecture, 2 nd Edition David Money Harris and Sarah L. Harris.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Lecture 5. Verilog HDL #1 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
1 A hardware description language is a computer language that is used to describe hardware. Two HDLs are widely used Verilog HDL VHDL (Very High Speed.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Chapter 4 Digital Design and Computer Architecture: ARM® Edition
EECE6017C - Lab 0 Introduction to Altera tools and Basic Digital Logic
Montek Singh Sep 16, 2016 (draft version  to be updated)
COMP541 More on Verilog; Debouncing switches
Lecture 3: Combinational Logic in SystemVerilog
University of Maryland Baltimore County Department of Computer Science and Electrical Engineering   CMPE 212 Laboratory (Discussion 2) Hasibul Hasan
Introduction to Verilog
Discussion 2: More to discuss
Chapter 4 Digital Design and Computer Architecture, 2nd Edition
COMP211 Computer Logic Design
KARTHIK.S Lecturer/ECE S.N.G.C.E
Supplement on Verilog adder examples
Chapter 4 Digital Design and Computer Architecture, 2nd Edition
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
ECE 111 (Spring 2018) Professor Bill Lin
Introduction to Verilog
Hardware Descriptive Languages these notes are taken from Mano’s book
Behavioral Modeling in Verilog
Introduction to Verilog
Basic Logic Gates and Truth Tables
COMP541 State Machines Montek Singh Feb 4, 2010.
Hardware Descriptive Languages these notes are taken from Mano’s book
Lecture 2: Continuation of SystemVerilog
Lecture 1: Introduction
Introduction to Verilog
Introduction to Verilog, ModelSim, and Xilinx Vivado
Introduction to Verilog
The Verilog Hardware Description Language
Introduction to Verilog
Chapter 4 Digital Design and Computer Architecture: ARM® Edition
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

ECE 111 (Spring 2017) http://cwcserv.ucsd.edu/~billlin/classes/ECE111/index.php Professor Bill Lin Office hours: TBD, 4310 Atkinson Hall Lectures: Section A00: TuTh 9:30-10:50a, MANDE B-210 Section B00: TuTh 11:00a-12:20p, CENTER 216 No regular discussion sections (only schedule if needed) TAs: Qingzi Lan, Kevin Luong, and Ping Yin Office hours: TBD Note: You may get help from any TA during their office hours.

Introduction Goal: Learn Verilog-based chip design In particular, we will be using the Hardware Description Language (HDL) SystemVerilog, which is a “superset” of Verilog: Verilog, IEEE standard (1364) in 1995 SystemVerilog, extended in 2005, current version is IEEE Standard 1800-2012 The name “SystemVerilog” is confusing because it still describes hardware at the same level as “Verilog”, but SystemVerilog adds a number of enhancements and improved syntax. SystemVerilog files have a “.sv” extension so that the compiler knows that the file is in SystemVerilog rather than Verilog.

Software See Software Downloads Page which links to this: http://cwcserv.ucsd.edu/~billlin/classes/ECE111/software.php which links to this: http://dl.altera.com/?edition=lite Quartus Prime Lite Edition Quartus Prime (earlier versions were called Quartus II) ModelSim-Intel FPGA Edition Arria II device support Available for Windows and Linux For Macs, you can use Bootcamp to dual-boot Windows

Software Class website has a tutorial page on Quartus and ModelSim http://cwcserv.ucsd.edu/~billlin/classes/ECE111/Quartus_ModelSim_Tutorial/quartus_modelsim_tutorial.html Intel/Altera also has an online demonstration page on Quartus https://www.altera.com/education/demonstrations/dem-index.html

More Information Recommended textbook Digital Design and Computer Architecture, Second Edition, by David Harris and Sarah Harris We will only be using Chapter 4 of this book, which provides a good overview of SystemVerilog with good examples. Make sure you get the 2nd Edition since the 1st Edition uses Verilog instead of SystemVerilog Book recommended, but not required. This is NOT a lecture-based class. Class time used to talk about SystemVerilog in the beginning, but mostly about project information for the rest of the quarter.

Projects and Grading Final project will be a processor capable of implementing the MD5, SHA-1 and SHA-2 secure hash algorithms. Final project will be evaluated on 2 criteria: MIN DELAY = number of clock cycles / clock frequency MIN AREA*DELAY = area x delay Before the final project, there will be a number of intermediate projects. All intermediate projects P/NP. Final grade based only on the final project based on MIN-DELAY and MIN-AREA*DELAY results. Projects done in teams of 2 (you have the option of working alone).

Synthesis vs. Simulation Extremely important to understand that SystemVerilog is BOTH a “Synthesis” language and a “Simulation” language Small subset of the language is “synthesizable”, meaning that it can be translated to logic gates and flip-flops. SystemVerilog also includes many features for “simulation” or “verification”, features that have no meaning in hardware! Although SystemVerilog syntactically looks like “C”, it is a Hardware Description Language (HDL), NOT a software programming language Every line of synthesizable SystemVerilog MUST have a direct translation into hardware (logic gates and flip flops). Very important to think of the hardware that each line of SystemVerilog will produce.

SystemVerilog Modules module example(input logic a, b, c, output logic y); assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c; endmodule Module Abstraction: Slide derived from slides by Harris & Harris from their book

HDL Synthesis SystemVerilog: module example(input logic a, b, c, output logic y); assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c; endmodule Synthesis: translates into a netlist (i.e., a list of gates and flip-flops, and their wiring connections) * Schematic after some logic optimization Slide derived from slides by Harris & Harris from their book

SystemVerilog Syntax Case sensitive No names that start with numbers Example: reset and Reset are not the same signal. No names that start with numbers Example: 2mux is an invalid name Whitespace ignored Comments: // single line comment /* multiline comment */ Slide derived from slides by Harris & Harris from their book

Structural Modeling - Hierarchy module and3(input logic a, b, c, output logic y); assign y = a & b & c; endmodule module inv(input logic a, assign y = ~a; module nand3(input logic a, b, c logic n1; // internal signal and3 andgate(a, b, c, n1); // instance of and3 inv inverter(n1, y); // instance of inverter Slide derived from slides by Harris & Harris from their book

Bitwise Operators // single line comment /*…*/ multiline comment module gates(input logic [3:0] a, b, output logic [3:0] y1, y2, y3, y4, y5); /* Five different two-input logic gates acting on 4 bit busses */ assign y1 = a & b; // AND assign y2 = a | b; // OR assign y3 = a ^ b; // XOR assign y4 = ~(a & b); // NAND assign y5 = ~(a | b); // NOR endmodule // single line comment /*…*/ multiline comment Slide derived from slides by Harris & Harris from their book

Reduction Operators module and8(input logic [7:0] a, output logic y); assign y = &a; // &a is much easier to write than // assign y = a[7] & a[6] & a[5] & a[4] & // a[3] & a[2] & a[1] & a[0]; endmodule Slide derived from slides by Harris & Harris from their book

Conditional Assignment module mux2(input logic [3:0] d0, d1, input logic s, output logic [3:0] y); assign y = s ? d1 : d0; endmodule ? : is also called a ternary operator because it operates on 3 inputs: s, d1, and d0. Slide derived from slides by Harris & Harris from their book

Precedence Order of operations ~ NOT *, /, % mult, div, mod +, - Highest ~ NOT *, /, % mult, div, mod +, - add,sub <<, >> shift <<<, >>> arithmetic shift <, <=, >, >= comparison ==, != equal, not equal &, ~& AND, NAND ^, ~^ XOR, XNOR |, ~| OR, NOR ?: ternary operator Lowest Slide derived from slides by Harris & Harris from their book

Adder Examples module fulladder(input logic a, b, cin, output logic s, cout); logic p, g; // internal nodes assign p = a ^ b; assign g = a & b; assign s = p ^ cin; assign cout = g | (p & cin); endmodule Slide derived from slides by Harris & Harris from their book

Adder Examples /* hierarchical 4-bit adder */ module h4ba(input logic [3:0] A, B, input logic carry_in, output logic [3:0] sum, output logic carry_out); logic carry_out_0, carry_out_1, carry_out_2; // internal signals fulladder fa0 (A[0], B[0], carry_in, sum[0], carry_out_0); fulladder fa1 (A[1], B[1], carry_out_0, sum[1], carry_out_1); fulladder fa2 (A[2], B[2], carry_out_1, sum[2], carry_out_2); fulladder fa3 (A[3], B[3], carry_out_2, sum[3], carry_out); endmodule each of these is an instantiation of “full_adder”

Adder Examples module add4(input logic [3:0] A, B, output logic [3:0] sum); assign sum = A + B; endmodule Verilog compilers will replace arithmetic operators with default logic implementations (e.g. ripple carry adder) this expands into logic for a ripple carry adder

Numbers Format: N'Bvalue N = number of bits, B = base N'B is optional but recommended (default is decimal) Number # Bits Base Decimal Equivalent Stored 3'b101 3 binary 5 101 'b11 unsized 00…0011 8'b11 8 00000011 8'b1010_1011 171 10101011 3'd6 decimal 6 110 6'o42 octal 34 100010 8'hAB hexadecimal 42 00…0101010 Slide derived from slides by Harris & Harris from their book

Bit Manipulations: Example 1 assign y = {a[2:1], {3{b[0]}}, a[0], 6'b100_010}; // if y is a 12-bit signal, the above statement produces: // y = a[2] a[1] b[0] b[0] b[0] a[0] 1 0 0 0 1 0 // underscores (_) are used for formatting only to make // it easier to read. SystemVerilog ignores them. Slide derived from slides by Harris & Harris from their book

Bit Manipulations: Example 2 module mux2_8(input logic [7:0] d0, d1, input logic s, output logic [7:0] y); mux2 lsbmux(d0[3:0], d1[3:0], s, y[3:0]); mux2 msbmux(d0[7:4], d1[7:4], s, y[7:4]); endmodule Slide derived from slides by Harris & Harris from their book