summaryrefslogtreecommitdiff
path: root/isa/isa.h
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-29 18:18:26 -0700
committerJulian Blake Kongslie2022-10-29 18:18:26 -0700
commit9f4aa97822adc791f700670ef0fc7636849563b7 (patch)
tree0b9d6c1bb1d7d596501df3b77ab3d7b9f191aa4f /isa/isa.h
parentControl register values should not be "unsigned int" (diff)
downloadbiggolf-9f4aa97822adc791f700670ef0fc7636849563b7.tar.xz
Understanding interrupt handling within SIMH (see echo_int.pal)
Add list of Bugs Add event log file parser More changes associated with widening the ctlregs (FIXME add a typedef) Add some keyboard instructions
Diffstat (limited to 'isa/isa.h')
-rw-r--r--isa/isa.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/isa/isa.h b/isa/isa.h
index 84a783c..6484cd8 100644
--- a/isa/isa.h
+++ b/isa/isa.h
@@ -2,30 +2,39 @@
2 2
3#include <cstdint> 3#include <cstdint>
4#include <functional> 4#include <functional>
5#include <map>
5#include <optional> 6#include <optional>
7#include <string>
6 8
7enum ctlreg { 9enum ctlreg {
8 DATA_INSTRUCTION_FIELD_BUFFER, // (df << 3) | if_buffer 10#define REG(N) N,
9 DATA_INSTRUCTION_FIELD_SAVED, // (df_saved << 3) | if_saved 11#include "ctlreg.def"
10 HALTED, 12#undef REG
11 INT_ENABLE, // (int_enable_delay << 1) | int_enable
12 INT_PENDING, // only meaningful if interrupts disabled
13 TT_BITS, // see below TT[IO]_* consts
14 TT_INPUT_INT_ENABLE,
15 TT_OUTPUT_INT_ENABLE,
16 13
17 NUM_CTLREGS, 14 NUM_CTLREGS,
18}; 15};
19 16
17const char * const ctlreg_names[] = {
18#define REG(N) #N,
19#include "ctlreg.def"
20#undef REG
21};
22
23const std::map<std::string, ctlreg> ctlreg_map = {
24#define REG(N) { #N, N },
25#include "ctlreg.def"
26#undef REG
27};
28
20// TT_BITS 29// TT_BITS
21static constexpr unsigned int TTI_FLAG = 1 << 0; 30static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0;
22static constexpr unsigned int TTO_TX = 1 << 1; 31static constexpr std::uint_fast32_t TTO_TX = 1 << 1;
23static constexpr unsigned int TTO_FLAG = 1 << 2; 32static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2;
24static constexpr unsigned int TTO_FLAG_OLD = 1 << 3; 33static constexpr std::uint_fast32_t TTO_FLAG_OLD = 1 << 3;
25static constexpr unsigned int TTI_DATA_SHIFT = 8; 34static constexpr unsigned int TTI_DATA_SHIFT = 8;
26static constexpr unsigned int TTO_DATA_SHIFT = 16; 35static constexpr unsigned int TTO_DATA_SHIFT = 16;
27static constexpr unsigned int TTI_DATA = 0xff << TTI_DATA_SHIFT; 36static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT;
28static constexpr unsigned int TTO_DATA = 0xff << TTO_DATA_SHIFT; 37static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT;
29 38
30struct instruction_context { 39struct instruction_context {
31 // Known statically at decode time 40 // Known statically at decode time