From a5a5e7f275de6ec9784f75a3e2d313e4eee807fa Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 02:55:06 +0100 Subject: Initial (WIP) --- app/Arch/Dummy.hs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/Arch/Dummy.hs (limited to 'app/Arch/Dummy.hs') diff --git a/app/Arch/Dummy.hs b/app/Arch/Dummy.hs new file mode 100644 index 0000000..4d26369 --- /dev/null +++ b/app/Arch/Dummy.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE Strict #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} + +module Arch.Dummy + ( Process(..) + , procAncestor + , procMemBlocks + , procRep + , procSliceM + , procStepM + , bimapMnemonic + , bimapSymbol + ) where + +import Control.Monad.ST (ST) +import Data.Bimap (Bimap, fromList) +import Data.Vector.Unboxed.Deriving (derivingUnbox) +import qualified Data.Vector.Unboxed.Mutable as M (STVector) +import Data.Word (Word64, Word8) +import Text.Printf (printf) + +data Process = + Process + deriving (Show) + +$(derivingUnbox "Process" [t|Process -> Word64|] [|const 1|] [|const Process|]) + +procAncestor :: Process +procAncestor = Process + +procMemBlocks :: Process -> [(Word64, Word64)] +procMemBlocks _ = [] + +procRep :: Process -> [(String, String)] +procRep _ = [("dmmy", "----")] + +procSliceM :: M.STVector s Process -> M.STVector s Word8 -> Word64 -> ST s Word64 +procSliceM _ _ _ = return 1 + +procStepM :: M.STVector s Process -> M.STVector s Word8 -> Word64 -> ST s (Maybe Process) +procStepM _ _ _ = return Nothing + +bimapMnemonic :: Bimap Word8 [String] +bimapMnemonic = fromList [(i, ["dmmy", printf "0x%x" i]) | i <- [0 .. 0xff]] + +bimapSymbol :: Bimap Word8 Char +bimapSymbol = + fromList + $ zip [0 .. 0xff] + $ concat + [ "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟" + , "⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿" + , "⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟" + , "⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿" + ] -- cgit v1.2.1