(assembly language) computer architecture

47
11/7/2013 1 CSW 353 (Assembly Language) Computer Architecture Dr. Salma Hamdy [email protected]

Upload: others

Post on 24-Feb-2022

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: (Assembly Language) Computer Architecture

11/7/2013 1

CSW 353 (Assembly Language)

Computer Architecture

Dr. Salma Hamdy [email protected]

Page 2: (Assembly Language) Computer Architecture

Computer System Architecture

2

Chapter 1: Digital Logic Circuits Chapter 2: Digital Components Chapter 3: Data Representation Chapter 4: Register Transfer and Microoperations

Chapter 5: Basic Computer Organization Chapter 6: Programming the Basic Computer Chapter 7: Microporgammed Control

Chapter 8: CPU

Chapter 11: I/O Organization

Chapter 12: Memory Organization

Page 3: (Assembly Language) Computer Architecture

Basic Computer Organization and

Design - II 1. Memory-Reference Instructions 2. Register Reference Instructions 3. Input-Output and Interrupts 4. Design of Basic Computer 5. Design of Accumulator Logic

The three types of instructions, their register transfer statements, and their control functions. Connecting all into a basic computer.

Page 4: (Assembly Language) Computer Architecture

4 11/7/2013

Page 5: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions

• 𝑰𝑹(12-14) to decoder outputs 𝑫𝟏𝑫𝟐…. 𝑫𝟔 which specifies one of 7 operations.

• Effective address was stored in 𝑨𝑹 during 𝑻𝟐 (when 𝑰 = 𝟎), or during 𝑻𝟑 (when 𝑰 = 𝟏).

• Execution starts with timing sequence 𝑻𝟒.

• Actual execution requires a sequence of microoperations as data stored in memory cannot be processed directly.

5 11/7/2013

Page 6: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

6 11/7/2013

Page 7: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

And to 𝑨𝑪

• Performs the AND logic operation on the pair of bits in 𝑨𝑪 and the memory specified by the effective address.

7 11/7/2013

Page 8: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

BUN (Branch Unconditionally)

• Transfers the program to the instruction specified by the effective address (jump).

8 11/7/2013

Page 9: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

BUN (Branch Unconditionally)

• Transfers the program to the instruction specified by the effective address (jump).

9 11/7/2013

Page 10: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

BSA (Branch and Save Return Address)

• Branches to a subroutine or procedure (call).

– Stores the address of the next instruction of the main program, in a memory location specified by effective address (top of subroutine).

–Branches to address of first instruction of subroutine (the one right after the effective address).

10 11/7/2013

Page 11: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

BSA Example

11 11/7/2013

Page 12: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

12 11/7/2013

Page 13: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions – (cont.)

• Only seven timing sequences needed to execute the longest instruction.

• Sequence Counter size?

13 11/7/2013

Page 14: (Assembly Language) Computer Architecture

2. Register Reference Instructions

• 𝑫𝟕 = 𝟏 and 𝑰 = 𝟎, with timing sequence 𝑻𝟑.

• 𝑰𝑹(0-11) specify one of 12 instructions.

• Let the bits of 𝑰𝑹 be 𝑩𝟏𝟏𝑩𝟏𝟎…. 𝑩𝟎.

• Let the Boolean relation 𝑫𝟕𝑰′𝑻𝟑 = 𝐫.

• Since the control function is distinguished by one of the bits in 𝑰𝑹(0-11), then all control functions can be simply denoted by 𝒓𝑩𝒊.

14 11/7/2013

Page 15: (Assembly Language) Computer Architecture

2. Register Reference Instructions – (cont.)

• Example: CLA

Hex. 7 8 0 0

Binary 0 111 1000 000 000

Control function that initiates the microoperations for this instruction is: 𝑫𝟕𝑰′𝑻𝟑𝑩𝟏𝟏 = 𝒓𝑩𝟏𝟏

15 11/7/2013

𝑰’ 𝑫𝟕 𝑩𝟏𝟏

