diff options
| author | Julian Blake Kongslie | 2022-10-31 19:26:35 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-31 19:26:35 -0700 |
| commit | 6ffe43a8ccee6f3e2d6fda5062901f16c54ddaad (patch) | |
| tree | 5358c32b23130bd65ed191e3959c7ce7dd048f21 | |
| parent | Unify TT_INPUT_INT_ENABLE and TT_OUTPUT_INT_ENABLE (diff) | |
| download | biggolf-6ffe43a8ccee6f3e2d6fda5062901f16c54ddaad.tar.xz | |
Level-trigger on TTO_FLAG instead of edge-trigger.
Diffstat (limited to '')
| -rw-r--r-- | io/model.cpp | 3 | ||||
| -rw-r--r-- | isa/decode.cpp | 6 | ||||
| -rw-r--r-- | isa/isa.h | 1 |
3 files changed, 4 insertions, 6 deletions
diff --git a/io/model.cpp b/io/model.cpp index 3bea59e..fcabbd2 100644 --- a/io/model.cpp +++ b/io/model.cpp | |||
| @@ -29,7 +29,7 @@ bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) { | |||
| 29 | interrupt = true; | 29 | interrupt = true; |
| 30 | } | 30 | } |
| 31 | if (ctlregs[TT_INT_ENABLE]) { | 31 | if (ctlregs[TT_INT_ENABLE]) { |
| 32 | if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) | 32 | if (ctlregs[TT_BITS] & TTO_FLAG) |
| 33 | interrupt = true; | 33 | interrupt = true; |
| 34 | } | 34 | } |
| 35 | ctlregs[INT_PENDING] = interrupt; | 35 | ctlregs[INT_PENDING] = interrupt; |
| @@ -40,7 +40,6 @@ bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) { | |||
| 40 | ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; | 40 | ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; |
| 41 | ctlregs[HALTED] = 0; | 41 | ctlregs[HALTED] = 0; |
| 42 | ctlregs[INT_ENABLE] = 0; | 42 | ctlregs[INT_ENABLE] = 0; |
| 43 | ctlregs[TT_BITS] |= (ctlregs[TT_BITS] & TTO_FLAG) ? TTO_FLAG_OLD : 0; | ||
| 44 | } else { | 43 | } else { |
| 45 | ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; | 44 | ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; |
| 46 | } | 45 | } |
diff --git a/isa/decode.cpp b/isa/decode.cpp index c11679c..1496364 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp | |||
| @@ -185,7 +185,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 185 | inst.read_ctlreg = TT_BITS; | 185 | inst.read_ctlreg = TT_BITS; |
| 186 | inst.write_ctlreg = TT_BITS; | 186 | inst.write_ctlreg = TT_BITS; |
| 187 | inst.ef = [](auto &ctx) { | 187 | inst.ef = [](auto &ctx) { |
| 188 | ctx.ctlval.value() |= TTO_FLAG | TTO_FLAG_OLD; | 188 | ctx.ctlval.value() |= TTO_FLAG; |
| 189 | }; | 189 | }; |
| 190 | break; | 190 | break; |
| 191 | case 1: | 191 | case 1: |
| @@ -202,7 +202,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 202 | inst.read_ctlreg = TT_BITS; | 202 | inst.read_ctlreg = TT_BITS; |
| 203 | inst.write_ctlreg = TT_BITS; | 203 | inst.write_ctlreg = TT_BITS; |
| 204 | inst.ef = [](auto &ctx) { | 204 | inst.ef = [](auto &ctx) { |
| 205 | ctx.ctlval.value() &= ~TTO_FLAG & ~TTO_FLAG_OLD; | 205 | ctx.ctlval.value() &= ~TTO_FLAG; |
| 206 | }; | 206 | }; |
| 207 | break; | 207 | break; |
| 208 | case 4: | 208 | case 4: |
| @@ -235,7 +235,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 235 | inst.ef = [](auto &ctx) { | 235 | inst.ef = [](auto &ctx) { |
| 236 | auto &x = ctx.ctlval.value(); | 236 | auto &x = ctx.ctlval.value(); |
| 237 | auto chr = ctx.acc.value(); | 237 | auto chr = ctx.acc.value(); |
| 238 | x &= ~TTO_FLAG & ~TTO_FLAG_OLD & ~TTO_DATA; | 238 | x &= ~TTO_FLAG & ~TTO_DATA; |
| 239 | x |= (chr << TTO_DATA_SHIFT) & TTO_DATA; | 239 | x |= (chr << TTO_DATA_SHIFT) & TTO_DATA; |
| 240 | x |= TTO_TX; | 240 | x |= TTO_TX; |
| 241 | }; | 241 | }; |
| @@ -30,7 +30,6 @@ const std::map<std::string, ctlreg> ctlreg_map = { | |||
| 30 | static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; | 30 | static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; |
| 31 | static constexpr std::uint_fast32_t TTO_TX = 1 << 1; | 31 | static constexpr std::uint_fast32_t TTO_TX = 1 << 1; |
| 32 | static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2; | 32 | static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2; |
| 33 | static constexpr std::uint_fast32_t TTO_FLAG_OLD = 1 << 3; | ||
| 34 | static constexpr unsigned int TTI_DATA_SHIFT = 8; | 33 | static constexpr unsigned int TTI_DATA_SHIFT = 8; |
| 35 | static constexpr unsigned int TTO_DATA_SHIFT = 16; | 34 | static constexpr unsigned int TTO_DATA_SHIFT = 16; |
| 36 | static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT; | 35 | static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT; |
