An Introduction to Verilog: Transitioning from VHDL

Slides:



Advertisements
Similar presentations
HDL Programming Fundamentals
Advertisements

UNIT 8: Synthesis Basics
An Introduction to Verilog-A: Transitioning from Verilog
CDA 3100 Recitation Week 11.
The Verilog Hardware Description Language
OBJECTIVES Learn the history of HDL Development. Learn how the HDL module is structured. Learn the use of operators in HDL module. Learn the different.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Introduction To VHDL for Combinational Logic
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Chap. 6 Dataflow Modeling
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Verilog Intro: Part 1.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Lecture 7 Verilog Additional references Structural constructs
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 5.
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
Tutorial 1 Combinational Logic Synthesis. Introduction to VHDL VHDL = Very high speed Hardware Description Language VHDL and Verilog are the industry.
Verilog Language Concepts
FPGA-Based System Design Copyright  2004 Prentice Hall PTR Logic Design Process n Functional/ Non-functional requirements n Mapping into an FPGA n Hardware.
EEE2243 Digital System Design Chapter 3: Verilog HDL (Combinational) by Muhazam Mustapha, January 2011.
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.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Digital Electronics Chapter 3 Gate-Level Minimization.
Chapter 2: Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 2-1 Chapter 2a: Structural Modeling.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Introduction to Verilog
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,
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.
Hardware Description Languages: Verilog
An Introduction to Verilog: Transitioning from VHDL
Hardware Description Language
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
ELEN 468 Advanced Logic Design
Discussion 2: More to discuss
Lecture 7 Logistics Last lecture Today Homework 2 due today
TODAY’S OUTLINE Testbench Circuit Verilog Operators
Hardware Description Languages: Verilog
Topics The logic design process..
Overview Last lecture Today K-Maps Verilog Structural constructs
CHAPTER 10 Introduction to VHDL
Overview Last lecture Today K-Maps Verilog Structural constructs
Discussion D5.1 Section Sections 13-3, 13-4
Digital Fundamentals Floyd Chapter 4 Tenth Edition
Chapters 4 – Part3: Verilog – Part 1
The Verilog Hardware Description Language
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
Verilog HDL Basic Syntax
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

An Introduction to Verilog: Transitioning from VHDL Tutorial 1 An Introduction to Verilog: Transitioning from VHDL

Lesson Plan (Tentative) Week 1: Transitioning from VHDL to Verilog, Introduction to Cryptography Week 2: A5 Cipher Implementaion, Transitioning from Verilog to Verilog-A Week 3: Verilog-A Mixer Analysis

Purpose of HDL Languages Simplify design so you can concentrate on the overall picture HDL allows description in language rather than schematic, speeding up development time Allows reuse of components (standard cells ie libraries)

VHDL/Verilog Differences Verilog modelled after C, VHDL is modelled after Ada VHDL is more strongly typed (ie it checks the typing more rigorously) Verilog is case sensitive while VHDL is not This means that VHDL has a higher learning curve than Verilog, but with proficiency, offers more flexibility. Verilog used extensively in the US while VHDL is used internationally

Verilog Types wire, wire[msb:lsb] (single/multiple bit wire) reg, reg[msb:lsb] (single/multiple bit register) integer (integer type, 32 bits) time (unsigned 64 bit) real (floating point double) string

Operators Arithmetic: Binary +, -, *, /, % (mod) Unary +, - (sign) Relational Binary <, >, <=, >=

Operators (con’t) Equivalence Operators === (equivalence including x and z), ==, !== (again including x and z), != Bit-wise Operators ~ (not), & (and), | (or), ^ (xor), ~^, ^~ (xnor)

Operators (con’t) Shift Operators <<, >> Cocatenation {a, b, c} Replication {n{m}} (m n times) Conditional cond_exp ? True_exp : false_exp

Built in gates Can be used without having to build and, nand, or, nor, xor, xnor (n-input gates), used as: and (out, in1, in2, in3, …) buf, bufif1, bufif0, not, notif1, notif0 (transmission gates/tristates)

Entity Instantiation No equivalent of architecture keyword in Verilog (all is treated as one architecture) VHDL: entity myentity is port ( a, b : in std_logic; c : out std_logic); end myentity; Architecture implementation of myentity --do stuff end implementation; Verilog: module myentity (a, b, c); input a, b; output c; wire a, b, c; //do stuff endmodule

Component Instantiation Verilog doesn’t require explicit instantiation VHDL: component DFF port( d : in std_logic; q : out std_logic); end component; MyDff : DFF Port map (foo, bar); --implicit Port map (d => foo, q => bar);--explicit Verilog: dff u0 (foo, bar); //implicit dff u0 (.foo(d), .bar(q)); //explicit

