1 / 12

V ERILOG

V ERILOG. 1. Τα απολύτως απαραίτητα. Verilog - Γιατί;. Σχεδίαση επικεντρωμένη στην αρχιτεκτονική Διαδικασία σύνθεσης Εύκολη συντήρηση κώδικα Είναι καθιερωμένο. if (sel == 0) c = ~(a or b); else c = ~d; always @(posedge clk) begin R[1] <= #`dh 1; R[2] <= #`dh 2’b0; end

Télécharger la présentation

V ERILOG

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VERILOG 1. Τα απολύτως απαραίτητα

  2. Verilog - Γιατί; • Σχεδίαση επικεντρωμένη στην αρχιτεκτονική • Διαδικασία σύνθεσης • Εύκολη συντήρηση κώδικα • Είναι καθιερωμένο if (sel == 0) c = ~(a or b);else c = ~d; always @(posedge clk) begin R[1] <= #`dh 1; R[2] <= #`dh 2’b0;end if (sel == 0) c = ~(a or b);else c = ~d; Verilog - Λυμπέρης Σπύρος

  3. Βασική δομή • Modules… • … τουλάχιστον 2 • Top level • Test bench • Είσοδος και αποτελέσματα Verilog - Λυμπέρης Σπύρος

  4. Σύρματα και συνδυαστική λογική • module … endmodule • Δήλωση εισόδων - εξόδων • Concurrent statements module adder(a, b, sum, cout); input a, b; output sum, cout; wire sum = a ^ b; wire cout = a & b; endmodule Verilog - Λυμπέρης Σπύρος

  5. Ένα απλό «test bench» module adder(a, b, sum, cout); input a, b; output sum, cout; wire sum = a ^ b; wire cout = a & b; endmodule module test; reg a, b; wire s, c; adder add0(a, b, s, c); initial begin a = 0; b = 0; #5 $display("a: %x, b: %x, s: %x, c: %x", a, b, s, c); a = 1; #5 $display("a: %x, b: %x, s: %x, c: %x", a, b, s, c); b = 1; #5 $display("a: %x, b: %x, s: %x, c: %x", a, b, s, c); a = 0; #5 $display("a: %x, b: %x, s: %x, c: %x", a, b, s, c); end endmodule Verilog - Λυμπέρης Σπύρος

  6. Wires • Συνδυαστική λογική (δεν έχει μνήμη) • Γράφος εξαρτήσεων • Μπορεί να περιγράψει και ιδιαίτερα πολύπλοκη λογική… wire sum = a ^ b; wire c = sum | b; wire a = ~d; wire sum; ... assign sum = a ^ b; wire muxout = (sel == 1) ? a : b; wire op = ~(a & ((b) ? ~c : d) ^ (~e)); Verilog - Λυμπέρης Σπύρος

  7. Regs reg a; initial begin a = 0; #5; a = 1; end • Στοιχεία μνήμης • … κάτι ανάλογο με μεταβλητές στη C • Synthesizable code: • Αναθέσεις «κοντά» • Εξαίρεση: test bench • Hold time reg q; always @(posedge clk) begin if (load) q = #2 d; end Verilog - Λυμπέρης Σπύρος

  8. Buses • Καμία διαφορά στη συμπεριφορά • Συμβάσεις: • [high : low] • [msb : lsb] • Προσοχή στις συνδέσεις εκτός του module… module adder(a, b, sum, cout); input [7:0] a, b; output [7:0] sum; output cout; wire [8:0] tmp = a + b; wire [7:0] sum = tmp[7:0]; wire cout = tmp[8]; endmodule Verilog - Λυμπέρης Σπύρος

  9. ! Ανακεφαλαίωση: Μετρητής 8 bits module counter(clk, reset, out); input clk, reset; output [7:0] out; wire [7:0] next_value = out + 1; reg [7:0] out; always @(posedge clk) begin if (reset) out = #2 8’b0; else out = #2 next_value; end endmodule module clk(out); output out; reg out; initial out = 1’b0; always out = #25 ~out; endmodule Verilog - Λυμπέρης Σπύρος

  10. ! Μετρητής 8 bits (2) initial begin begin_graphics; reset = 1; @(posedge clk); @(posedge clk); reset = #2 0; @(posedge clk); #300; end_graphics; $stop; end endmodule module test; wire clk; reg reset; wire [7:0] count; clock clk0(clk); counter cnt0(clk, reset, count); `include "cwaves.h” Verilog - Λυμπέρης Σπύρος

  11. clk reset count 03 01 02 04 05 06 00 Μετρητής 8 bits (3) • counter.v • clock.v • test.v • cwaves.h > set path = ($path \ /vlsi/usr/unicad2.3.3b/UNIOPUS/tools/bin) > shmd > verilog -f files.cv +define+GR_CWAVES > cwaves & Verilog - Λυμπέρης Σπύρος

  12. Τέλος! • Δύο τύποι statements: • initial • always • Είσοδος - έξοδος: • input, output • Αποτελέσματα: • $display • Cadence waves • Συνδυαστική λογική: • wire • Ακολουθιακή λογική: • reg • Buses: • [high:low] • Καθυστερήσεις: • #t • @(posedge …) Verilog - Λυμπέρης Σπύρος

More Related