-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Tools for PowerPC programs. -- -- An instruction set simulator for PowerPC programs. @package powerpc @version 0.0.1 module Language.PowerPC.Utils setBits :: Bits a => a -> [Int] -> a clearBits :: Bits a => a -> [Int] -> a module Language.PowerPC.RTL data RTL a RTL :: (Stmt -> (a, Stmt)) -> RTL a data Stmt Seq :: [Stmt] -> Stmt Assign :: [Cond] -> E -> E -> Stmt If :: E -> Stmt -> Stmt -> Stmt While :: E -> Stmt -> Stmt data E V :: String -> E C :: Integer -> E Add :: E -> E -> E Sub :: E -> E -> E Mul :: E -> E -> E Div :: E -> E -> E Not :: E -> E And :: E -> E -> E Or :: E -> E -> E BWNot :: E -> E BWAnd :: E -> E -> E BWOr :: E -> E -> E Shift :: E -> E -> E Eq :: E -> E -> E Lt :: E -> E -> E Null :: E Bit :: E -> Int -> E -> E AA :: E BA :: E BB :: E BD :: E BF :: E BI :: E BO :: E BT :: E CA' :: E CIA :: E CR' :: E CRField :: E -> E CTR :: E D :: E EA :: E EXTS :: Int -> E -> E GPR :: E -> E L10 :: E L15 :: E LI :: E LK :: E LR :: E -- | Mask start stop MASK :: E -> E -> E MB5 :: E MB6 :: E ME5 :: E ME6 :: E MEM :: E -> Int -> E MSR :: E NIA :: E OE :: E RAI :: E RA :: E RB :: E Rc :: E -- | ROTL32 value amount ROTL32 :: E -> E -> E -- | ROTL64 value amount ROTL64 :: E -> E -> E RS :: E RSI :: E RT :: E RTI :: E SH5 :: E SH6 :: E SI :: E SPR :: E UI :: E XER :: E data Cond CA :: E -> Cond OV :: E -> Cond CR :: E -> E -> Cond stmt :: RTL () -> Stmt (<==) :: E -> E -> RTL () assign :: [Cond] -> E -> E -> RTL () cmp :: [Cond] -> E -> E -> RTL () if' :: E -> RTL () -> RTL () -> RTL () while :: E -> RTL () -> RTL () (==.) :: E -> E -> E (/=.) :: E -> E -> E -- | Less than. (<.) :: E -> E -> E -- | Less than or equal. (<=.) :: E -> E -> E -- | Greater than. (>.) :: E -> E -> E -- | Greater than or equal. (>=.) :: E -> E -> E (&&.) :: E -> E -> E (||.) :: E -> E -> E instance Show Cond instance Eq Cond instance Ord Cond instance Show Stmt instance Eq Stmt instance Show E instance Eq E instance Ord E instance Bits E instance Num E instance Monad RTL module Language.PowerPC.Opcode opcode :: Word32 -> (Int, Int) module Language.PowerPC.Instructions -- | Extracts the RTL statements of an instruction. rtl :: Word64 -> Word32 -> (String, Stmt) -- | PowerPC instruction set simulation. module Language.PowerPC.Simulator -- | Memory interface. class Memory a load :: Memory a => a -> Word64 -> Int -> IO [Word8] store :: Memory a => a -> Word64 -> [Word8] -> IO () fetch :: Memory a => a -> Machine -> Word64 -> IO Word32 readSPR :: Memory a => a -> Int -> IO Word64 writeSPR :: Memory a => a -> Int -> Word64 -> IO () readMSR :: Memory a => a -> IO Word64 writeMSR :: Memory a => a -> Word64 -> IO () -- | State of processor. data Machine Machine :: Word64 -> Word64 -> Word64 -> [Word64] -> Word64 -> Word32 -> Machine pc :: Machine -> Word64 lr :: Machine -> Word64 ctr :: Machine -> Word64 gprs :: Machine -> [Word64] xer :: Machine -> Word64 cr :: Machine -> Word32 -- | Run simulation given memory and the starting address of program. simulate :: Memory a => a -> Word64 -> IO () -- | General tools for PowerPC programs. module Language.PowerPC