Advanced Digital Design
Advanced Digital Design
An arithmetic right shift fills the left end with repetitions of the most significant bit (i.e. the sign bit). A logic right shift fills the left end with 0s.
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Examples
1) 0xF0 Arithmetic Shift (F0) 11110000 >> 2 11111100 (FC) Logic Shift (F0) 11110000 >> 2 00111100 (3C) 2) 0x5050 Arithmetic Shift (5050) 0101000001010000 >> 4 0000010100000101 Logic Shift Same as above (since the sign bit is 0) 3) 0xBBCC Arithmetic Shift (BBCC) 1011101111001100 >> 4 1111101110111100 Logic Shift (BBCC) 1011101111001100 >> 4 0000101110111100
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Arithmetic shifts are used for signed integer data. For example, assume 8-bit Twos complement encoding, 0xF0 is 16. -16 divides by 4 is equivalent to right shift 16 by 2. The logic shift will give a result of +60 (00111100) rather than 4 (11111100). The repetition of the sign bit in the arithmetic shift enables us to use right shift to perform division by power-of-two.
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Structure of a Computer
Computer = Processing Unit + Memory System
Control
Instruction Rd Rs 5 5 Rt 5 A Rw Ra Rb 32 32-bit Registers 32 B ALU 32 Data Address Data In Clk Data Out Control Signals Conditions
Clk
Clk
32
Datapath
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Clocking methodology
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Adder
32
Adder
32
Sum Carry
32 Select
MUX
A B
32 32
MUX
32
ALU
A 32
OP
ALU
32
Result
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
32
Register
Write Enable:
negated
Two 32-bit output busses: busA and busB One 32-bit input bus: busW
RA (number) selects the register to put on busA (data) RB (number) selects the register to put on busB (data) RW (number) selects the register to be written via busW (data) when Write Enable is 1 The CLK input is a factor ONLY during write operation During read operation, behaves as a combinational logic block:
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Memory (idealized)
Data In 32 Clk
Address selects the word to put on Data Out Write Enable = 1: address selects the memory word to be written via the Data In bus The CLK input is a factor ONLY during write operation During read operation, behaves as a combinational logic block:
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Clocking Methodology
Clk Setup Hold Dont Care Setup Hold
. . .
. . .
. . .
. . .
All storage elements are clocked by the same clock edge Cycle Time = CLK-to-Q + Longest Delay Path + Setup + Clock Skew (CLK-to-Q + Shortest Delay Path - Clock Skew) > Hold Time
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Control Unit
The TheControl ControlUnit, Unit,also alsocalled calledthe theinstruction instructionunit. unit.It Itis is analogous analogousto tothe thebrain brainand andnervous nervoussystem systemin inthe thehuman human body. body. Main Mainparts: parts:Finite-State Finite-StateMachine Machine
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Controller Unit
A control unit decodes and executes instructions and moves data through the system. Control units can be microprogrammed or hardwired. A microprogram is a program written in a low-level language that is implemented by the hardware. Hardwired control units consist of hardware that directly executes machine instructions.
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Standard FSM
State Register Next State Logic Output Logic (datapath control signaling) Plus Additional "Control" Registers: Instruction Register (IR) Program Counter (PC)
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Busing Strategies
Register-to-Register Communications
Point-to-point Single shared bus Multiple special purpose busses
Tradeoffs between datapath/control complexity and amount of parallelism supported by the hardware
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
S0<1:0>
MUX
S1<1:0>
MUX
S2<1:0>
MUX
S3<1:0>
MUX
LD0
R0
LD1
R1
LD2
R2
LD3
R3
Four registers interconnected via 4:1 Mux's and point-to-point connections Edge-triggered N bit registers controlled by LDi signals N x 4:1 MUXes per register, controlled by Si<1:0> signals
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
S<1:0>
LD0
R0
LD1
R1
LD2
R2
LD3
R3
per register MUX block replaced by single block 25% hardware cost of previous alternative shared set of pathways is called a BUS
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Only one register's contents gated to shared bus at a time Preferred over MUXes
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE
Multiple buses
Real datapaths are a compromise between the two extremes
BUS
Register Transfer Diagram or a Single Bus Design: (Highlights the connections between the REGISTERS and the Functional Unit)
M A R
A P C I R A C B
M B R
AC ALU A ("hardwired")
Advanced Digital Design Fall 2004 Lecture 09 Delivered By M. Mohsin Rahmatullah @ CASE