Designing Digital Circuits Using Hardware Description Languages (HDLs)

Slides:



Advertisements
Similar presentations
2’s Complement 4-Bit Saturator
Advertisements

Modulo-N Counters Module M10.4 Section 7.2.
Encoders Module M9.3 Section 6.3. Encoders Priority Encoders TTL Encoders.
Supplement on Verilog adder examples
Shift Registers Module M11.1 Section 7.3.
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
7-Segment Displays Lecture L6.1 Section 6.3. Turning on an LED.
CPEN Digital System Design
LED Display. LED Typical LED forward bias voltage: 1.5 to 2.0 V Typical currents needed to light LED range from 2 to 15 mA.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
Binary Counters Module M10.3 Section 7.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
7-Segment Displays Lecture L6.7 Section 6.5. Turning on an LED.
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp
Top-level VHDL Designs
Using State Machines as Control Circuits Lecture L9.4.
Multiplier Lecture L7.3 Section 10.4 (p.276) Section 7.3 (Handout)
Multiplexers Lecture L6.4 Section 6.4.
Subtractors Module M8.2 Section 6.2. Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2.
Datapaths Lecture L10.2 Sections 10.2, ALU (Sect. 7.5 and Lab 6)
Arbitrary Waveforms Lecture L8.5 Section 7.2. CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s3 0 1.
Counters as State Machines Lecture L9.1 Handout Section 9.1.
Equality Detector Lecture L6.1 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Flip-Flops Module M10.2 Section 7.1. D Latch Q !Q CLK D !S !R S R X 0 Q 0 !Q 0 D CLK Q !Q Note that Q follows D when the clock in high, and.
Binary Counters Lecture L8.3 Section 8.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
Shifter Lecture L7.4 Group HW #4 Section 10.3.
Modulo-N Counters Lecture L8.4 Section 7.2. Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter.
Codes and Code Converters
Code Converters Module M7.1 Section 6.5. Code Converters Binary-to-BCD Converters ABEL TRUTH_TABLE Command.
LEDs 7-Segment Displays
Pulse-Width Modulated DAC Lecture 11.3 Section 11.5.
Multiplexers Module M6.1 Section 6.4. Multiplexers A 4-to-1 MUX TTL Multiplexer A 2-to-1 MUX.
Shifters Lecture L7.4 Section 7.4. MODULE shift TITLE 'shifter' DECLARATIONS " INPUT PINS " D3..D0 PIN 11,7,6,5; D = [D3..D0]; s2..s0 PIN 3,2,1; S.
Flip-Flops Lecture L8.2 Section 8.1. Recall the !S-!R Latch !S !R Q !Q !S !R Q !Q X Y nand 1 0 Set 1 0.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Arithmetic Logic Unit (ALU) Lecture L9.3 Lab 10. ALU CB = carry_borrow flag Z = zero flag (Z = 1 if Y = 0)
Equality Detector Lecture L6.3 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
7-Segment Displays Module M7.2 Section 6.5. Turning on an LED Common Anode.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 2 FPGAs & Verilog.
Introduction to Verilog Multiplexers. Introduction to Verilog Verilog Hardware Description Language (Verilog HDL) released by Gateway Design Automation.
Top-level Verilog Designs Discussion D9.1 Example 12.
Digital Logic Review Discussion D8.7.
7-Segment Display DIO1 Board Verilog.
Figure 1.1 The Altera UP 3 FPGA Development board
Encoder Section Outline Review: Sum of Products Encoder Priority Decoder Application of Priority Decoder.
The miniDragon+ Board and CodeWarrior Lecture L2.1.
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
Verilog HDL: A solution for Everybody By, Anil Kumar Ram Rakhyani
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.
Reaction Timer Project
A Greatest Common Divisor (GCD) Processor Lecture L10.3 Sections 10.4, 10.5.
Introduction to Combinational Verilog EECS270 rev 9/25/12.
– 1 – CSCE 211H Fall 2015 Lecture 5 Combinational Components Topics Products-of-Sums Form examples 5 variable and larger Karnaugh Maps Components: Decoders,
– 1 – CSCE 211H Fall 2015 Lecture 5 Combinational Components Topics Products-of-Sums Form examples 5 variable and larger Karnaugh Maps Components: Decoders,
LAB #5 Modular Design and Hierarchy using VHDL
Designing Combinational Logic Circuits in Verilog - 1
Lottery Speaker: Tsung-Yi Wu.
Discussion 2: More to discuss
Display Devices 7 segment led display.
Verilog-HDL-3 by Dr. Amin Danial Asham.
Topics The logic design process..
Counters as State Machines
Logic Design Review – 2 Basic Combinational Circuits
Discussion D8.1 Kerns & Irwin Sections , 10-10
Lecture 1.3 Hardware Description Languages (HDLs)
Analog-to-Digital Converters
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
Combinational Circuit Design
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Designing Digital Circuits Using Hardware Description Languages (HDLs) Lecture 4.5

