5.4 The function and working principle of the controller

5.4.1 Structure and function of the controller

The main functions of the controller are:
(1) Fetch an instruction from the main memory and point out the location of the next instruction in the main memory.Instruction fetch
(2) Decode or test the instruction, and generate the corresponding operation control signal to start the specified action.Analysis instructions
(3) Command and control the direction of data flow between CPU, main memory, and I/O devicesGenerate control signal(执行指令)

5.4.2 Hard wired controller

硬布线设计步骤及原则
原则一:The sequence of micro-operations must not be changed at will.
原则二:Different micro-operations of the controlled objects should be arranged in one beat to complete (能并行就并行)
原则三:the micro-operations with a shorter time. Try to arrange to complete the micro-operations in one beat, and a sequence is allowed
Insert picture description here
Insert picture description here

注:Here is a further explanation about unconditional branch instructions and conditional branch instructions
The transfer instruction is to execute the instruction indicated by the target address, otherwise continue to execute the next instruction

The difference between unconditional and conditional is that one does not require conditions, and the other must be transferred under certain conditions.BAN goes negative
Insert picture description here
Insert picture description here
取指结束后,PC存的是下一条指令的地址,此时PC第一次修改
执行指令的时候,PC的值应改为跳转指令的目的地址,此时进行第二次修改

For unconditional jump instructionsJMP XDuring the execution phase, there is no need to access the main memory, and the instruction cycle only includes the instruction fetch cycle and the execution cycle

5.4.3 Microprogram Controller

1. The basic concept of microcontroller

The micro-program controller is implemented by storage logic, that is, the micro-operation signal is coded, so that each one is 机器指令converted into a segment 微程序and a special memory in the cluster == (memory controller) ==, and the micro-operation control signal is generated by the micro instruction .
机器指令、微程序、微指令、微命令、微操作
1、Micro commands and micro operations
MicrocommandMemR,MARout,MDRinAnd micro operationsM(MAR)->MDROne to one correspondence
2、Micro-instructions and micro-cycles
微指令are a collection of several micro-commands . It takes time
微周期to read one from the control memory 微指令and execute the corresponding微操作
Insert picture description here
Insert picture description here

读者应注意区分以下寄存器
Insert picture description here
主存(Store programs and data, external to the CPU, implemented with RAM)----控制存储器(The control memory CM stores the micro program, which is realized by ROM inside the CPU)
MAR----CMAR
IR----CMDR

2. The composition and working process of the microcontroller

Insert picture description here
由机器指令的操作码字段指出各个微程序的入口地址
Insert picture description here

注意:若指令系统中具有n种机器指令,则控制存储器中的微程序至少是n+1种(1 is a public finger fetching microprogram)

3. Encoding of microinstructions

Insert picture description here

4. The address formation method of microinstruction

Insert picture description here

5. Microinstruction format

1):水平型微指令
In terms of coding methods, direct coding, field direct coding, field indirect coding, and mixed coding are all horizontal microinstructions.
一条水平型微指令定义并执行几种并行的基本操作
Insert picture description here

2):垂直型微指令
一条垂直型微指令只能定义并执行一种基本操作
Insert picture description here
3):混合型微指令
Add some less complex parallel operations on the basis of vertical microinstructions. The microinstructions are short and still easy to write; the microprograms are not long, and the execution speed is accelerated.

Insert picture description here

6. Design steps of microprogram control unit(了解即可)

The micro-operation commands and beat arrangements issued by the micro-program control unit in the fetch phase are as follows:
Insert picture description here
Considering the formation of the subsequent micro-instruction address, the fetch operation of the above analysis requires a total of 6 micro-instructions to complete:
Insert picture description here

7. Dynamic and micro programming

Dynamic programming changes the micro program according to user requirements; the 采用EPROM
second-level control memory of Haowei programming is Haowei memory, and the direct control hardware is豪微Microinstruction

8. The characteristics of hard wiring and microcontroller

Insert picture description here
例题
Insert picture description here
tips: The address of the fetch is given based on the lower address of the previous instruction, not the fetch action initiated by the previous instruction, the fetch action is spontaneous
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_38220799/article/details/109013485