-------------------------------------------------------------------------------- -- -- AMD 2910 Benchmark -- -- Source: AMD data book -- -- VHDL Benchmark author Indraneel Ghosh -- University Of California, Irvine, CA 92717 -- -- Developed on Feb 19, 1992 -- -- Verification Information: -- -- Verified By whom? Date Simulator -- -------- ------------ -------- ------------ -- Syntax yes Champaka Ramachandran Sept17, 92 ZYCAD -- Functionality yes Champaka Ramachandran Sept17, 92 ZYCAD -------------------------------------------------------------------------------- use work.types.all; entity am2910 is port ( I : in nat4; -- 2910 instruction CCEN_BAR : in bit; -- condition code enable input bit CC_BAR : in bit; -- condition code input bit RLD_BAR : in bit; -- R register load CI : in bit; -- carry in OEBAR : in bit; -- tri-state driver CLK : in bit; -- clock D : in nat12; -- direct inputs Y : out nat12; -- output instruction word PL_BAR : out bit; -- VECT_BAR : out bit; -- MAP_BAR : out bit; -- FULL_BAR : out bit -- stack full flag ); end am2910; architecture am2910 of am2910 is begin process variable FAIL : bit; -- CC fail flag variable SP : integer range 0 to 5; -- stack pointer variable STACK : MEMORY12(5 downto 0); -- stack register file variable RE : nat12; variable uPC : nat12; variable Y_temp : nat12; variable carry : nat12; begin wait until (CLK = '1'); if ((CC_BAR = '1') and (CCEN_BAR = '0')) then FAIL := '1'; else FAIL := '0'; end if; if (SP = 5) then -- NECCESSARY FOR CORRECT SIMULATION FULL_BAR <= '0'; -- SINCE THIS PROCESS IS NOT TRIGERRED BY else -- A RISING CLOCK EDGE FULL_BAR <= '1'; end if; if (CI = '1') then carry := 1; else carry := 0; end if; --------------------------------------------------------------------------- case I is when 0 => -- JZ instruction Y_temp := 0; if (RLD_BAR = '0') then RE := D; end if; SP := 0; uPC := 0; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; ---------------------------------------------------------------------------- when 1 => -- CJS instruction if (FAIL = '0') then Y_temp := D; if (SP /= 5) then -- PUSH SP := SP + 1; end if; STACK(SP) := uPC; else Y_temp := uPC; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; ------------------------------------------------------------------------------- when 2 => -- JMAP instruction Y_temp := D; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '0'; VECT_BAR <= '1'; PL_BAR <= '1'; ------------------------------------------------------------------------------- when 3 => -- CJP instruction if (FAIL = '1') then Y_temp := uPC; else Y_temp := D; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; -------------------------------------------------------------------------------- when 4 => -- PUSH instruction Y_temp := uPC; if (( FAIL = '0') or (RLD_BAR = '0')) then RE := D; end if; if (SP /= 5) then -- PUSH SP := SP + 1; end if; STACK(SP) := uPC; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 5 => -- JSRP instruction if (FAIL = '1') then Y_temp := RE; else Y_temp := D; end if; if (RLD_BAR = '0') then RE := D; end if; if (SP /= 5) then -- PUSH SP := SP + 1; end if; STACK(SP) := uPC; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 6 => -- CJV instruction if (FAIL = '1') then Y_temp := uPC; else Y_temp := D; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '0'; PL_BAR <= '1'; --------------------------------------------------------------------------------- when 7 => -- JRP instruction if (FAIL = '1') then Y_temp := RE; else Y_temp := D; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 8 => -- RFCT instruction if (RE = 0) then Y_temp := uPC; if (SP /= 0) then -- POP SP := SP - 1; end if; else Y_temp := STACK(SP); if (RLD_BAR = '1') then RE := RE - 1; end if; end if; if ( RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 9 => -- RPCT instruction if (RE /= 0) then Y_temp := D; if (RLD_BAR = '1') then RE := RE - 1; end if; else Y_temp := uPC; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 10 => -- CRTN instruction if (FAIL = '0') then Y_temp := STACK(SP); if (SP /= 0) then SP := SP - 1; -- pop end if; else Y_temp := uPC; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 11 => -- CJPP instruction if (FAIL = '0') then Y_temp := D; if (SP /= 0) then -- pop SP := SP - 1; end if; else Y_temp := uPC; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 12 => -- LDCT instruction Y_temp := uPC; RE := D; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; --------------------------------------------------------------------------------- when 13 => -- LOOP instruction if (FAIL = '0') then Y_temp := uPC; if (SP /= 0) then -- pop SP := SP - 1; end if; else Y_temp := STACK(SP); end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; ------------------------------------------------------------------------------ when 14 => -- CONT instruction Y_temp := uPC; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; ---------------------------------------------------------------------------- when 15 => -- TWB instruction if (RE = 0) then if (FAIL = '1') then Y_temp := D; else Y_temp := uPC; end if; if (SP /= 0) then -- pop SP := SP - 1; end if; else if (FAIL = '0') then Y_temp := uPC; if (SP /= 0) then -- pop SP := SP - 1; end if; else Y_temp := STACK(SP); end if; if (RLD_BAR = '1') then RE := RE - 1; end if; end if; if (RLD_BAR = '0') then RE := D; end if; uPC := Y_temp + carry; MAP_BAR <= '1'; VECT_BAR <= '1'; PL_BAR <= '0'; ------------------------------------------------------------------------------- when others => end case; -- TRI-STATE DRIVER CONTROL if (OEBAR = '0') then Y <= Y_temp; end if; end process; end am2910;