Page 16: (Assembly Language) Computer Architecture

2. Register Reference Instructions – (cont.)

16 11/7/2013

Page 17: (Assembly Language) Computer Architecture

2. Register Reference Instructions – (cont.)

• 𝑺𝑪 is cleared after the execution of each instruction initiating 𝑻𝟎 (fetch) again that causes a new cycle.

• After a HALT, the start flip-flip must be set manually.

17 11/7/2013

Page 18: (Assembly Language) Computer Architecture

3. Input-Output Instructions

18 11/7/2013

Input-Output Configuration

Page 19: (Assembly Language) Computer Architecture

3. Input-Output Instructions – (cont.)

19 11/7/2013

• 𝑫𝟕 = 𝟏 and 𝑰 = 𝟏, with timing sequence 𝑻𝟑.

• 𝑰𝑹(0-11) specify one of 12 instructions.

• Let the bits of 𝑰𝑹 be 𝑩𝟏𝟏𝑩𝟏𝟎…. 𝑩𝟎.

• Let the Boolean relation 𝑫𝟕𝑰𝑻𝟑 = 𝐩.

• Since the control function is distinguished by one of the bits in 𝑰𝑹(0-11), then all control functions can be simply denoted by 𝒑𝑩𝒊.

Page 20: (Assembly Language) Computer Architecture

3. Input-Output Instructions – (cont.)

20 11/7/2013

• 𝑺𝑪 is cleared after the execution of each instruction initiating 𝑻𝟎 (fetch) again that causes a new cycle.

Programmed control transfer

Page 21: (Assembly Language) Computer Architecture

3. Input-Output Instructions

21 11/7/2013

Interrupts

• Instead of wasting time by checking flags, let the external device inform the computer when it is ready for transfer.

• Interrupt enable flip-flop 𝑰𝑬𝑵.

• 𝑰𝑬𝑵 = 𝟎 (with the 𝑰𝑶𝑭 instruction) flags cannot interrupt computer.

• 𝑰𝑬𝑵 = 𝟏 (with the 𝑰𝑶𝑵 instruction) computer can be interrupted.

Page 22: (Assembly Language) Computer Architecture

3. Input-Output Instructions

22 11/7/2013

Interrupt Cycle

• Interrupt flag 𝑹.

Page 23: (Assembly Language) Computer Architecture

3. Input-Output Instructions

23 11/7/2013

Interrupt Cycle

• Initiated after last execution phase if 𝑹 = 𝟏.

• That is, if 𝑰𝑬𝑵 = 𝟏, and either 𝑭𝑮𝑰 or 𝑭𝑮𝑶 are 1. Happens with any clock transition except when timing signals 𝑻𝟎, 𝑻𝟏, 𝑻𝟐 are active.

Page 24: (Assembly Language) Computer Architecture

3. Input-Output Instructions

24 11/7/2013

Interrupt Cycle Example

Page 25: (Assembly Language) Computer Architecture

3. Input-Output Instructions

25 11/7/2013

Modified Fetch and Decode Phases

• ??

Page 26: (Assembly Language) Computer Architecture

4. Complete Computer Description

• Flowchart of the basic computer operation Fig 5-15.

• Control functions and microoperations of the basic computer Table 5-6.

26 11/7/2013

Page 27: (Assembly Language) Computer Architecture

5. Design of Basic Computer

Components:

–Memory unit 4096×16.

–Nine registers: 𝑨𝑹, 𝑷𝑪, 𝑫𝑹, 𝑨𝑪, 𝑰𝑹, 𝑻𝑹, 𝑶𝑼𝑻𝑹, 𝑰𝑵𝑷𝑹, 𝑺𝑪.

– Seven flip-flops: 𝑰, 𝑺, 𝑬, 𝑹, 𝑰𝑬𝑵, 𝑭𝑮𝑰, 𝑭𝑮𝑶.

–Two decoders: a 3×8 operation decoder, and a 4×16 timing decoder.

–A 16-bit common bus.

