Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace toml to yaml #276

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

dokerplp
Copy link
Collaborator

No description provided.

networks:
- name: net1
pus:
- type: SPI
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use name as key here? Do you see any disadvantages of this approuch?

The same for the network

isSlave: true
bufferSize: 6
bounceFilter: 0
protos:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let move it to the top level as puLibrary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is about all PUs, which nitta can allocate automatically. Current -- in network. Should be -- on the top level & network.

name: fram{x} # If you want a PU can be allocated only once, remove {x} from the PU name.
size: 32
- type: Shift
name: shift{x}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what this special syntax means?

isInt: true
- type: Divider
name: div{x}
mock: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be nice to make possible to set this attr globally.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock -- attr used for logic simulation via icarus verilog for complex PU, like divider.

Usually, we don't need to specify it for PUs independently, so it will be nice to move it on the top level.

newtype MicroarchitectureConf = MicroarchitectureConf
{ networks :: [NetworkConf]
data MicroarchitectureConf = MicroarchitectureConf
{ type' :: T.Text
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to name it like valueType. ' can be confusing here.

In the future, it is possible to make type specific for each network.

{ networks :: [NetworkConf]
data MicroarchitectureConf = MicroarchitectureConf
{ type' :: T.Text
, ioSync' :: IOSynchronization
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same idea on '

Nothing -> return Nothing
Just path -> Just . getToml <$> T.readFile path
Just path -> Just <$> parseConfig path
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like parseConfig <$> path should work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseConfig is a FilePath -> IO MicroarchitectureConf type
path is a FilePath type
<$> is a (a -> b) -> f a -> f b type

The result must be type of IO Maybe MicroarchitectureConf, so Just <$> parseConfig pathdoesn't seem to be able to be simplified.

}
deriving (Generic, Show)

instance FromJSON MicroarchitectureConf
instance FromJSON MicroarchitectureConf where
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to do it via Generic?

Copy link
Collaborator Author

@dokerplp dokerplp Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't work out ¯\_(ツ)_/¯

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. Maybe because you need to use HashMap instead of Map.

type' <- v .: "type"
ioSync' <- v .: "ioSync"
networks <- v .: "networks"
return MicroarchitectureConf{type' = type', ioSync' = ioSync', networks = networks}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decodeFileThrow path :: IO MicroarchitectureConf

mkMicroarchitecture :: (Val v, Var x, ToJSON x) => MicroarchitectureConf -> BusNetwork T.Text x v Int
mkMicroarchitecture conf =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use record syntax here

@dokerplp dokerplp requested a review from ryukzak April 13, 2024 18:08
Copy link
Owner

@ryukzak ryukzak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better. Can you add generation of configuration file to the target project and small unit test, like it described in #263

After that I will ry it locally.

mock: true
type: fx32.32
ioSync: Sync
puLibrary:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Here we have misunderstanding. The idea behind this: describe library of process unit to be allocated in separated place, with name "library" intead of "proto"

}
deriving (Generic, Show)

instance FromJSON MicroarchitectureConf
instance FromJSON MicroarchitectureConf where
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. Maybe because you need to use HashMap instead of Map.

@dokerplp dokerplp requested a review from ryukzak May 1, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants