计算机组成与体系结构Ch4_ECOA (2)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• The jump-and-store instruction, JNS, gives us limited subroutine functionality.
• JumpI X
MAR ← X MBR ← M[MAR] PC ← MBR
16
4.6 Extending Our Instruction Set
• Assemblers create an object program file from mnemonic source code in two passes. • During the first pass, the assembler assembles as much of the program is it can, while it builds a symbol table that contains memory references for all symbols in the program. • During the second pass, the instructions are completed using the values from the symbol table.
8
4.5 A Discussion on Assemblers
• Consider our example program (top).
– Note that we have included two directives HEX and DEC that specify the radix of the constants.
18
4.7 A Discussion on Decoding
• A computer’s control unit keeps things synchronized, making sure that bits flow to the correct components as the components are needed. • There must be control signals to assert lines on various digital components to make things happen as described.
24
4.7 A Discussion on Decoding
• Advantage: If the instruction set requires modification, the microprogram is simply updated to match—no change is required in the actual hardware.
In Fetch, PC PC+1
14
4.6 Extending Our Instruction Set
• Clear
AC ← 0
• ADDI X
MAR X MBR M[MAR] MAR MBR MBR M[MAR] AC AC + MBR
15
4.6 Extending Our Instruction Set
21
4.7 A Discussion on Decoding
hardwired control • Advantage: very fast • Disadvantage: circuits are complex, difficult to design or modify expensive
22
11
4.6 Extending Our Instruction Set
extended instruction set.
12
4.6 Extending Our Instruction Set
• So far, all of the MARIE instructions that we have discussed use a direct addressing mode. • This means that the address of the operand is explicitly stated in the instruction. • It is often useful to employ a indirect addressing, where the address of the address of the operand is given in the instruction.
EXAMPLE 4.2 if/else construct :
Skipcond 400
if X = Y then X := X * 2; else Y := Y - X;
17
4.6 Extending Our Instruction Set
EXAMPLE 4.3 double any number:
19
4.7 A Discussion on Decoding
• There are two general ways in which a control unit can be implemented: hardwired control and microprogrammed control.
Microprogramming is flexible, simple in design, and lends itself to very powerful instruction sets. Microprogramming allows for convenient hardware/software tradeoffs.
10
4.5 A Discussion on Assemblers
• If the overall size of the program or response time is critical, assembly language often becomes the language of choice. • The software for an embedded system is critical.
4.7 A Discussion on Decoding
• Microprogramming: uses software for control.
23
4.7 A Discussion on Decoding
Microprogramming: • Machine instructions are input into a special program, the microprogram, to convert the instruction into the appropriate control signals. • essentially an interpreter written in microcode. • converts machine instructions of ―0‖ and ―1‖ into control signals. • There is one subroutine for each machine instruction.
2
4.4 A Simple Program
• This is the LOAD 104 instruction:
3
4.4 A Simple Program
• Our second instruction is ADD 105:
4
4.4 A Simple Program
• Our second instruction is STORE 106:
20
4.7 A Discussion on Decoding
• hardwired control: physically connect all of the control lines to the actual machine instructions. The instructions are divided up into fields, and different bits in the instruction are combined through various digital logic components to drive the control lines.
– If you have ever used pointers in a program, you are already familiar with indirect addressing.
13
4.6 Extending Our Instruction Set
• JnS X
MBR ← PC MAR ← X M[MAR] ← MBR MBR ← X AC ← 1 AC ← AC + MBR PC ← AC
• During the first pass, we have a symbol table and the partial instructions shown at the bottom.
9
4.5 A Discussion on Assemblers
• After the second pass, the assembly is complete.
– With microprogrammed control, a small program is placed into read-only memory in the microcontroller. – Hardwired controllers implement this program using digital logic components.
25
wenku.baidu.com
4.7 A Discussion on Decoding
• Disadvantage: all instructions must go through an additional level of interpretation, slowing down the program execution. There is a cost of the actual development, because appropriate tools are required.
Chapter 4
MARIE: An Introduction to a Simple Computer
4.4 A Simple Program
• Consider the simple MARIE program given below. We show a set of mnemonic instructions stored at addresses 100 - 106 (hex):
5
4.5 A Discussion on Assemblers
• Mnemonic instructions, such as LOAD 104, are easy for humans to understand, remember and write. • They are impossible for computers to understand. • Assemblers translate instructions that are comprehensible to humans into the machine language that is comprehensible to computers
– We note the distinction between an assembler and a compiler: In assembly language, there is a one-to-one correspondence between a mnemonic instruction and its machine code. With compilers, this is not usually the case.
6
4.5 A Discussion on Assemblers
• We can also substitute labels (simple names) to identify or name particular memory addresses,
7
4.5 A Discussion on Assemblers
相关文档
最新文档