–Control logic gates.

–Adder and logic circuit connected to 𝑨𝑪. 27 11/7/2013

Page 28: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control Logic Gate

• Input: decoders output, 𝑰𝑹(0-11), 𝑨𝑪, 𝑫𝑹, the 7 flip-flops.

28 11/7/2013

Page 29: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control Logic Gate

• Output: – Signals to control the input of the nine registers.

– Signals to control the read and write input of memory.

– Signals to set, clear, or complement the flip-flips.

– Signals for 𝑺𝟐, 𝑺𝟏, and 𝑺𝟎 to select a register for the bus.

– Signals to control 𝑨𝑪 adder and logic circuit.

• The specs of various control signals comes directly from Table 5-6.

29 11/7/2013

Page 30: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control for Registers, Memory and Flip-Flops

• Registers control inputs are LD, INR, and CLR.

• Example: to find the gate structure associated with the control inputs of 𝑨𝑹, scan Table 5-6 to find all statements that change content of AR.

30 11/7/2013

Page 31: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control for Registers, Memory and Flip-Flops

• Example: control inputs of 𝑨𝑹

31 11/7/2013

Page 32: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control for Common Bus

• Each binary number is associated with a Boolean variable 𝒙.

32 11/7/2013

Page 33: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

Control for Common Bus

• Each binary number is associated with a Boolean variable 𝒙.

33 11/7/2013

Page 34: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

34 11/7/2013

Control for Common Bus

• Example: to find the logic that selects 𝑨𝑹, scan Table 5-6 to find all statement that have 𝑨𝑹 as a source.

Page 35: (Assembly Language) Computer Architecture

5. Design of Basic Computer – (cont.)

35 11/7/2013

Control for Common Bus

• Example: to find the logic that selects 𝑨𝑹, scan Table 5-6 to find all statement that have AR as a source.

Page 36: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic

Control of 𝑨𝑪 Register

• From Table 5-6 extract all statement that changes the content of 𝑨𝑪.

36 11/7/2013

Page 37: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic – (cont.)

Control of 𝑨𝑪 Register

• From Table 5-6 extract all statement that changes the content of 𝑨𝑪.

37 11/7/2013

Page 38: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic – (cont.)

Control of 𝑨𝑪 Register

38 11/7/2013

𝑫𝟕𝑰′𝑻𝟑 = 𝐫

Page 39: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic – (cont.)

Control of Adder and Logic Circuit (one stage)

• Can be divided into 16 stages, each stage corresponds to one it in 𝑨𝑪.

• Each stage contains seven AND gates (one for each operation), one OR gate (combining all), and a full adder.

39 11/7/2013

Page 40: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic – (cont.)

Control of Adder and Logic Circuit (one stage)

40 11/7/2013

Page 41: (Assembly Language) Computer Architecture

Selected Problems

41 11/7/2013

REMARK: registers on the bus are numbered from 1 to 7, meaning that terminal 0 of MUX (selected by 𝒔𝟐𝒔𝟏𝒔𝟎=000) does not contribute to transfers through the bus.

111

001

010

011

100

101

110

Page 42: (Assembly Language) Computer Architecture

Selected Problems – (cont.)

42 11/7/2013

Page 43: (Assembly Language) Computer Architecture

Selected Problems – (cont.)

43 11/7/2013

Page 44: (Assembly Language) Computer Architecture

Selected Problems – (cont.)

44 11/7/2013

Page 45: (Assembly Language) Computer Architecture

Selected Problems – (cont.)

45 11/7/2013

Page 46: (Assembly Language) Computer Architecture

Next Lecture

Revision + problem solving.

46 11/7/2013

Assignment

- Reading: Chapter 5: sections 6-10.

Page 47: (Assembly Language) Computer Architecture

References

- Digital Design, 4th ed, M. Morris Mano, Prentice Hall, 2006.

-http://microcom.kut.ac.kr/ ch05

- God bless Google and Wiki!

47 11/7/2013