6. Single-Cycle Processor Design Flashcards
What are the main functions of the processor?
- fetch instruction from instruction memory
- read the register operands
- use the ALU for computation
- access data memory for load/store
- store the result of computation or loaded data into the destination register
- update the PC.
What occurs in the instruction fetch?
The program counter is read, and is incremented by 4.
After the instruction fetch, how is an R-format instruction executed?
The instruction is decoded, and the data is passed to the ALU to operate on the data. The result is then written to a register.
After the instruction fetch, how is a load instruction executed?
The instruction is decoded, and the load address is calculated using 16-bit offset.
Read the memory, and update the destination register.
After the instruction fetch, how is a write instruction executed?
The instruction is decoded, and the write address is calculated using a 16-bit offset.
Write the memory.
After the instruction fetch, how is a branch instruction executed?
The instruction is decoded, registers are read and passed to the ALU to subtract and compare to zero.
Sign-extend the immediate, shift-left to word align and add to pc+4.
In a R-format instruction, which control lines are set?
- RegDst
- ALUSrc
- MemtoReg
- RegWrite
- MemRead
- MemWrite
- Branch
- ALUOp
- RegDst: 1
- ALUSrc: 0
- MemtoReg: 0
- RegWrite: 1
- MemRead: 0
- MemWrite: 0
- Branch: 0
- ALUOp: 01 (Depends)
In a lw instruction, which control lines are set?
- RegDst
- ALUSrc
- MemtoReg
- RegWrite
- MemRead
- MemWrite
- Branch
- ALUOp
- RegDst: 0
- ALUSrc: 1
- MemtoReg: 1
- RegWrite: 1
- MemRead: 1
- MemWrite: 0
- Branch: 0
- ALUOp: 00 (add)
In a sw instruction, which control lines are set?
- RegDst
- ALUSrc
- MemtoReg
- RegWrite
- MemRead
- MemWrite
- Branch
- ALUOp
- RegDst: X
- ALUSrc: 1
- MemtoReg: X
- RegWrite: 0
- MemRead: 0
- MemWrite: 1
- Branch: 0
- ALUOp: 00 (add)
In a branch instruction, which control lines are set?
- RegDst
- ALUSrc
- MemtoReg
- RegWrite
- MemRead
- MemWrite
- Branch
- ALUOp
- RegDst: X
- ALUSrc: 0
- MemtoReg: X
- RegWrite: 0
- MemRead: 0
- MemWrite: 0
- Branch: 1
- ALUOp: 01 (sub)