Ensure that MimaMemory is always sparse
This commit is contained in:
parent
5fdbf2fbd2
commit
a1f532172a
1 changed files with 4 additions and 1 deletions
|
|
@ -33,7 +33,10 @@ addressRange (MimaMemory m) =
|
||||||
in [minBound..maxAddr]
|
in [minBound..maxAddr]
|
||||||
|
|
||||||
wordsToMemory :: [MimaWord] -> MimaMemory
|
wordsToMemory :: [MimaWord] -> MimaMemory
|
||||||
wordsToMemory = MimaMemory . Map.fromAscList . zip [minBound..]
|
wordsToMemory = MimaMemory
|
||||||
|
. Map.filter (/= zeroBits)
|
||||||
|
. Map.fromAscList
|
||||||
|
. zip [minBound..]
|
||||||
|
|
||||||
memoryToWords :: MimaMemory -> [MimaWord]
|
memoryToWords :: MimaMemory -> [MimaWord]
|
||||||
memoryToWords mem = map (\addr -> readAt addr mem) $ addressRange mem
|
memoryToWords mem = map (\addr -> readAt addr mem) $ addressRange mem
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue