-- Copyright © 1993 by McGraw-Hill, Inc. and Zainalabedin Navabi
-- FIGURE 9.36
-- ENITIY DECLARATION OF PARWAN SHIFTER UNIT :
LIBRARY cmos;
USE cmos.basic_utilities.ALL;
LIBRARY par_library;
USE par_library.par_utilities.ALL;
--
ENTITY shifter_unit IS
PORT (alu_side : IN byte; arith_shift_left, arith_shift_right : IN qit;
in_flags : IN nibble; obus_side : OUT byte; out_flags : OUT nibble);
END shifter_unit;
--
-- BEHAVIORAL DESCRIPTION OF PARWAN SHIFTER UNIT :
ARCHITECTURE behavioral OF shifter_unit IS
BEGIN
coding: PROCESS (alu_side, arith_shift_left, arith_shift_right)
VARIABLE t : qit_vector (7 DOWNTO 0);
VARIABLE v, c, z, n : qit;
ALIAS n_flag_in : qit IS in_flags(0);
ALIAS z_flag_in : qit IS in_flags(1);
ALIAS c_flag_in : qit IS in_flags(2);
ALIAS v_flag_in : qit IS in_flags(3);
BEGIN
IF arith_shift_right = '0' AND arith_shift_left = '0' THEN
t := alu_side (7 DOWNTO 0);
n := n_flag_in;
z := z_flag_in;
c := c_flag_in;
v := v_flag_in;
ELSIF arith_shift_left = '1' THEN
t := alu_side(6) & alu_side(5 DOWNTO 0) & '0';
-- t := alu_side (6 DOWNTO 0) & '0';
n := t (7);
z := set_if_zero (t);
c := alu_side (7);
v := alu_side (6) XOR alu_side (7);
ELSIF arith_shift_right = '1' THEN
t := alu_side (7) & alu_side (7 DOWNTO 1);
n := t (7);
z := set_if_zero (t);
c := c_flag_in;
v := v_flag_in;
END IF;
obus_side <= t;
out_flags <= v & c & z & n;
END PROCESS coding;
END behavioral;
--