file: hc11type.vhd
--
-- Motorola HC11 VHDL model
-- Copyright (C) Green Mountain Computing Systems, 1995
-- All rights reserved.
--
-- This software is provided "as is" without warranty of any kind.  Green 
-- Mountain Computing Systems does not accept any responsibility for results
-- obtained by using this software and does not guarantee that the software
-- is correct.
--
-- hc11type.vhd : This file defines a package that defines common types used
--        by the HC11 VHDL model.
--
-- 5/25/95 : Created - Scott Thibault
--

package types is
  subtype byte is bit_vector (7 downto 0);
  subtype word is bit_vector (15 downto 0);

  type byte_array is array (natural range <>) of byte;

  function resolve_byte(drivers : byte_array) return byte;
  subtype databus is resolve_byte byte;

  function resolve_pin(drivers : bit_vector) return bit;
  subtype pin is resolve_pin bit;
  type pin_vector is array (natural range <>) of pin;
end types;

package body types is
  function resolve_pin (drivers: bit_vector) return bit is
    variable resolved : bit :='0';
  begin
    for i in drivers'range loop
      resolved:=resolved or drivers(i);
    end loop;

    return resolved;
  end;

  function resolve_byte (drivers: byte_array) return byte is
    variable resolved : byte:=(others=>'0');
  begin
    for i in drivers'range loop
      resolved:=resolved or drivers(i);
    end loop;

    return resolved;
  end;
end types;

type b to return to text