Computer Organization Lecture 6 - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Computer Organization Lecture 6

Description:

J-type machine instructions ... actual CPU memory address, 32-bits I-type ea ... Major Computer Components Five classic computer components Computer Components ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 31
Provided by: SigL6
Category:

less

Transcript and Presenter's Notes

Title: Computer Organization Lecture 6


1
Computer OrganizationLecture 6
  • J-type machine instructions
  • ALU design
  • Project 2 overview

2
Want to run MIPS programs?
  • Go to my CS374 website, Reference page
  • Download the MIPS simulator to
  • p\mips directory, important step!
  • Create your program with Notepad
  • Drag file.asm to mips.batch icon

3
Last time
  • MIPS loops
  • Assembly vs. machine instructions
  • Machine instruction formats
  • R-type
  • I-type
  • J-type

4
Machine Instructions
  • Definition numeric (hex) versions of instruction
  • Memory contains binary number or machine
    instruction, its what the hardware executes
  • Formats
  • R, register
  • I, immediate
  • J, jump

NOTE Result of assembly is a machine instruction
5
Instruction Formats
Name Fields Fields Fields Fields Fields Fields
Size 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
R type op rs rt rd shamt funct
I type op rs rt address/immediate address/immediate address/immediate
J type op target address target address target address target address target address
32-bits
All instructions are 32-bits long
6
J-format
  • Op code examples PC gets new value
  • j 0x02, jal 0x03
  • Target address (whats embedded in instruction)
  • Bits 25-0 target address, word aligned, two
    ending zeros not saved but implied
  • Upper 4 bits of PC not changed
  • Effective address concatenation of PC31-28 and
    target 25-0 and 00 always word aligned

7
Addresses reviewed
  • Immediate lower 16 bits from I-type instruction,
    sign extended
  • Target lower 26 bits from J-type instruction
  • Word aligned bits 0 1 are zero
  • Effective actual CPU memory address, 32-bits
  • I-type ea c(rx), sum of rx constant/immed
  • J-type ea pc31pc28 target25target0 00

8
Range of jump instruction
Memory
0
26
25
31
jumps limited to this area in memory
PC
9
Jump effective address (ea)
  • Assume PC 0x 1040 0000
  • Target address 0x 065 4321

ea pc31pc28 target25target0 00 0001
00 0110 0101 0100 0011 0010 0001 00 ea 0x
1195 0c84
Implied
Instruction target field
From PC
10
J-format example
Assume pc31pc280
j loop loop 0x 42 1000
Name Fields Fields
Size 6 bits 26 bits
J type 00 0010 00 0001 0000 1000 0100 0000 0000
ea 0x 42 1000 0100 0010 0001 0000 0000 0000
target 0000 0100 0010 0001 0000 0000 00
11
Find machine instruction?
Assume pc31pc280
j end end 0x 4f 612c
Name Fields Fields
Size 6 bits 26 bits
J type 00 0010 00 0001 0011 1101 1000 0100 1011
0x 4f 612c 0100 1111 0110 0001 0010 1100
target 00000100111101100001001011
inst 0x 0813 d84b
12
Major Computer Components
  • Five classic computer components

13
Computer Components
  • Input receives information from external world
  • Output transmits information to external world
  • Memory holds programs and data
  • Data path physical route that carries info
  • Control coordinates overall flow of info

14
MIPS datapath overview
  • Instruction read from memory
  • Registers selected for operation
  • ALU performs function
  • Result written to register

15
ALU overview
  • ALU arithmetic and logic unit
  • Inputs
  • Two operands a, b
  • Control operation to perform
  • Outputs
  • Result c a ltopgt b
  • Misc. zero, overflow, etc.

16
ALU design
  • Each bit requires a separate circuit
  • Entirely combinational logic sop or pos
  • Often many gate delays

17
74LS181 4-bit ALU
Data sheet on web site
18
Pin names
NAME Type Function Comment
A30 I First operand 4-bit number
B30 I Second operand 4-bit number
S30 I Select Defines function
M I Mode Logic or arithmetic
Cn I Carry in For cascading ALUs
F30 O Function Result of operation
AB O Comparator output For equal test
G O Carry generate For fast addition
Cn4 O Carry output For fast addition
19
Example functions
Table is difficult to read
  • Logic
  • and 0xb
  • or 0xe
  • Arithmetic
  • add 0x9
  • sub 0x6 (minus 1)

20
What is Mode, Select?
Function Mode Select
add 0 1001
xor 1 0110
(A 1) 0 1111
and 1 1011
or 1 1110
nand 1 0100
nor 1 0001
(A 1) 0
sub 0
21
ALU design with LS181s
  • Assume
  • 12-bit computer
  • Active high operands
  • Must cascade three devices
  • Carry out must drive next carry in
  • Mode and select bused to all devices

22
One device
NOTE Active low symbol provided
23
Design a 12-bit ALU?
24
Add operations
NOTE S 9, M 0
What is the propagation time? Is it the same for
all numbers?
25
Or operations
NOTE S e, M 1
What is (0x555) ord (0xaaa)?
26
Project 2 overview
  • Sixteen-bit ALU
  • Use four LS181 plus some other logic
  • Arithmetic , -
  • Logical
  • and, or
  • shift left, shift right

27
(No Transcript)
28
Find machine instruction?
Assume pc31pc280
j end end 0x 4f 612c
Name Fields Fields
Size 6 bits 26 bits
J type 00 0010 0000 0100 1111 0110 0001 0010 11
0x 4f 612c 0100 1111 0110 0001 0010 1100
target 0000 0100 1111 0110 0001 0010 11
inst 0x 0813 d84b
29
What is Mode, Select?
Function Mode Select
add 0 9
xor 1 6
(A 1) 0 f
and 1 b
or 1 e
nand 1 4
nor 1 1
(A 1) 0 9, B1
sub 0 6, Cn 0
30
Design a 12-bit ALU?
Write a Comment
User Comments (0)
About PowerShow.com