Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerii Butorin committed Apr 1, 2024
1 parent 627affd commit c2e82e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions examples/microarch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
mock: true
type: fx32.32
ioSync: Sync
puLibrary:
isSlave: true
bufferSize: 6
bounceFilter: 0
networks:
net1:
pus:
Expand All @@ -9,9 +14,6 @@ networks:
miso: miso
sclk: sclk
cs: cs
isSlave: true
bufferSize: 6
bounceFilter: 0
protos:
- type: Fram
name: fram{x} # If you want a PU can be allocated only once, remove {x} from the PU name.
Expand All @@ -21,12 +23,10 @@ networks:
sRight: true
- type: Multiplier
name: mul{x}
mock: true
- type: Accum
name: accum{x}
isInt: true
- type: Divider
name: div{x}
mock: true
pipeline: 4

13 changes: 7 additions & 6 deletions src/NITTA/Model/Microarchitecture/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ data PUConf
| Divider
{ name :: T.Text
, pipeline :: Int
, mock :: Bool
}
| Multiplier
{ name :: T.Text
, mock :: Bool
}
| Fram
{ name :: T.Text
Expand Down Expand Up @@ -102,7 +100,8 @@ instance FromJSON NetworkConf
instance ToJSON NetworkConf

data MicroarchitectureConf = MicroarchitectureConf
{ valueType :: T.Text
{ mock :: Bool
, valueType :: T.Text
, valueIoSync :: IOSynchronization
, puLibrary :: PULibrary
, networks :: Map T.Text NetworkConf
Expand All @@ -111,11 +110,12 @@ data MicroarchitectureConf = MicroarchitectureConf

instance FromJSON MicroarchitectureConf where
parseJSON (Object v) = do
mock <- v .: "mock"
valueType <- v .: "type"
valueIoSync <- v .: "ioSync"
puLibrary <- v .: "puLibrary"
networks <- v .: "networks"
return MicroarchitectureConf{valueType, valueIoSync, puLibrary, networks}
return MicroarchitectureConf{mock, valueType, valueIoSync, puLibrary, networks}
parseJSON v = fail $ show v
instance ToJSON MicroarchitectureConf

Expand All @@ -128,6 +128,7 @@ mkMicroarchitecture conf =
let addPU proto
| proto = addCustomPrototype
| otherwise = addCustom
mock_ = mock conf
isSlave_ = isSlave . puLibrary $ conf
bufferSize_ = bufferSize . puLibrary $ conf
bounceFilter_ = bounceFilter . puLibrary $ conf
Expand All @@ -136,8 +137,8 @@ mkMicroarchitecture conf =
mapM_ (configure True) protos
where
configure proto Accum{name} = addPU proto name def PU.AccumIO
configure proto Divider{name, pipeline, mock} = addPU proto name (PU.divider pipeline mock) PU.DividerIO
configure proto Multiplier{name, mock} = addPU proto name (PU.multiplier mock) PU.MultiplierIO
configure proto Divider{name, pipeline} = addPU proto name (PU.divider pipeline mock_) PU.DividerIO
configure proto Multiplier{name} = addPU proto name (PU.multiplier mock_) PU.MultiplierIO
configure proto Fram{name, size} = addPU proto name (PU.framWithSize size) PU.FramIO
configure proto Shift{name, sRight} = addPU proto name (PU.shift $ Just False /= sRight) PU.ShiftIO
configure proto SPI{name, mosi, miso, sclk, cs} =
Expand Down

0 comments on commit c2e82e1

Please sign in to comment.