Hardware Description Languages ABEL Verilog VHDL We will only cover ABEL and Verilog VHDL is taught in CSE 378

Designing a Digital Circuit

Advanced Boolean Expression Language ABEL Advanced Boolean Expression Language An Example

ABEL The source file gates.abl

Verilog

Verilog source code gates.v module gates(x,y,invx,invy,andd,orr,nandd,norr,xorr,xnorr); input x; input y; output invx; output invy; output andd; output orr; output nandd; output norr; output xorr; output xnorr; assign invx = ~x; assign invy = ~y; assign andd = x & y; assign orr = x | y; assign nandd = ~(x & y); assign norr = ~(x | y); assign xorr = x ^ y; assign xnorr = x ~^ y; endmodule

Pin numbers set it separate file: gates.ucf NET "x" LOC = "p11"; NET "y" LOC = "p7"; NET "invx" LOC = "p35"; NET "invy" LOC = "p36"; NET "andd" LOC = "p37"; NET "nandd" LOC = "p39"; NET "orr" LOC = "p40"; NET "norr" LOC = "p41"; NET "xorr" LOC = "p43"; NET "xnorr" LOC = "p44";

7-Segment Displays ABEL Verilog

Covalent bonds -- Insulator http://electronics.howstuffworks.com/diode1.htm

Semiconductors Adding a very small amount of B or Ga to Si makes a p-type semi-conductor with a missing electron (a hole) Adding a very small amount of P or As to Si makes an n-type semi-conductor with an extra electron

Diodes + - http://www.mtmi.vu.lt/pfk/funkc_dariniai/diod/index.html

Turning on an LED

Turning on an LED This is what we use in Lab

7-Segment Display

7-Segment Display a b c d e f g 0 1 1 1 1 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 0 0 2 1 1 0 1 1 0 1 3 1 1 1 1 0 0 1 4 0 1 1 0 0 1 1 5 1 0 1 1 0 1 1 6 1 0 1 1 1 1 1 7 1 1 1 0 0 0 0

7-Segment Display a b c d e f g 8 1 1 1 1 1 1 1 9 1 1 1 1 0 1 1 8 1 1 1 1 1 1 1 9 1 1 1 1 0 1 1 A 1 1 1 0 1 1 1 b 0 0 1 1 1 1 1 C 1 0 0 1 1 1 0 d 0 1 1 1 1 0 1 E 1 0 0 1 1 1 1 F 1 0 0 0 1 1 1

hex7seg.abl Makes this module available in higher-level modules MODULE hex7seg INTERFACE ([D3..D0] -> [a,b,c,d,e,f,g]); TITLE 'hex to seven segment display decoder' " a " --- hex-to-seven-segment decoder " f| g |b " --- " e| d |c DECLARATIONS   " Input Pins " D3..D0 PIN; D = [D3..D0]; " 4-bit input vector " Output Pins " [a,b,c,d,e,f,g] PIN ISTYPE 'com'; " 7-segment LED display segs = [a,b,c,d,e,f,g];

HEX ON,OFF = 1,0; " for common cathode LEDs @radix 16; EQUATIONS "[ a , b , c , d , e , f , g ] when (D == 0) then segs = [ ON, ON, ON, ON, ON, ON, OFF]; when (D == 1) then segs = [OFF, ON, ON, OFF,OFF,OFF,OFF]; when (D == 2) then segs = [ ON, ON, OFF,ON, ON, OFF, ON]; when (D == 3) then segs = [ ON, ON, ON, ON, OFF,OFF, ON]; when (D == 4) then segs = [OFF, ON, ON, OFF,OFF,ON, ON]; when (D == 5) then segs = [ ON, OFF,ON, ON, OFF,ON, ON]; when (D == 6) then segs = [ ON, OFF,ON, ON, ON, ON, ON]; when (D == 7) then segs = [ ON, ON, ON, OFF,OFF,OFF,OFF]; when (D == 8) then segs = [ ON, ON, ON, ON, ON, ON, ON]; when (D == 9) then segs = [ ON, ON, ON, ON, OFF,ON, ON]; when (D == 0A) then segs = [ ON, ON, ON, OFF,ON, ON, ON]; when (D == 0B) then segs = [OFF, OFF,ON, ON, ON, ON, ON]; when (D == 0C) then segs = [ ON, OFF,OFF,ON, ON, ON, OFF]; when (D == 0D) then segs = [OFF, ON, ON, ON, ON, OFF, ON]; when (D == 0E) then segs = [ ON, OFF,OFF,ON, ON, ON, ON]; when (D == 0F) then segs = [ ON, OFF,OFF,OFF,ON, ON, ON]; END hex7seg HEX

main7seg.abl

