lect13 verilog and basics

lect13 verilog and basics - CSE140: Components and Design...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
1 1 Sources: TSR, Katz, Boriello, Vahid, Perkowski CSE140: Components and Design Techniques for Digital Systems Tajana Simunic Rosing 2 Sources: TSR, Katz, Boriello, Vahid, Perkowski Announcements and Outline •H W # 7 d u e •M i d t e r m Average:83.8 Median:91.0 Std Dev:17.02 Topics: – Memory hierarchy – FPGAs – Verilog Basics – Behavioral Synthesis
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 3 Sources: TSR, Katz, Boriello, Vahid, Perkowski CSE140: Components and Design Techniques for Digital Systems Verilog Tajana Simunic Rosing 4 Sources: TSR, Katz, Boriello, Vahid, Perkowski Verilog • Supports structural and behavioral descriptions • Structural – explicit structure of the circuit – e.g., each logic gate instantiated and connected to others • Behavioral – program describes input/output behavior of circuit – many structural implementations could have same behavior – e.g., different implementation of one Boolean function
Background image of page 2
3 5 Sources: TSR, Katz, Boriello, Vahid, Perkowski module xor_gate (out, a, b); input a, b; output out; wire abar, bbar, t1, t2; inverter invA (abar, a); inverter invB (bbar, b); and_gate and1 (t1, a, bbar); and_gate and2 (t2, b, abar); or_gate or1 (out, t1, t2); endmodule Structural model 6 Sources: TSR, Katz, Boriello, Vahid, Perkowski module xor_gate (out, a, b); input a, b; output out; reg out; assign #6 out = a ^ b; endmodule Simple behavioral model • Continuous assignment
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 7 Sources: TSR, Katz, Boriello, Vahid, Perkowski module xor_gate (out, a, b); input a, b; output out; reg out; always @(a or b) begin #6 out = a ^ b; end endmodule Simple behavioral model • always block 8 Sources: TSR, Katz, Boriello, Vahid, Perkowski module testbench (x, y); output x, y; reg [1:0] cnt; initial begin cnt = 0; repeat (4) begin #10 cnt = cnt + 1; $display ("@ time=%d, x=%b, y=%b, cnt=%b", $time, x, y, cnt); end #10 $finish; end assign x = cnt[1]; assign y = cnt[0]; endmodule Driving a simulation through a “testbench”
Background image of page 4
5 9 Sources: TSR, Katz, Boriello, Vahid, Perkowski Complete simulation • Instantiate stimulus component and device to test a b z test-bench x y 10 Sources: TSR, Katz, Boriello, Vahid, Perkowski module Compare1 (Equal, Alarger, Blarger, A, B); input A, B; output Equal, Alarger, Blarger; assign #5 Equal = (A & B) | (~A & ~B); assign #3 Alarger = (A & ~B); assign #3 Blarger = (~A & B); endmodule Comparator example
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 11 Sources: TSR, Katz, Boriello, Vahid, Perkowski module life (n0, n1, n2, n3, n4, n5, n6, n7, self, out); input n0, n1, n2, n3, n4, n5, n6, n7, self; output out; reg out; reg [7:0] neighbors; reg [3:0] count;
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2008 for the course CSE 140 taught by Professor Rosing during the Fall '06 term at UCSD.

Page1 / 16

lect13 verilog and basics - CSE140: Components and Design...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online