Lecture # 11 University of Tehran

Slides:



Advertisements
Similar presentations
Part 4: combinational devices
Advertisements

ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Encoders.
5.5 Encoders A encoder is a multiple-input, multiple-output logic circuit that converts coded inputs into coded outputs, where the input and output codes.
Give qualifications of instructors: DAP
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Supplement on Verilog adder examples
Modular Combinational Logic
CPEN Digital System Design
Combinational Circuits
Combinational Circuits
Functions and Functional Blocks
RTL Design Introduction Decoder Encoder Multiplexer Tri-state Buffer
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
EELE 367 – Logic Design Module 4 – Combinational Logic Design with VHDL Agenda 1.Decoders/Encoders 2.Multiplexers/Demultiplexers 3.Tri-State Buffers 4.Comparators.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CS 140 Lecture 11 Professor CK Cheng 5/09/02. Part III - Standard Modules Decoder, Encoder, Mux, DeMux, Shifter, Adder, Multiplexer Interconnect: Decoder,
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Digital Fundamentals Floyd Chapter 6 Tenth Edition
Combinational circuits
Multiplexers Lecture L6.6v Section 6.2. Multiplexers A Digital Switch A 2-to-1 MUX A 4-to-1 MUX A Quad 2-to-1 MUX The Verilog if…else Statement TTL Multiplexer.
Lecture # 12 University of Tehran
Logic Gates Combinational Circuits
Encoder Section Outline Review: Sum of Products Encoder Priority Decoder Application of Priority Decoder.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexers.
Outline Decoder Encoder Mux. Decoder Accepts a value and decodes it Output corresponds to value of n inputs Consists of: Inputs (n) Outputs (2 n, numbered.
Digital Logic Design Lecture # 7 University of Tehran.
Adders and Multipliers Review. ARITHMETIC CIRCUITS Is a combinational circuit that performs arithmetic operations, e.g. –Addition –Subtraction –Multiplication.
Digital Electronics.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
1 Digital Logic Design Week 7 Decoders, encoders and multiplexers.
MSI Devices M. Mano & C. Kime: Logic and Computer Design Fundamentals (Chapter 5) Dr. Costas Kyriacou and Dr. Konstantinos Tatas ACOE161 - Digital Logic.
Documentation Standards Circuit specification. –Description of what the system is supposed to do, including a description of all inputs and outputs and.
Combinational Logic By Taweesak Reungpeerakul
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
Digital Logic Design Lecture # 9 University of Tehran.
Morgan Kaufmann Publishers
Functions of Combinational Logic By Taweesak Reungpeerakul
Digital Logic Design Lecture # 21 University of Tehran.
Digital Logic Design Lecture # 19 University of Tehran.
Digital Logic Design Lecture # 14 University of Tehran.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Outline MSI Parts as a Decoder Multiplexer Three State Buffer MSI Parts as a Multiplexer Realization of Switching Functions Using Multiplexers.
ALU & CPU Computer Architecture. Introducing ALU ALU: Arithmetic & Logic Unit –Performs arithmetic operations Addition Subtraction –Performs logic operations.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Digital Logic Design Lecture # 15 University of Tehran.
Digital Logic Design Lecture # 6 University of Tehran.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
Lecture # 10 University of Tehran
MSI Combinational logic circuits
Digital Design Lecture 8 Combinatorial Logic (Continued)
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
ACOE161 (Spring2007)MSI Devices1 Revision on MSI Devices M. Mano & C. Kime: Logic and Computer Design Fundamentals (Chapter 5)
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Combinational Circuit Design
Digital Fundamentals Floyd Chapter 6 Tenth Edition
FUNCTION OF COMBINATIONAL LOGIC CIRCUIT
Chapter 6 Functions of Combinational Logic
Behavioral Modeling in Verilog
Combinatorial Logic Design Practices
OUTLINE Introduction Basics of the Verilog Language
FIGURE 4.1 Block diagram of combinational circuit
Lecture 8 Logistics Last lecture Last last lecture Today
Multiplexers Anindya IE CSE.
Lecture 9 Logistics Last lecture Last last lecture Today
Hasibul Hasan Ankit Baingane Edward Hanson
ECE 331 – Digital System Design
Electronics for Physicists
Digital System Design Combinational Logic
COE 202 Introduction to Verilog
Presentation transcript:

Lecture # 11 University of Tehran Digital Logic Design Lecture # 11 University of Tehran

Outline Encoder Verilog

Encoder We talked about using a decoder to decode a coded number, obviously there has to also be a way of encoding data as well.

Encoder (continued…)

Encoder (continued…) As you can see in the last example of a binary encoder we have only paid attention to 5 of the 16 possible inputs, them being: I3 0 0 0 0 1 I2 0 0 0 1 0 I1 0 0 1 0 0 I0 0 1 0 0 0 Even this state has been set don’t care in our KM.

Encoder (continued…) Using the KM shown in the latter slides or simply considering the fact that y0 is active when either I1 or I3 is active and a similar observation for y1 we have:

Encoder (continued…) An encoder can find other uses as well. For instance consider a stage in a CPU’s working time when two interrupts are sent to it at the same time. One asking for the process of a key press event and the other pointing to a power failure. Obviously in such a situation the first need not be processed because the second interrupt indicates a very severe problem (specially in OSs like Linux).

Encoder (continued…) Now if in a specific problem such as what mentioned in the last slide, there does actually occur a time when two or more of the inputs are active, we will be using a priority encoder. In such a case the input line with the higher number is chosen to be of higher priority. This means that for instance if we choose X3 as a power failure interrupt line, no other interrupt request will ever surpass it through priority.

Encoder (continued…) To design this priority encoder, consider the following truth table and KMs:

Encoder (continued…)

Encoder (continued…) Note: When we use the shown encoder as an interrupt handler, GS becomes active when one of the interrupt lines become active, and the interrupt number is given to the CPU through y1y0. The GS output is in fact a path through which the interrupt handler can inform the CPU of the occurrence of an interrupt request somewhere in the system.

Encoder (continued…) Now let’s see a standard encoder package 74148 which is an 8-to-3 encoder:

Encoder (continued…) In the package 74148, the EO output (Enable Output) will be active when none of the input lines are active (simply put there to use the extra left out pin of our IC).

Encoder (continued…) The following figure shows how we can cascade two 4-to-2 encoders:

Verilog In this session we want to see how to bring our level of description higher than switch level and gate level to data flow description. Example: module MyAnd(a, b, z); input a, b; output z; assign #5 z=a&b; endmodule Other logic operators can also be used in continuous assignments such as: assign z=(a&b)|(a^b)

Verilog (continued…) The following is a code for a 4 bit adder module: module adder(a, b, z); input [3:0] a, b; output [3:0] z; assign z=a+b; endmodule

Verilog (continued…) Let’s now write a test bench for the above adder: module test_adder(); reg [3:0] aa, bb; wire [3:0] zz; adder u(aa, bb, zz); initial begin aa=4; bb=6; #10; end endmodule

Verilog (continued…) The following code shows how we can work with a part of our bus: module function(a, b, z); input [3:0] a, b; output [3:0] z; assign z=a+b; assign z[3]=a[3]^b[3]; endmodule

Verilog (continued…) Example: module adder(a, b, cin, s, cout); input [3:0] a, b; input cin; output [3:0] s; output cout; assign {cout, s}=a+b+cin; endmodule The statement {cout, s}=a+b+cin; shows concatenation of s and cout, cout being MSB and s LSB.

Verilog (continued…) Let’s take a look at some examples: A 4 bit And module: module And4bit(a, b, z); input [3:0] a, b; output [3:0] z; assign z=a&b; endmodule

Verilog (continued…) A comparator: module comparator(a, b, gt, eq, lt); input [3:0] a, b; output gt, eq, lt; assign gt=(a>b); assign lt=(a<b); assign eq=(a==b); endmodule

Verilog (continued…) 16 bit 2-to-1 multiplexer: module MUX2to1(s, a, b, z); input [15:0] a, b; input s; output [15:0] z; assign z=(s==1)?a:b; endmodule

Verilog (continued…) 4 bit 4-to-1 multiplexer: module MUX4to1(s, a, b, c, d, z); input [1:0] s; input [3:0] a, b, c, d; output [3:0] z; assign z=(s[1]==1)?((s[0]==0)?a:b):((s[0]==0)?c:d) endmodule

Verilog (continued…) Note: As we saw before we have concurrency of statements in Verilog. This concurrency is also true about assign statements, for instance the following two assign statements resemble the circuit in the figure: assign z=~a&b; assign y=z^b;