MODULE SW7seg TITLE 'Switch hex code to 7-segment display' DECLARATIONS hex7seg interface([D3..D0] -> [a,b,c,d,e,f,g]); d7L FUNCTIONAL_BLOCK hex7seg; d7R FUNCTIONAL_BLOCK hex7seg; " INPUT PINS " SW7..SW0 PIN 11,7,6,5,4,3,2,1; " 8 toggle switches SW = [SW7..SW0];

" OUTPUT PINS " LEDR7..LEDR0 PIN 35,36,37,39,40,41,43,44 ISTYPE 'com'; LEDR = [LEDR7..LEDR0]; " Red LEDs [aa,bb,cc,dd,ee,ff,gg] PIN 57,58,61,62,63,65,66 ISTYPE 'com'; "Leftmost (tens) 7-segment LED display [a,b,c,d,e,f,g] PIN 15,18,23,21,19,14,17 ISTYPE 'com'; " Rightmost (units) 7-segment LED display

EQUATIONS LEDR = SW; [aa,bb,cc,dd,ee,ff,gg] = d7L.[a,b,c,d,e,f,g]; d7L.[D3..D0] = [SW7..SW4]; [a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g]; d7R.[D3..D0] = [SW3..SW0]; END SW7seg

Verilog hex7seg.v a f b g e c d module hex7seg(D,AtoG); input [3:0] D; output [6:0] AtoG; reg [6:0] AtoG; always @(D) case(D) 0: AtoG = 7'b1111110; 1: AtoG = 7'b0110000; 2: AtoG = 7'b1101101; 3: AtoG = 7'b1111001; 4: AtoG = 7'b0110011; 5: AtoG = 7'b1011011; 6: AtoG = 7'b1011111; 7: AtoG = 7'b1110000; 8: AtoG = 7'b1111111; 9: AtoG = 7'b1111011; 'hA: AtoG = 7'b1110111; 'hb: AtoG = 7'b0011111; 'hC: AtoG = 7'b1001110; 'hd: AtoG = 7'b0111101; 'hE: AtoG = 7'b1001111; 'hF: AtoG = 7'b1000111; default: AtoG = 7'b1111110; // 0 endcase endmodule hex7seg.v Verilog a b c d e f g

SW7seg.v Verilog AAtoGG AtoG // Title : Toggle switches to 7-Segment Display // Author : R. E. Haskell module SW7seg(SW,LEDR,AtoG,AAtoGG); input [7:0] SW; output [7:0]LEDR; output [6:0] AtoG; output [6:0] AAtoGG; wire [6:0] AtoG; wire [6:0] AAtoGG; wire [7:0] LEDR; assign LEDR = SW; hex7seg d7L(.D(SW[7:4]),.AtoG(AAtoGG)); hex7seg d7R(.D(SW[3:0]),.AtoG(AtoG)); endmodule AAtoGG AtoG

SW7seg.ucf #PACE: Start of PACE I/O Pin Assignments NET "AAtoGG<0>" LOC = "p66" ; NET "AAtoGG<1>" LOC = "p65" ; NET "AAtoGG<2>" LOC = "p63" ; NET "AAtoGG<3>" LOC = "p62" ; NET "AAtoGG<4>" LOC = "p61" ; NET "AAtoGG<5>" LOC = "p58" ; NET "AAtoGG<6>" LOC = "p57" ; NET "AtoG<0>" LOC = "p17" ; NET "AtoG<1>" LOC = "p14" ; NET "AtoG<2>" LOC = "p19" ; NET "AtoG<3>" LOC = "p21" ; NET "AtoG<4>" LOC = "p23" ; NET "AtoG<5>" LOC = "p18" ; NET "AtoG<6>" LOC = "p15" ; NET "LEDR<0>" LOC = "p44" ; NET "LEDR<1>" LOC = "p43" ; NET "LEDR<2>" LOC = "p41" ; NET "LEDR<3>" LOC = "p40" ; NET "LEDR<4>" LOC = "p39" ; NET "LEDR<5>" LOC = "p37" ; NET "LEDR<7>" LOC = "p35" ; NET "SW<0>" LOC = "p1" ; NET "SW<1>" LOC = "p2" ; NET "SW<2>" LOC = "p3" ; NET "SW<3>" LOC = "p4" ; NET "SW<4>" LOC = "p5" ; NET "SW<5>" LOC = "p6" ; NET "SW<6>" LOC = "p7" ; NET "SW<7>" LOC = "p11" ; SW7seg.ucf

Wiring up the top-level design ABEL [aa,bb,cc,dd,ee,ff,gg] = d7L.[a,b,c,d,e,f,g]; d7L.[D3..D0] = [SW7..SW4]; [a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g]; d7R.[D3..D0] = [SW3..SW0]; AAtoGG AtoG Verilog hex7seg d7L(.D(SW[7:4]),.AtoG(AAtoGG)); hex7seg d7R(.D(SW[3:0]),.AtoG(AtoG));