// ---------------------------------------------------------------------------- // // Rafael Lopez 07/20/00 // University of California Riverside // Department of Computer Science -- Embedded Systems // // ---------------------------------------------------------------------------- #ifndef SIM2_H #define SIM2_H #include // --------------------------------------------------------------------------- // // Constants // // --------------------------------------------------------------------------- static const unsigned int byte = 8; static const unsigned int mask = 128; static const unsigned int adrs = 4; static const unsigned int progsize = 1024; static const unsigned int memsize = 256; static const unsigned int regs = 16; static const unsigned int cycles = 4; enum { MOV0, MOV1, MOV2, MOV3, ADD, SUB, JZ }; // -------------------------------------------------------------------------- // // Instruction Structure // // -------------------------------------------------------------------------- struct instruction { int OPCODE; int Rn; int Rm; }; instruction program[ progsize ]; int memory[ memsize ] = {0}; // -------------------------------------------------------------------------- // // Functions // // -------------------------------------------------------------------------- int decode( ifstream &, int , int ); void twos_complement( int ); int run_program( int ); void print_stats( int [], int ); #endif;