LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE std.textio.ALL;

PACKAGE pack8051 IS
   SUBTYPE bvec       IS UNSIGNED(7 DOWNTO 0);
   SUBTYPE wvec       IS UNSIGNED(15 DOWNTO 0);
   SUBTYPE smallint   IS INTEGER RANGE 0 TO 255;

   TYPE program_mem_T IS ARRAY(0 TO 65535) OF bvec; 
   TYPE data_lomem_T  IS ARRAY(0 TO 127)   OF bvec;
   TYPE data_himem_T  IS ARRAY(128 TO 255) OF bvec;

   -- The following type is used to declare if direct or indirect memory
   -- access is being used and, hence, which segment of upper memory
   -- is to be used.
   TYPE    access_type IS (direct, indirect);

   -- The following type is used to break up the machine cycle
   -- into 6 states, with 2 pulses for each state
   TYPE machine_cycle_states IS (init, s1p1, s1p2, s2p1, s2p2, s3p1, s3p2,
         s4p1, s4p2, s5p1, s5p2, s6p1, s6p2);

   FUNCTION to_int(ch   : CHARACTER)  RETURN INTEGER;

   FUNCTION "or"(l,r : unsigned)  RETURN unsigned;
   FUNCTION "and"(l,r : unsigned) RETURN unsigned;
   FUNCTION "xor"(l,r : unsigned) RETURN unsigned;
   FUNCTION "not"(r : unsigned)   RETURN unsigned;

   FUNCTION conv_signed_to_int(arg : bvec) RETURN INTEGER; 
   FUNCTION to_high_imped(arg : bvec) RETURN bvec;

   FUNCTION inc(state : machine_cycle_states) 
       RETURN machine_cycle_states;

   PROCEDURE load_program(
       CONSTANT program_filename : IN string;
       VARIABLE pmem             : OUT program_mem_T  -- the program memory
   );
END pack8051;

<div align="center"><br /><script type="text/javascript"><!--
google_ad_client = "pub-7293844627074885";
//468x60, Created at 07. 11. 25
google_ad_slot = "8619794253";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />&nbsp;</div>