Title: The Control Logic
1The Control Logic
- Andreas Klappenecker
- CPSC321 Computer Architecture
2Verilog HDL
3Verilog Programming
- Suppose that we have a module foo
- Our goal is to instantiate and wire a module foon
that contains n copies of the module foo. - Many textbooks on Verilog suggest to write down
the n instance explicitly - if n 1024 then this is not a viable option
- reusability of the code would be limited
4Example 1
foon
5Example 1
- module foo(out, a,b)
- output out
- input a, b
- xor (out, a, b)
- endmodule
module foon(out, a, b) parameter n 8
output n-10 out input n-10 a, b foo
foonn-10(out,a,b) endmodule
6Example 2
foon
7Example 2
- module foo(out, a,b)
- output out
- input a, b
- xor (out, a, b)
- endmodule
module foon(out, a, enable) parameter n 8
output n-10 out input n-10 a input
enable foo foonn-10 (out, a,
outn-20,enable) endmodule
8Remarks
- The module vector operator is not available in
Icarus Verilog nor in Veriwell - The features shown work in vcs
- foo foonn-10(out,a,outn-20,enable)
- out and a range over n-10
- outn-20, enable gives vector n-10
- The suggested for-loop construction does not work
9Control
10MIPS Multicycle Datapath
- Incomplete (branch and jumps)
11Control
- What are the control signals?
- Finite state machine control
- Instruction fetch
- instruction decode
- memory reference
- R-type
- branch
- jump
12Multicycle Datapath and Control Lines
13(No Transcript)
14High-Level Picture
- What happens precisely during each step of
fetch/decode/execute cycles - Construct the finite state control machine
- High-level view
15Instruction Fetch/Decode/Execute
16(No Transcript)
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)
22(No Transcript)
23Instruction Fetch Decode FSM
24Memory-Reference FSM
- Address calculation
- Load sequence
- read from memory
- store to register
- Access memory
- Store sequence write
25R-type Instruction
- Execution of instruction
- Completion of instruction
26Branch Instruction
27Implementation of FSM
- A FSM can be implemented by a register holding
the state and a block of combinatorial logic - Task of the combinatorial logic
- Assert appropriate signals
- Generate the new state to be stored in the
register