Beruflich Dokumente
Kultur Dokumente
CIT 595 2
1
1 Bit Addition Unit (Full Adder) 1 Bit Addition Unit (Full Adder) contd..
Sum =
NOTE:
Carry Out =
Two half adders make a full adder 16-bit Ripple Carry Adder
C0 is assumed to be 0
CIT 595 7 CIT 595 8
2
Multiplexer 2-to-1 MUX
x1 x1
Output is determined by the x1 x2
value of the multiplexer’s x2 x2
control lines (a.k.a selector)
This is a block
To be able to select among n diagram for a
What is the logic behind selection?
inputs, log2n control lines are multiplexer
needed
2 to 1 MUX Subtraction
s x1 x2 F(s,x1,x2) The adder logic circuit seen before does only addition
0 0 0 0
Recall that X – Y = X + (-Y)
■ We find 1’s complement of Y and add 1 to get
0 0 1 0
negative
ti value
l off Y ii.e. –Y
Y
0 1 0 1 ■ Then we add X and -Y
0 1 1 1
1 0 0 0 01101000 (104) 11110110 (-10)
1 0 1 1 -00010000(16) -11110111 (-9)
1 1 0 0 s’x1
’ 1 + sx2
2
01101000 (104) 11110110 (-10)
1 1 1 1
+11110000(-16) +00001001 (9)
01011000 (88) 11111111 (-1)
CIT 595 11 CIT 595 12
3
Implementing Subtraction Logic in 1 Bit Adder Unit Modification to the 1 Bit Adder
(w/ Subtraction)
Let Y be the 2nd input
We need both the Y and Y complement (Y’) S
4
Bit Shifter Creating Logic for 2-bit Shifter
Lets see the design of an unsigned 2-bit shifter O1 O0
D1D0
D1D0
S 00 01 11 10 S 00 01 11 10
To determine 1-bit shift to left or right 0 0 1 1 0 0 0 0 0 0
Inputs Outputs
S D1 D0 O1 O0 1 0 0 0 0 1 0 0 1 1
Assume th
A thatt this
thi ddecided
id d b
by control
t l
0 0 0 0 0 O1 = O0 = SD1
variable/signal input called S
0 0 1 1 0
■ If S = 0, then we do 1 bit left shift 0 1 0 0 0
■ Else, we do 1 bit right shift 0 1 1 1 0
1 0 0 0 0
Lets say the input is 2-bit value D(D1, D0) where 1 0 1 0 0
D1 is the most significant bit(MSB) 1 1 0 0 1
Logic
1 1 1 0 1 circuit
Lets call the output of the shift be O(O1, O0) diagram
5
Address Decoder Example 2-to-4 Decoder Logic
A binary number with 2 bits as its input
Selects exactly 1 of 4 outputs
At any time, only 1 output line is “ON'' or “1” and all others
n-bit Address Read/
Write are “OFF” or “0” (referred to as one-hot encoded)
2n Memory
locations Array
Decoder
(2n x m)
m bits (data)
Example:
■ In Interrupt Driven I/O - need to determine higher
priority among devices who interrupted at the same
time
■ Priority encoder circuit determines which interrupt
request should be serviced by the processor
¾ In priority encoder each input has a priority level associated
with it
¾ The encoder outputs indicate active input that has the
highest priority
CIT 595 23 CIT 595 24
6
Example: 4:2 Priority Encoder Code Converters
We may not want to use its output all the The value of control lines
time determine
dete e which
c ope
operation:
at o
■ Same inputs are shared amongst different ■ 00 – A + B (Addition)
logic units
■ 01 – NOT A
■ Some how we only want to make one unit
active and disable all others ■ 10 – A OR B
■ 11 – A AND B
Hence we want some sort of control to
temporarily disable the circuit and only Similarly a N-Bit ALU can
enable it if the control is set Who decides value be made
of EN?
Basic gates allow us to achieve this: All sub units form their
■ AND gate - Figure a. EN = 1, F = X operation, but final output is
■ OR gate - Figure b. ~EN = 0, F = X chosen only if enabled (EN = 1).
Example on the next slide
Here EN is decided by the
decoder logic.
CIT 595 27 CIT 595 28
7
2-Bit ALU 8-bit ALU made from eight “bit slices”
Cin
8
Carry Look Ahead Programmable Logic Array (PLA)
A digit of addition will carry: A PLA is a prepackaged circuit
that can be tailored to suit
various needs
Note that carry C1, C2, C3 are
calculated at the same time
Any truth table can be
represented by some AND gates
feeding into an OR gate
■ Sum Of Product form
9
Hardware Descriptive Languages E.g. Verilog code
Language to describe the circuit's operation, its 2-input (32-bit) mux ???
design and organization, and tests to verify its module circuit_1 (q, a, b)
operation by means of simulation module Mux_2_32(mux_out, data_1, output q;
data 0 select);
data_0, i
input t a, b
b;
always@(a or b)
A simulation program, designed to implement parameter word_size = 32 begin
output [word_size – 1: 0] mux_out; if(a == 1’b1)
the underlying semantics of the language
input [word_size – 1: 0] data_1, data_0; q = b;
statements, coupled with simulating the progress Input select; else
of time provides the hardware designer with the q=1 1’b0;
b0;
ability to model a piece of hardware before it is assign mux_out = select ? data_1: data_0; end
created physically endmodule
endmodule
10