Verilog Intro - University of Waterloo
Transcription
Verilog Intro - University of Waterloo
Introduction to Verilog Omid Ardakanian CS 450/650 - Computer Architecture University of Waterloo Outline • Introduction • CAD tools for Verilog • How to write “Hello World!” in Verilog – – – – – – Module Declaration Register vs. Wire Vectors vs. Arrays Data Types Primitives Port Connection Rules • Assignment 2 Introduction (What are HDLs?) • Definition… • Popular HDLs – Verilog (Verifying Logic) – VHDL • Why are HDLs essential? 3 Verilog vs. VHDL • VHDL – More general language – Not all constructs are synthesizable • Verilog – Not as general as VHDL • but easier to learn than VHDL – Most constructs are synthesizable – Its syntax is similar to C 4 CAD tools for Verilog • Why do we need a CAD tool? – Fast design – Debugging and testing (simulation) – It is necessary for synthesis • Popular examples: – – – – Modelsim Verilog-XL VCS Icarus Verilog 5 4-bit Ripple Carry Adder adder_4_bit full_adder Schematic Design of a 4-bit Ripple Carry Adder full_adder full_adder full_adder Design Hierarchy 6 4-bit Ripple Carry Adder (adder_4_bit) 7 4-bit Ripple Carry Adder (adder_4_bit) module name port list port declaration (input, output, inout) module internals instance name 8 4-bit Ripple Carry Adder (full_adder) 9 Unit Under Test Checking Outputs Generating Inputs Test Bench Stimulus Block 10 Test Bench (adder_4_bit_tb) creates the '.vcd’ output timing 11 How to compile? 12 Waveform VCD file opened with GTKWave 13 Register vs. Wire • wire – Represents connection between components – Its value is determined by the value of its drivers – Its default value is z • reg – Retains its value until next assignment – Its default value is x 14 Vectors vs. Arrays • Vectors – To define multiple width wires or registers – Definition: • wire/reg [msb_index : lsb_index] <data_id>; • Arrays – It is possible to have reg, integer and time arrays – Definition: • <data_type> <var_name> [start_idx : end_idx]; 15 Data Types in Verilog • • • • • • Net Register Integer Real Time … 16 Primitives • • • • and/nand or/nor xor/xnor buf/not • Example: and a1(out, in1, in2) 17 Port Connection Rules net module net or reg net input net inout net or reg net output 18 Assignment • • • • Install Icarus and GTKWave Write a 4-bit adder with carry look ahead Write a test bench for it See the wave form of the output 19 Reference 20 Thank you! Any Questions? 21
Similar documents
One of the ways on how to speed up multiplication... the accumulation of partial products. The best-known method for speeding... CHAPTER 2
More information
Performance Comparision of Carry Select Adders
International Research Journal of Advanced Engineering and Science (IRJAES)
More information