summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2014-09-18 19:44:51 +0200
committerrekado <rekado@elephly.net>2014-09-18 19:44:51 +0200
commitb04789463fac0da8f3a443b08080630650d12f9f (patch)
treeb6183a0cd553258f4a2cda48e17ba080a232f0d8
parenta0075f5bdcf11206e78795811049b389d22187c7 (diff)
flip Read/Write, Data/Prog, Jump/Call
-rw-r--r--SHARC/Instruction.hs18
-rw-r--r--SHARC/Types.hs1
2 files changed, 9 insertions, 10 deletions
diff --git a/SHARC/Instruction.hs b/SHARC/Instruction.hs
index 5c3b1bf..4073248 100644
--- a/SHARC/Instruction.hs
+++ b/SHARC/Instruction.hs
@@ -301,8 +301,8 @@ parseType3 w = Type3 cond compute ireg mreg ureg rw mem wa up
ireg = mkIreg $ w64 `cutMask` [b| 000 0 111 000 00000 000 0000000 0000000 00000000 00000000 |]
mreg = mkMreg $ w64 `cutMask` [b| 000 0 000 111 00000 000 0000000 0000000 00000000 00000000 |]
ureg = mkUreg $ w64 `cutMask` [b| 000 0 000 000 00000 000 1111111 0000000 00000000 00000000 |]
- rw = if w64 `testBit` 31 then Read else Write
- mem = if w64 `testBit` 32 then Data else Prog
+ rw = if w64 `testBit` 31 then Write else Read
+ mem = if w64 `testBit` 32 then Prog else Data
wa = if w64 `testBit` 30 then LW else NW
up = if w64 `testBit` 44 then PostModify else PreModify
@@ -314,8 +314,8 @@ parseType4 w = Type4 cond compute dat dreg ireg rw mem up
dat = w64 `cutMask` 0x0001F8000000
dreg = mkDreg $ w64 `cutMask` 0x000007800000
ireg = mkIreg $ w64 `cutMask` [b| 000 0 111 000 00000 000 0000000 0000000 00000000 00000000 |]
- rw = if w64 `testBit` 39 then Read else Write
- mem = if w64 `testBit` 40 then Data else Prog
+ rw = if w64 `testBit` 39 then Write else Read
+ mem = if w64 `testBit` 40 then Prog else Data
up = if w64 `testBit` 38 then PostModify else PreModify
parseType5 w = if w64 `testBit` 43
@@ -337,8 +337,8 @@ parseType6 w = if w64 `testBit` 47
dreg = mkDreg $ w64 `cutMask` [b| 0000 000 000 00000 00 0000 1111 0 000000 00000000 0000 0000 |]
ireg = mkIreg $ w64 `cutMask` [b| 0000 111 000 00000 00 0000 0000 0 000000 00000000 0000 0000 |]
mreg = mkMreg $ w64 `cutMask` [b| 0000 000 111 00000 00 0000 0000 0 000000 00000000 0000 0000 |]
- rw = if w64 `testBit` 31 then Read else Write
- mem = if w64 `testBit` 32 then Data else Prog
+ rw = if w64 `testBit` 31 then Write else Read
+ mem = if w64 `testBit` 32 then Prog else Data
in
Type6WithDataAccess cond shiftField dreg ireg mreg rw mem
else -- without data access
@@ -359,7 +359,7 @@ parseType8 :: (Word32 -> Address24) -> Word48 -> Instruction
parseType8 addressConstr w = Type8 t cond addr a d c
where
w64 = word48ToWord64 w
- t = if w64 `testBit` 39 then Jump else Call
+ t = if w64 `testBit` 39 then Call else Jump
cond = mkCond w
addr = addressConstr $ w64 `cutMask` 0x000000FFFFFF
a = w64 `testBit` 38 -- loop abort
@@ -400,8 +400,8 @@ parseType13 w = Type13 term reladdr
parseType14 w = Type14 rw mem wa ureg addr
where
w64 = word48ToWord64 w
- rw = if w64 `testBit` 40 then Read else Write
- mem = if w64 `testBit` 41 then Data else Prog
+ rw = if w64 `testBit` 40 then Write else Read
+ mem = if w64 `testBit` 41 then Prog else Data
wa = if w64 `testBit` 39 then LW else NW
ureg = mkUreg $ w64 `cutMask` 0x00EF00000000
addr = Address32 $ w64 `cutMask` 0x0000FFFFFFFF
diff --git a/SHARC/Types.hs b/SHARC/Types.hs
index 47e4686..e58fed3 100644
--- a/SHARC/Types.hs
+++ b/SHARC/Types.hs
@@ -153,7 +153,6 @@ toWord32 (a,b,c,d) = fromIntegral a `shift` 24 .|.
data Update = PreModify -- 0, no update
| PostModify -- 1, with update
--- TODO: check again Table 1-7 Opcode Acronyms to be sure that the mapping order is right!
type PushPops = ([String], [String])
data Memory = Data -- data memory