Advertisement
gasolinewaltz

4241.h

Nov 3rd, 2011
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #ifndef _4241_h_
  2. #define _4241_h_
  3.  
  4. #include<stdint.h>
  5. /*/////////////////////////////
  6.   A 4241 microprocessor
  7.        
  8.         consists of two 4-bit registers, a 4-bit program counter,
  9.         16 4-bit memory slots and 16 logic instructions. See program
  10.         implementation file for an idea of how to write programs
  11.         for the chip.
  12.  
  13. *//////////////////////////////
  14.  
  15. class Chip_4241{
  16.    
  17.     //The program counter
  18.     uint8_t pc : 4;
  19.    
  20.     //The memory cell is comprised of array of objects CELL[16]
  21.     struct MemoryCell{
  22.         uint8_t SLOT : 4;
  23.     } CELL[16];
  24.  
  25.     //A and B defined objects of struct registers
  26.     struct Registers{
  27.         uint8_t REG : 4;
  28.     }A, B;
  29. public:
  30.  
  31.     //constructor
  32.     Chip_4241();
  33.  
  34.     //execute flag
  35.     bool HAULT;
  36.  
  37.     //function that reads the current memory cell and increases the pc
  38.     void read_instruction( );
  39.     void debug();
  40. };
  41.  
  42. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement