Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _4241_h_
- #define _4241_h_
- #include<stdint.h>
- /*/////////////////////////////
- A 4241 microprocessor
- consists of two 4-bit registers, a 4-bit program counter,
- 16 4-bit memory slots and 16 logic instructions. See program
- implementation file for an idea of how to write programs
- for the chip.
- *//////////////////////////////
- class Chip_4241{
- //The program counter
- uint8_t pc : 4;
- //The memory cell is comprised of array of objects CELL[16]
- struct MemoryCell{
- uint8_t SLOT : 4;
- } CELL[16];
- //A and B defined objects of struct registers
- struct Registers{
- uint8_t REG : 4;
- }A, B;
- public:
- //constructor
- Chip_4241();
- //execute flag
- bool HAULT;
- //function that reads the current memory cell and increases the pc
- void read_instruction( );
- void debug();
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement