VERILOG HDL

Слични документи
Projektovanje digitalnih sistema

SPR , IV godina, VHDL – Ispitna pitanja

LAB 4 - Binarni komparator

Microsoft PowerPoint - 12a PEK EMT VHDL 1 od 4 - Uvod (2011).ppt [Compatibility Mode]

Microsoft PowerPoint - 10 PEK EMT Logicka simulacija 1 od 2 (2012).ppt [Compatibility Mode]

ODE_0 [Compatibility Mode]

Microsoft PowerPoint - 13 PIK (Mentor Graphic ASIC).ppt

Tutoring System for Distance Learning of Java Programming Language

LAB PRAKTIKUM OR1 _ETR_

Рјешавање проблема потрошње у чиповима Александар Пајкановић Факултет техничких наука Универзитет у Новом Саду Фабрика чипова у Србији: има ли интерес

Microsoft PowerPoint - Programski_Jezik_C_Organizacija_Izvornog_Programa_I_Greske [Compatibility Mode]

P1.2 Projektovanje asemblera

AKVIZICIJA PODATAKA SA UREĐAJEM NI USB-6008 NI USB-6008 je jednostavni višenamjenski uređaj koji se koristi za akviziciju podataka (preko USBa), kao i

ИСПИТНА ПИТАЊА (ОКВИРНИ СПИСАК) УОАР2 2018/19 ПРВИ ДЕО ГРАДИВА 1. Написати истинитоносне таблице основних логичких везника (НЕ, И, ИЛИ). 2. Написати и

Kombinatorno testiranje

Microsoft PowerPoint - DAC.ppt [Compatibility Mode]

Microsoft PowerPoint - SRV LV5.ppt [Compatibility Mode]

KATUŠIĆ ANTONIO.pdf

Algoritmi i arhitekture DSP I

Microsoft Word - 02 Elementi programskog jezika Pascal

Microsoft Word - sm - ISPITNA PITANJA1.doc

Увод у организацију и архитектуру рачунара 1

PROMENLJIVE, TIPOVI PROMENLJIVIH

ELEKTROTEHNIČKI FAKULTET, UNIVERZITET U BEOGRADU KATEDRA ZA ELEKTRONIKU UVOD U ELEKTRONIKU - 13E041UE LABORATORIJSKA VEŽBA Primena mikrokontrolera

Introduction to Programming

PowerPoint Presentation

Lekcija 4 Povezivanje NI DAQ hardvera. Testiranje i simulacija NI DAQ hardvera. Akvizicija pomoću Express VIs 1. Cilj vežbe I deo Cilj vežbe je da stu

P1.3 Projektovanje makroasemblera

OPIS RAČUNARSKOG SISTEMA Računarski sistem se sastoji od procesora, operativne memorije, tajmera i terminala. Sve komponente računarskog sistema su me

Microsoft PowerPoint - GR_MbIS_12_IDEF

Logicko projektovanje racunarskih sistema I

n50

PowerPoint Presentation

TEORIJA SIGNALA I INFORMACIJA

Microsoft PowerPoint - Timer0 16F887.ppt [Compatibility Mode]

VNLab

Microsoft PowerPoint - Bitovi [Compatibility Mode]

Tutoring System for Distance Learning of Java Programming Language

Inženjering informacionih sistema

MIP-heuristike (Matheuristike) Hibridi izmedu metaheurističkih i egzaktnih metoda Tatjana Davidović Matematički institut SANU

Jasna Kellner

Fortran

Microsoft PowerPoint - 12 PAIK Planiranje rasporeda modula (2016) [Compatibility Mode]

KDP

Microsoft PowerPoint - Topic04-Serbian.ppt

Microsoft Word - Projekat iz MIPS-a - simCPU.doc

PowerPoint Presentation

2_Arhitektura racunara

Microsoft Word - Java_introduction_NEW_SYLLABUS.doc

Рачунарска интелигенција

Razvoj programa, Code::Blocks, struktura programa, printf, scanf, konverzioni karakteri predavač: Nadežda Jakšić

P11.3 Analiza zivotnog veka, Graf smetnji

Microsoft PowerPoint - 13-Funkcije_2.ppt [Compatibility Mode]