Combinational Assignment Note that gate level primitives in Verilog can be a function or bitwise symbol VHDL: a <= b; a <= b AND c; a <= b + c; Verilog: a <= b; //parallel assignment and(a, b, c); //a is output a <= b & c; //same as line above {carry, sum} <= b + c; //carry is //optional

Flow Logic (I): Case Differentiation in VHDL for select statements and conditional assignment; none in Verilog VHDL: With std_logic_vector’(A) select Q <= “1” when “0” <= “0” when “1” <= “0” when others; VHDL can also use case statements similar to Verilog Verilog: case (A) 0 : Q <= 1; 1 : Q <= 0; default : Q <= 0; endcase

Flow Logic (II): If/Then/Else Equivalence operators similar to C in Verilog VHDL: Q <= ‘1’ when A = ‘1’ else ‘0’ when B = ‘1’ else ‘0’; Verilog: if (A == 1) begin Q <= 1; end else if (B == 1) begin Q <= 0; end else begin end

Combinational Processes VHDL: process (a) begin b <= a; end process; Verilog: always @ (a) end

Sequential Logic Example: D Flip Flop: (note edge triggering is in always statement in Verilog) VHDL: process(clk) begin if rising_edge(clk) q <= d; end if; End process; Verilog: always @ (posedge clk) end

Test Benches Useful for simulation and verification Keyword “initial begin .. end” starts a testbench Remember “always begin .. end” #delay is used to delay by delay ‘time units’ $display(“Random text”) displays Random text `timescale sets the ‘time unit’ unit

Test Benches $monitor (“Clk %b, Reg %d”, clk, reg) displays clock and register variables as binary and decimal respectively #delay $finish runs the testbench for delay ‘time units’

4-bit Counter Code //Asynchronous Reset 4-bit //Counter module counter (clk, reset, enable, count); input clk, reset, enable; wire clk, reset, enable; output count; reg[3:0] count; always @ (reset) //change to //posedge clk for sync reset begin if (reset == 1) begin count <= 0; end always @ (posedge clk) begin if (enable == 1) begin count <= count + 1; end endmodule

Testbench for Counter Example: `timescale 1ns/1ns module counter_tb; reg clk, reset, enable; wire [3:0] count; counter U0 ( .clk (clk), .reset (reset), .enable (enable), .count (count) ); initial begin clk = 0; reset = 0; enable = 0; end always #5 clk = !clk; //flip clock every 5 ns initial begin  $dumpfile ( "counter.vcd" ); $dumpvars; end $display( "\t\ttime,\tclk,\treset,\tenable,\tcount" ); $monitor( "%d,\t%b,\t%b,\t%b,\t%d" ,$time, clk,reset,enable,count); initial #100 $finish; //ends after 100 ns endmodule

Introduction to Cryptography Tutorial 1 Part 2 Introduction to Cryptography

Cryptography is Everywhere Internet (online banking, e-commerce sites) Cell phones (GSM and CDMA) Other wireless devices (PDAs and laptops with wireless cards) RFIDs, sensors

Why Hardware Design is important in Cryptography Many cryptographic applications are hardware-based (cell phones, RFID, wireless router technology, electronic key dongles) Importance of hardware design knowledge to efficiently implement applications in cryptography

Scenario O A B A wants to communicate with B, however O can listen in on the conversation. How to prevent this?

Types of Cryptographic Ciphers A cipher is a way of making messages unreadable Two main categories: public key and private/symmetric key Public key uses different keys for encryption and decryption (which means not having to exchange keys in person), but is computationally expensive Symmetric key uses the same key for encryption and decryption, but is relatively cheap in terms of computation power

Types of Cryptographic Ciphers Examples of Public Key Cryptography: RSA, Diffie-Hellman key exchange, ECC (Elliptic Curve Cryptography) Examples of Symmetric Key Cryptography: RC4 (used in WEP), A5 (used in GSM), DES and Triple-DES (used in banking applications)

Linear Feedback Shift Registers (LFSRs) Used in many stream ciphers (a subset of symmetric key ciphers that outputs 1 bit at a time; they’re quick, but less secure than block ciphers) Consists of a chain of D Flip Flops and a set of XORs that feed later bits back into the beginning

Example

Practical Example of a cipher: A5 Used in GSM communications as an encryption scheme Consists of 3 LFSRs combined to produce a single stream of bits Details were kept secret; people reverse-engineered the cipher to produce the structure There have been many attacks since it was reverse engineered and is now considered broken

Diagram of A5-1

Summary Cryptography is used in many everyday applications Hardware knowledge important to implement efficient ciphers LFSRs important to implement stream ciphers A5-1 (GSM) an application of LFSRs