Which of the following may be specified by the code given? [code]TYPE op_code is ( ADD, SUB, MUL, DIV, LT, LE, EQ ); PROCEDURE first_unit

Hưng Thịnh

New member
Which of the following may be specified by the code given?
Code:
TYPE op_code is ( ADD, SUB, MUL, DIV, LT, LE, EQ );
PROCEDURE first_unit ( A, B : in integer; op : in op_code;
Z : out integer; ZCOMP : out boolean ) is
BEGIN
CASE op IS
WHEN ADD => Z := A + B;
WHEN SUB => Z := A - B;
WHEN MUL => Z := A * B;
WHEN DIV => Z := A / B;
WHEN LT =&gt; ZCOMP := A < B;
WHEN LE =&gt; ZCOMP := A <= B;
WHEN EQ =&gt; ZCOMP := A = B;
WHEN others =&gt; Z := Z;
END case;
END first_unit;
A. CPU
B. CU
C. ALU
D. Memory
 
Answer: c
Explanation: It is clear from the code in which two parameters are showing inputs (A and B) on which different operations are being performed. Therefore, It is the case of ALU unit of the CPU.
 

Tìm kiếm

Back
Top