52 lines
No EOL
1.5 KiB
C++
52 lines
No EOL
1.5 KiB
C++
#ifndef CONSTANTS_H
|
|
#define CONSTANTS_H
|
|
|
|
#include <string>
|
|
// ==============================
|
|
// SIC/XE Architecture Constants
|
|
// ==============================
|
|
|
|
// Memory and system constants
|
|
constexpr int MEMORY_SIZE = 1 << 20; // 1 MB memory
|
|
constexpr int NUM_DEVICES = 256;
|
|
constexpr int WORD_SIZE = 24;
|
|
constexpr int WORD_MASK = 0xFFFFFF;
|
|
|
|
// SIC/XE floating point constants
|
|
constexpr int SICF_BITS = 48;
|
|
constexpr int SICF_FRAC_BITS = 40;
|
|
constexpr int SICF_EXP_BITS = 7;
|
|
constexpr int SICF_EXP_BIAS = 64;
|
|
constexpr unsigned long long SICF_FRAC_MASK = (1ULL << SICF_FRAC_BITS) - 1;
|
|
|
|
// SW register condition codes
|
|
constexpr int CC_LT = 0x0; // 00
|
|
constexpr int CC_EQ = 0x1; // 01
|
|
constexpr int CC_GT = 0x2; // 10
|
|
constexpr int CC_MASK = 0x3; // mask for 2 bits
|
|
|
|
// Instruction format bit masks
|
|
constexpr int TYPE3_4_SIC_MASK = 0xFC;
|
|
constexpr int NI_MASK = 0x03; // mask for n and i bits
|
|
constexpr int NI_SIC = 0x0;
|
|
|
|
constexpr int BP_BASE_REL_MASK = 0b10;
|
|
constexpr int BP_PC_REL_MASK = 0b01;
|
|
constexpr int BP_DIRECT_MASK = 0b00;
|
|
|
|
constexpr int BIT_E_MASK = 0x10; // mask for e bit in F4 and F3 instructions
|
|
|
|
//SIC/XE/XE
|
|
constexpr bool USE_EXTENDED_MODE = true;
|
|
constexpr int VECTOR_REG_SIZE = 4;
|
|
|
|
/* if structure is
|
|
/target/
|
|
|-> bin/simulator_exec
|
|
|-> res/
|
|
*/
|
|
// When running from project root (./target/bin/simulator_exec), resources are in ./target/res/
|
|
constexpr char PATH_RESOURCES[] = "./target/res/";
|
|
constexpr bool FILE_CONTAINS_WHITE_SPACES = true;
|
|
|
|
#endif // CONSTANTS_H
|