DCE Lab EXP 9
DCE Lab EXP 9
AIM:
APPARATUS REQUIRED:
Use the Control Design VIs and functions to construct, analyze, and deploy dynamic system models in
LabVIEW.
The VIs on these palettes can return general LabVIEW error codes or specific control design error
codes.
THEORY:
The control unit (CU) is a component of a computer's central processing unit (CPU) that
directs the operation of the processor. A CU typically uses a binary decoder to convert coded
instructions into timing and control signals that direct the operation of the other units
(memory, arithmetic logic unit and input and output devices, etc.).Most computer resources are
managed by the CU. It directs the flow of data between the CPU and the other devices
The component which receives the input signal/information/instruction from the user and
converts into control signals for the execution in the CPU. It controls and directs the main memory,
arithmetic & logic unit (ALU), input and output devices, and also responsible for the instructions that
are sent to the CPU of a computer. It fetches the instructions from the main memory of a processor and
sent to the processor instruction register, which contains register contents.
22CS206-DIGITAL COMPUTER ELECTRONICS
PROCEDURE:
The matrix generator provides states of controls unit and the signals out from the processor (interrupt
signals). Matrix is built as the programmable logic array. The control signals generated by the matrix
generator are given as the input to the next generator matrix and combines with the timing signals of
the timing unit that contains rectangular patterns.
For fetching of new instruction, the control unit turns into an initial stage for the execution of new
instruction. The control unit remains in the initial stage or first stage as long as the timing signals,
input signals, and states of instruction of a computer are unchanged. The change in the state of the
control unit can be raised if there any change in any of the generated signals.
When an external signal or interrupt occurs, the control unit goes to the next state and performs the
processing of the interrupt signal. The flags and states are used to select the desired states to perform
the execution cycle of instruction.
22CS206-DIGITAL COMPUTER ELECTRONICS
In the last state, the control unit fetches the next instruction and sends the output to the program
counter, then to the memory address register, to the buffer register, and then to the instruction register
to read the instruction. Finally, if the last instruction (which is fetched by the control unit) is end
instruction, then it goes to the operating state of the processor and waits until the user directs the next
program.
The micro-operations are done for the execution of micro-instructions in the program. The block
diagram of the Micro programmed control unit is shown above. From the diagram, the address of the
micro-instruction is obtained from the control memory address register. All the info of the control unit
is permanently stored in the control memory called ROM.
During the execution of micro-instructions, the next address generator computed the next address of
the micro-instruction and then send to the control address register to read the next micro-instruction.
The sequence of micro-operations of a micro-program is performed by the next address generator and
acts as microprogram sequencer to get the sequence address i.e., read from the control memory.
22CS206-DIGITAL COMPUTER ELECTRONICS
`include “prj_definition.v”
// Output signals
// Outputs for register file
// Input signals
input [`DATA_INDEX_LIMIT:0] RF_DATA_R1, RF_DATA_R2, ALU_RESULT;
input ZERO, CLK, RST;
// Inout signal
inout [`DATA_INDEX_LIMIT:0] MEM_DATA;
// State nets
wire [2:0] proc_state;
//holds program counter value, stores the current instruction, stack pointer register
PROC_SM state_machine(.STATE(proc_state),.CLK(CLK),.RST(RST));
end
always @ (state)
begin
case( state )
`PROC_FETCH : begin
next_state = `PROC_DECODE;
MEM_READ = 1’b1;
RF_ADDR_R1 = 1’b0; RF_ADDR_R2 = 1’b0;
RF_ADDR_W = 1’b1;
end
`PROC_DECODE : begin
next_state = `PROC_EXE;
MEM_ADDR = 1’b1;
ALU_OP1 = 1’b1; ALU_OP2 = 1’b1; ALU_OPRN = 1’b1;
MEM_WRITE = 1’b1;
RF_ADDR_R1 = 1’b1; RF_ADDR_R2 = 1’b1;
end
`PROC_EXE : begin
next_state = `PROC_MEM;
ALU_OP1 = 1’b1; ALU_OP2 = 1’b1; ALU_OPRN = 1’b1;
RF_ADDR_R1 = 1’b0;
end
`PROC_MEM: begin
next_state = `PROC_WB;
MEM_READ = 1’b1; MEM_WRITE = 1’b0;
end
`PROC_WB: begin
next_state = `PROC_FETCH;
MEM_READ = 1’b1; MEM_WRITE = 1’b0;
end
endcase
end
endmodule;
module PROC_SM(STATE,CLK,RST);
// list of inputs
input CLK, RST;
// list of outputs
output [2:0] STATE;
// input list
input CLK, RST;
22CS206-DIGITAL COMPUTER ELECTRONICS
// output list
output STATE;
// initiation of state
initial
begin
state = 2’bxx;
next_state = `PROC_FETCH;
end
print_instruction(INST_REG);
end
end
print_instruction(SP_REF);
end
22CS206-DIGITAL COMPUTER ELECTRONICS
end
print_instruction(PC_REG);
end
end
task print_instruction;
begin
// I-type
{opcode, rs, rt, immediate } = inst;
// J-type
{opcode, address} = inst;
$write(“@ %6dns -> [0X%08h] “, $time, inst);
case(opcode) // R-Type
6’h00 : begin
case(funct)
// I-type
// J-Type
RESULT:
Hence Design and Simulation of control unit functionality has been verified.