//HDL Example 3-3 // //Stimulus for simple circuit module stimcrct; reg A,B,C; wire x,y; circuit_with_delay swd(A,B,C,x,y);

Slides:



Advertisements
Similar presentations
//HDL Example 8-2 // //RTL description of design example (Fig.8-9) module Example_RTL (S,CLK,Clr,E,F,A);
Advertisements

Counters Discussion D8.3.
Verilog in transistor level using Microwind
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
ECE 551 Digital Design And Synthesis
Verilog Modules for Common Digital Functions
Verilog Intro: Part 1.
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
FSM examples.
Edge-Triggered D Flip-Flops

Pulse-Width Modulated DAC
Conditional Statements  if and else if statements if (expression) if (expression) statements statements { else if (expression) { else if (expression)
First Steps in Verilog CPSC 321 Computer Architecture Andreas Klappenecker.
DON’T CARE CONDITIONS Functions that have unspecified output for some input combinations are called incompletely specified functions. Unspecified minterms.
NDG-L38Introduction to ASIC Design1 Design of a Simple Customizable Microprocessor * Chapter 7 and 15, “Digital System Design and Prototyping”  SIMP.
Verilog Module Module declaration Module instantiation module Add_full (sum, c_out, a, b, c_in); // parent module input a, b, c_in; output c_out, sum;
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
Ring Counter Discussion 11.3 Example 32.
Arbitrary Waveform Discussion 12.2 Example 34. Recall Divide-by-8 Counter Use q2, q1, q0 as inputs to a combinational circuit to produce an arbitrary.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
CS 61C Discussion 10 (1) Jaein Jeong Fall input MUX °Out = in0 * select’ + in1 * select in0in1selectout
Hardware Description Language HDL. 2 Hardware Description Language HDL  Describes circuits and systems in text. −As a software program.  Can be processed.
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Design example Binary Multiplier.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Registers and Shift Registers Discussion D8.2. D Flip-Flop X 0 Q 0 ~Q 0 D CLK Q ~Q D gets latched to Q on the rising edge of the clock. Positive.
D Flip-Flops in Verilog Discussion 10.3 Example 27.
Mantıksal Tasarım – BBM231 M. Önder Efe
ECE 551 Digital System Design & Synthesis Lecture 11 Verilog Design for Synthesis.
Figure 7.1. Control of an alarm system. Memory element Alarm Sensor Reset Set OnOff 
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
CORRECTION Last session, I have made a mistake about two digital coding methods. I explained Hamming code as Grey code mistakenly. Here is correct explanation.
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
CENG 241 Digital Design 1 Lecture 5 Amirali Baniasadi
B10010 Behavioral Verilog ENGR xD52 Eric VanWyk Fall 2012.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Traffic Lights Discussion D8.3a. Recall Divide-by-8 Counter Use Q2, Q1, Q0 as inputs to a combinational circuit to produce an arbitrary waveform. s0 0.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Under-Graduate Project Logic Design with Behavioral Models Speaker: Darcy Tsai Adviser:
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
The Verilog Hardware Description Language. GUIDELINES How to write HDL code: How to write HDL code:
February 6, 2009http://csg.csail.mit.edu/6.375/L02-1 Verilog 1 - Fundamentals Complex Digital Systems Arvind February 6, 2009 FA module adder( input.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.
Digital Electronics.
HDL Model Combinational circuits. module halfadder(s, cout, a, b); input a, b; output s, cout; xor g1(s, a, b); and g2(cout, a, b); endmodule.
 A test bench is an HDL program used for applying stimulus to an HDL design in order to test it and observe its response during simulation.  In addition.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 12 - Introduction.
Introduction to Verilog
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Logic Design with Behavioral Models Speaker: 銀子駒 Adviser:
Figure Implementation of an FSM in a CPLD..
Supplement on Verilog FF circuit examples
Verilog Modules for Common Digital Functions
HDL for Sequential Circuits
Supplement on Verilog Sequential circuit examples: FSM
Pulse-Width Modulation (PWM)
Verilog.
فصل چهارم مدارهای ترکیبی.
مدار منطقی به نام یگانه مهندس هستی مهدی قدیری
6. Registers and Counters
Supplement on Verilog Sequential circuit examples: FSM
The Verilog Hardware Description Language
//HDL Example 7-1 // //Read and write operations of memory. //Memory size is 64 words of 4 bits each. module.
Presentation transcript:

//HDL Example 3-3 //---------------------- //Stimulus for simple circuit module stimcrct; reg A,B,C; wire x,y; circuit_with_delay swd(A,B,C,x,y); initial begin A = 1'b0; B = 1'b0; C = 1'b0; #100 A = 1'b1; B = 1'b1; C = 1'b1; #100 $finish; end endmodule //Description of circuit with delay module circuit_with_delay (A,B,C,x,y); input A,B,C; output x,y; wire e; and #(30) g1(e,A,B); or #(20) g3(x,e,y); not #(10) g2(y,C);

//HDL Example 4-10 //------------------------------------------ //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input A,B,C; output F1,F2; wire T1,T2,T3,F2not,E1,E2,E3; or g1 (T1,A,B,C); and g2 (T2,A,B,C); and g3 (E1,A,B); and g4 (E2,A,C); and g5 (E3,B,C); or g6 (F2,E1,E2,E3); not g7 (F2not,F2); and g8 (T3,T1,F2not); or g9 (F1,T2,T3); endmodule //Stimulus to analyze the circuit module test_circuit; reg [2:0]D; wire F1,F2; analysis fig42(D[2],D[1],D[0],F1,F2); initial begin D = 3'b000; repeat(7) #10 D = D + 1'b1; end $monitor ("ABC = %b F1 = %b F2 =%b ",D, F1, F2);

//Solution to supplement Experiment 7(a) //BEHAVIORAL DESCRIPTION OF 7483 4-BIT ADDER. module _7483(Sum,A,B,Cin,Cout); input [3:0] A,B; input Cin; output [3:0] Sum; output Cout; reg [3:0] Sum; reg Cout; always @(A or B or Cin) {Cout,Sum} = A + B + Cin; endmodule

//Solution to supplement Experiment 8(a) //Behavioral description of 7474 D flip-flop module _7474 (Q,D,CLK,preset,clear); output Q; input D,CLK,preset,clear; reg Q; always @ (posedge CLK or negedge preset or negedge clear) if (~preset) Q = 1'b1; else if (~clear) Q = 1'b0; else Q = D; endmodule

//Solution to supplement Experiment 10 //Behavioral description of 74161 //P and T are treated as a single enable input "Count". module _74161(Data_in,Q,Co, Load, Count, CLK, Clr); input Load, Count, CLK, Clr; input [3:0] Data_in; output [3:0] Q; output Co; reg [3:0] Q; wire Co; //Co=1 when Q is all 1's AND count is enabled. assign Co = (&Q) & Count; always @(negedge Clr or posedge CLK) if (~Clr) Q = 0; else if (~Load) Q = Data_in; else if (Count) Q = Q + 4'b1; else Q = Q; endmodule

//Solution to supplement Experiment 11(b) //Behavioral description of 74157 MUX (Fig. 11-17). module _74157(Y,A,B,Sel,Str); input [1:4] A,B; input Sel,Str; output [1:4] Y; reg [1:4] Y; always @(A or B or Sel or Str) if (Str==1) Y = 4'b0; else if (Sel==0) Y = A; else Y = B; endmodule

//Solution to supplement experiment 13(a) //HDL description of 74189 16x4 RAM. module _74189 (DataIn, DataOut, Addr, CS, WE); input [3:0] DataIn, Addr; input CS, WE; // CS and WE active-low. output [3:0] DataOut; //Hi-Z during write or if memory disabled. tri [3:0] DataOut; //Three-state output. reg [3:0] Ram [0:15]; //16 x 4 memeory. assign DataOut = (~CS && WE) ? ~Ram[Addr] : 4'bz; always @(CS or WE or DataIn or Addr) if (~CS && ~WE) Ram[Addr] = DataIn; endmodule

//Solution to supplement Experiment 14 //DESCRIPTION Of 74194 SHIFT-REGISTER (Fig. 11-19) module _74194(Q, DataIn, SIR, SIL, S1, S0, Clk, Clr); input SIR, SIL, S1, S0, Clk, Clr; //Clr is async active-low. input [1:4] DataIn;// 1,2,3,4 => A,B,C,D in Fig.11-19 output [1:4] Q; reg [1:4] Q; wire S1, S0; parameter NoChange = 2'b00, Shr = 2'b01, Shl = 2'b10, Ld = 2'b11; always @(posedge Clk or negedge Clr) if (~Clr) Q = 0; else case ({S1,S0}) NoChange: Q = Q; Shr: Q = {SIR,Q[1:3]}; Shl: Q = {Q[2:4],SIL}; Ld: Q = DataIn; endcase endmodule