Bosnia and Herzegovina Directorate of Civil Aviation

PRIRODNO MATEMATIČKI FAKULTET U NIŠU DEPARTMAN ZA RAČUNARSKE NAUKE Utorak, godine PRIJEMNI ISPIT IZ INFORMATIKE 1. Koja od navedenih ekste

Slide 1

NIZOVI

01 SUBP

Grananje u programu predavač: Nadežda Jakšić

03 SUBP

Uvod u PHP

Microsoft PowerPoint - Datoteke [Compatibility Mode]

Funkcije predavač: Nadežda Jakšić

PRILOG I. PONUDBENI LIST S DODACIMA ZA ZAJEDNICU PONUDITELJA I PODIZVODITELJE / APPENDIX I. BIDDING LIST WITH APPENDICES FOR JOINT BIDDERS AND SUB- CO

Microsoft Word - MySQL_3.doc

Microsoft Word - 11 Pokazivaci

I колоквијум из Основа рачунарске технике I СИ- 2017/2018 ( ) Р е ш е њ е Задатак 1 Тачка А Потребно је прво пронаћи вредности функција f(x

Microsoft PowerPoint - ARS_Ch_6 - IO sustavi.ppt

Univerzitet u Beogradu Mašinski fakultet Konstrukcija i tehnologija proizvodnje letelica PODEŠAVANJE PROGRAMSKOG PAKETA CATIA V5 Miloš D. Petrašinović

Logičke izjave i logičke funkcije

PowerPoint Presentation

Nastavna cjelina: 1. Jezik računala Kataloška tema: 1.1. Bit 1.2. Brojevi zapisani četvorkom bitova Nastavna jedinica: 1.1. Bit   1.2. Brojevi zapisan

Strašne žene - pravila Strašne žene Example of the play with 3 players karte na stolu u tri otvorena špila Opis: Strašne žene su žene koje su zadužile

Vjezbe

Osnovi programiranja Beleške sa vežbi Smer Računarstvo i informatika Matematički fakultet, Beograd Jelena Tomašević i Sana Stojanović November 7, 2005

MAZALICA DUŠKA.pdf

Pumping Smart Card

Algoritmi

OOP08

Microsoft PowerPoint - OOPpredavanja05 [Compatibility Mode]

PowerPoint Presentation

(Microsoft PowerPoint Ben\232i\346.ppt [Compatibility Mode])

Транскрипт:

Verilog digitalni dizajn Modelovanje, predstavljanje, simulacija digitalnog hardvera Konkurentno izvršavanje Paralelni tok podataka signali i vreme Specijalne jezičke konsrtrukcije Prelazi na okidnu ivicu kašnjenja Provera tajminga 1

Moduli Definicija primer module module_name ( port_list ); port declarations; variable declaration; description of behavior endmodule module HalfAdder (A, B, Sum Carry); input A, B; output Sum, Carry; assign Sum = A ^ B; //^ znači XOR assign Carry = A & B; // & znači AND endmodule 2

Načini opisa Strukturni: Verilog gate primitive Primer multiplekser: not n1(sel_n, sel); and a1(sel_b, b, sel_b); and a2(sel_a, a, sel); or o1(out, sel_b, sel_a); sel n1 b sel_n a a1 sel_b o1 out a2 sel_a 3

Načini opisa Dataflow: specificiraju se izlazni signali u funkciji ulaznih primer: assign out = (sel & a) (~sel & b); b sel sel_n sel_b out sel_a a 4

Behavioral: algoritamski Načini opisa Example: if (select == 0) begin out = b; end else if (select == 1) begin end out = a; a b Black Box 2x1 MUX out sel 5

Načini opisa Switch lewel: elektronicarski, nema u VHDLu module mynot (input x, output f); // internal declaration supply1 vdd; supply0 gnd; // NOT gate body pmos p1 (f, vdd, x); nmos n1 (f, gnd, x); endmodule 6

Leksičke konvencije Comentari: sintaksa iz jezika C // Single line comment /* Another single line comment */ /* Begins multi-line (block) comment All text within is ignored Line below ends multi-line comment */ Brojevi decimalni, hex, oktalni, binarni unsized decimalni size base forma String " između navodnika" 7

Leksičke konvencije Identifikatori A... Z a... z 0... 9 Underscore Stringovi limitirani na 1024 karaktera Prvi karakter nemože biti cifra 8

Ključne reči 9

Tipovi podataka net (wire, wand, wor, tri, triand, trior, trireg) reg vektor ceo broj realan broj niz (array) (nije string!) memorija parametar Oznaka Logičko stanje 0 logička nula 1 logička jedinica x nepoznato (neodređeno stanje) z stanje velike impedanse 10

Tpovi podataka Net Tipovi: fizicka veza između strukturnih elemenata Register Tip: apstraktni memorijski element Default vrednosti Net Types : z Register Type : x Net Tipovi: wire, tri, wor, trior, wand, triand, supply0, supply1 Register tipovi : reg, integer, time, real, realtime 11

Tipovi podataka Net Type: Wire wire [ msb : lsb ] wire1, wire2, Example wire Reset; // A 1-bit wire wire [6:0] Clear; // A 7-bit wire Register Type: Reg reg [ msb : lsb ] reg1, reg2, Example reg [ 3: 0 ] cla; // A 4-bit register reg cla; // A 1-bit register 12

Restrikcije Data Flow and Structural Modeling Can use only wire data type Cannot use reg data type Behavioral Modeling Can use only reg data type (within initial and always constructs) Cannot use wire data type 13

Memories An array of registers reg [ msb : lsb ] memory1 [ upper : lower ]; Example reg [ 0 : 3 ] mem [ 0 : 63 ]; // An array of 64 4-bit registers reg mem [ 0 : 4 ]; // An array of 5 1-bit registers 14

Operatori Podela: unarni, binarni, ternarni operatori. Primeri: a = ~b; // ~ je unarni operator. b je operand. a = b && c; // && je binarni operator. b i c su // operandi. a = b? c : d; //?: je ternarni operator. b, c i d su // operandi. 15

Operatori Tipovi: dele se na Aritmetičke (+ * / %) logičke (&&!) Relacione (> < >= <= ) jednakosti ( ==!= ===!==) Bitwise ( ~ & ^ ~^) Redukcione ( & ~ & ~ ^ ~^) polazi se od MSB Pomeračke (>> <<) pridruživanja (primer) Umnožavanja (primer) Uslovni (primer) 16

Spaja više operanada (mogu biti vektori i skalari). Dužina vektorskih operanada treba da je unapred definisana. I delovi vektora mogu biti operandi. Pridruživanje 17

Prvi operand konstanta određuje koliko puta treba napisati drugi operand jedan iza drugog.. Umno.avanje se mo.e kombinovati sa pridru.ivanjem. Umnožavanje 18

? USLOVNA OPERACIJA Ako je uslov neodređen (x) rezultantni vektor se sastoji iz poklapajućih bitova operanada i x-ova na mestima gde se ne poklapaju vrednosti. Radi kao multiplekser 2/1 ali može da se koristi i kao kolo za sprezanje sa tri stanja. // Opisivanje multipleksera 2/1 assign out = control? in1 : in2; // Modeliranje kola za sprezanje sa tri stanja assign addr_bus = drive_enable? addr_out : 32 bz; // Rekurzivno korišćenje uslovne operacije. reg [1:0] A, B; // Podaci A, B su reg tipa, veličine 2 bita. assign out = A[0]? ( B[0]? 1 b1 : 1 b0 ) : ( B[0]? 1 b0 : 1 b1); 19

Prioritet operatora Operator i simbol Unary, Multiply, Divide, Modulus!, ~, *, /, % Add, Subtract, Shift +, -, <<, >> Relation, Equality <,>,<=,>=,==,!=,===,!== Reduction &,!&,^,^~,,~ Logic &&, Conditional? : 20

Verilog gate primitive The gates have one scalar output and multiple scalar inputs. The 1st terminal in the list of gate terminals is an output and the other terminals are inputs. Gate Description And N-input AND gate Nand N-input NAND gate Or N-input OR gate Nor N-input NOR gate Xor N-input XOR gate Xnor N-input XNOR gate Za sintezu konsultovati alat koji se koristi! 21

Verilog gate primitive Gate Description Not N-output inverter Buf N-output buffer. Bufif0 Tristate buffer, Active low en. Bufif1 Tristate buffer, Active high en. Notif0 Tristate inverter, Low en. Notif1 Tristate inverter, High en. Tristate gates have three ports: the first is an output port, the second is a data port, and the third is a control port. The control port is used to set gates in high-impedance state. https://www.utdallas.edu/~akshay.sridharan/index_files/page4933.htm 22

Logic Value Description 0 zero, low, false 1 one, high, true z or Z high impedance, floating Logička stanja i fan-out x or X unknown, uninitialized, contention Verilog Strength Levels Strength Level 7 Supply Drive 6 Strong Pull 5 Pull Drive 4 Large Capacitance 3 Weak Drive 2 Medium Capacitance 1 Small Capacitance 0 Hi Impedance Specification Keyword supply0 supply1 strong0 strong1 pull0 pull1 large weak0 weak1 medium small highz0 highz1 23

Transmisioni gejtovi Transmission gates are bi-directional and can be resistive or non-resistive. Resistive devices reduce the signal strength which appears on the output by one level. All the switches only pass signals from source to drain, incorrect wiring of the devices will result in high impedance outputs. ASIC digital design Retko za FPGA sintezu Verolog AMS nije sinteza Nije analogna simulacija 24

Prekidači i transmisioni gejtovi There are six different switch primitives (transistor models) used in Verilog, nmos, pmos and cmos and the corresponding three resistive versions rnmos, rpmos and rcmos. The cmos type of switches have two gates and so have two control signals. Syntax: keyword unique_name (drain. source, gate) Gate Description 1. pmos Uni-directional PMOS switch 1. rpmos Resistive PMOS switch 2. nmos Uni-directional NMOS switch 2. rnmos Resistive NMOS switch 3. cmos Uni-directional CMOS switch 3. rcmos Resistive CMOS switch 4. tranif1 Bi-directional transistor (High) 4. tranif0 Bi-directional transistor (Low) 5. rtranif1 Resistive Transistor (High) 5. rtranif0 Resistive Transistor (Low) 6. tran Bi-directional pass transistor 6. rtran Resistive pass transistor 7. pullup Pull up resistor 8. pulldown Pull down resistor 25

Prekidači:nmos, pmos, rnmos, rpmos, cmos, rcmos The instantiation of these MOS switches can contain zero, one, two, or three delays The strength declaration is illegal. The nmos, pmos and cmos switches reduce supply strength of the signals to strong strength. Signals with others strengths are passed from input to output without a strength reduction. The rnmos, rpmos and rcmos switches reduce supply and strong strength of signals to pull strength. Thepull strength of signals is reduced to weak. The large and weak strength of signals are reduced to medium. The medium strength of signals is reduced to small. Signals with other strengths are passed from input to output without strength reduction. 26

rtranif0, rtranif1, tranif0 and tranif1 The instantiation of these bi-directional pass switches can contain zero, one, two, or three delays. The strength declaration is illegal. The tranif0 and tranif1 switches reduce supply strength of signals to strong. Signals with others strengths are passed from input to output without strength reduction. The rtranif0 andrtranif1 switches reduce supply and strong strength of signals to pull. The pull strength of signals is reduced to weak. The large and weak strength of signals are reduced to medium. The medium strength of signals is reduced to small. Signals with other strengths are passed from input to output without strength reduction. 27

tran and rtran The instance of these bidirectional switches cannot contain delay and strength declaration. The tran switches reduce supply strength of signals to strong strength. Signals with others strengths are passed from input to output without strength reduction. The rtran switches reduce supply and strong strength of signals to pull. The pull strength of signals is reduced to weak. The large and weak strength of signals are reduced to medium. The medium strength of signals is reduced to small. Signals with other strengths are passed from input to output without strength reduction. 28

pullup and pulldown The instantiation pullup and pulldown sources cannot contain delay declaration. The pullup can contain only strength1 specification (the strength0 declaration is optional). The pulldown can contain only strength0specification (the strength1 declaration is optional). The pullup source places a logic value 1 on connected signals. The pull down source places a logic value 0 on connected signals. 29

Na osnovu otpornosti veze Slabljenje intenziteta signala 30

Smanjenje intenziteta signala 31

Switch level dizajn, NAND module my_nand (input x, y, output f); supply1 vdd; supply0 gnd; wire a; // NAND gate body pmos p1 (f, vdd, x); pmos p2 (f, vdd, y); nmos n1 (f, a, x); nmos n2 (a, gnd, y); endmodule 32

Pseudo nmos NOR module pseudo_nor(input x, y, output f); supply0 gnd; // Pseudo nmos gate body nmos nx (f, gnd, x); nmos ny (f, gnd, y); pullup (f); endmodule 33

CMOS prekidač, digitalni! cmos [instance_name] (output, input, ncontrol, control); 34

2/1 Multiplexer 35

Bidirekcioni prekidači 36

Kašnjenja MOS/CMOS prekidača 37

Kašnjenja bidirekcionih prekidača 38

trireg Nets, states: Driven, Capacitive 39

trireg Nets, states: Driven, Capacitive 40

Strukturno modelovanje ponovo Izvršenje: konkurentno (paralelno) Format (Primitive Gates, ugrađeni) slično kao VHDL and G2(Carry, A, B); prvi parametar (Carry) Output Ostali prametri (A, B) Inputs Ožičena logika kašnjenja 41

Ožičena logika 42

Kašnjenja 43

Kašnjenja 44

kašnjenja 45

Gate Delay Specifications 46

Hazardi 47

A Static Hazard Example 48

A Dynamic Hazard Example 49

primer 50

MININIMALNE, TIPIČNE I MAKSIMALNE VREDNOSTI KAŠNJENJA - PRIMERI 51

Dataflow Modelovanje Continuous assignment statement Format: assign [ delay ] net = expression; Example: assign sum = a ^ b; Na ovaj način dajemo vrednost nosiocima podataka tipa net. Sa leve strane može i reg Delay: Time duration between assignment from RHS to LHS All continuous assignment statements execute concurrently Order of the statement does not impact the design Implicitni assign 52

Dataflow Modelovanje Kašnjenje primer: assign #2 sum = a ^ b; #2 znači 2 time-units Ako se ne specificira : 0 (podrazumevano) Associate time-unit with physical time `timescale time-unit/time-precision Example: `timescale 1ns/100 ps Timescale `timescale 1ns/100ps 1 Time unit = 1 ns Time precision is 100ps (0.1 ns) 10.512ns is interpreted as 10.5ns 53

Dataflow Modeling (cont.) Example: `timescale 1ns/100ps module HalfAdder (A, B, Sum, Carry); input A, B; output Sum, Carry; assign #3 Sum = A ^ B; assign #6 Carry = A & B; endmodule 54

Dataflow Modeling (cont.) 55

KAŠNJENJA U IMPLICITNIM DODELAMA 56

ZADAVANJE KAŠNJENJA PRI DEKLARISANJU NOSIOCA PODATKA TIPA net 57

Behavioral Modeling-OPIS NA NIVOU PONAŠANJA 58

Behavioral Modeling Example: module mux_2x1(a, b, sel, out); input a, a, sel; output out; always @(a or b or sel) begin if (sel == 1) out = a; else out = b; end endmodule Sensitivity List 59

Behavioral Modeling-OPIS NA NIVOU PONAŠANJA 60

Procedural Constructs Two Procedural Constructs initial Statement always Statement initial Statement : Executes only once always Statement : Executes in a loop Example: initial begin Sum = 0; Carry = 0; end always @(A or B) begin Sum = A ^ B; Carry = A & B; end 61

PROCEDURA TIPA initial 62

PROCEDURA TIPA initial -PRIMER 63

PROCEDURA TIPA always 64

Behavioral Modeling (cont.) always statement : Sequential Block Sequential Block: All statements within the block are executed sequentially When is it executed? Occurrence of an event in the sensitivity list Event: Change in the logical value Statements with a Sequential Block: Procedural Assignments Delay in Procedural Assignments Inter-Statement Delay Intra-Statement Delay 65

Behavioral Modeling (cont.) Inter-Assignment Delay Example: Sum = A ^ B; #2 Carry = A & B; Delayed execution Intra-Assignment Delay Example: Sum = A ^ B; Carry = #2 A & B; Delayed assignment 66

DODELE U initial I always PROCEDURAMA 67

BLOKIRAJUĆE DODELE 68

BLOKIRAJUĆE DODELE 69

Event Control Event Control Edge Triggered Event Control Level Triggered Event Control Edge Triggered Event Control @ (posedge CLK) //Positive Edge of CLK Curr_State = Next_state; Level Triggered Event Control @ (A or B) //change in values of A or B Out = A & B; 70

Loop Statements Loop Statements Repeat While For Repeat Loop Example: repeat (Count) sum = sum + 5; If condition is a x or z it is treated as 0 71

Loop Statements (cont.) While Loop Example: while (Count < 10) begin sum = sum + 5; Count = Count +1; end If condition is a x or z it is treated as 0 For Loop Example: for (Count = 0; Count < 10; Count = Count + 1) begin sum = sum + 5; end 72

Conditional Statements if Statement Format: if (condition) procedural_statement else if (condition) procedural_statement else procedural_statement Example: if (Clk) Q = 0; else Q = D; 73

Conditional Statements (cont.) Case Statement Example 1: case (X) 2 b00: Y = A + B; 2 b01: Y = A B; 2 b10: Y = A / B; endcase Example 2: case (3 b101 << 2) 3 b100: A = B + C; 4 b0100: A = B C; 5 b10100: A = B / C; //This statement is executed endcase 74

Conditional Statements (cont.) Variants of case Statements: casex and casez casez z is considered as a don t care casex both x and z are considered as don t cares Example: casez (X) 2 b1z: A = B + C; 2 b11: A = B / C; endcase 75

Compiler Directives `define (Similar to #define in C) used to define global parameter Example: `define BUS_WIDTH 16 reg [ `BUS_WIDTH - 1 : 0 ] System_Bus; `undef Removes the previously defined directive Example: `define BUS_WIDTH 16 reg [ `BUS_WIDTH - 1 : 0 ] System_Bus; `undef BUS_WIDTH 76

Compiler Directives (cont.) `include used to include another file Example `include./fulladder.v 77

Display tasks System Tasks $display : Displays the entire list at the time when statement is encountered $monitor : Whenever there is a change in any argument, displays the entire list at end of time step Simulation Control Task $finish : makes the simulator to exit $stop : suspends the simulation Time $time: gives the simulation 78

Type of Port Connections Connection by Position parent_mod 79

Type of Port Connections (cont.) Connection by Name parent_mod 80

Empty Port Connections If an input port of an instantiated module is empty, the port is set to a value of z (high impedance). module child_mod(in1, In2, Out1, Out2) input In1; input In2; output Out1; output Out2; module parent_mod(.) child_mod mod(a,,y1, Y2); //Empty Input endmodule //behavior relating In1 and In2 to Out1 endmodule If an output port of an instantiated module is left empty, the port is considered to be unused. module parent_mod(.) child_mod mod(a, B, Y1, ); //Empty Output endmodule 81

Test Bench `timescale 1ns/100ps module Top; reg PA, PB; wire PSum, PCarry; HalfAdder G1(PA, PB, PSum, PCarry); initial begin: LABEL reg [2:0] i; for (i=0; i<4; i=i+1) begin {PA, PB} = i; #5 $display ( PA=%b PB=%b PSum=%b PCarry=%b, PA, PB, PSum, PCarry); end // for end // initial endmodule Test Bench Apply Inputs Design Module Observe Outputs 82

Test Bench - Generating Stimulus Example: A sequence of values initial begin Clock = 0; #50 Clock = 1; #30 Clock = 0; #20 Clock = 1; end 83

Repetitive Signals (clock) Test Bench - Generating Clock Clock A Simple Solution: wire Clock; assign #10 Clock = ~ Clock Caution: Initial value of Clock (wire data type) = z ~z = x and ~x = x 84

Test Bench - Generating Clock (cont.) Initialize the Clock signal initial begin Clock = 0; end Caution: Clock is of data type wire, cannot be used in an initial statement Solution: reg Clock; initial begin Clock = 0; end always begin #10 Clock = ~ Clock; end forever loop can also be used to generate clock 85