tuura / plato

A DSL for asynchronous circuits specification
Other
12 stars 2 forks source link

Add program to simulate at runtime #23

Closed mvdan closed 8 years ago

mvdan commented 8 years ago

You'll need hint installed.

Usage:

 $ runghc Simulate.hs concept-examples/Concept.hs
Signal names: ["A","B","C"]
Circuit signals: 3

State: 000
Enabled: [A+,B+]
Do: A+
State: 100
Enabled: [B+]
Do: B+
State: 110
Enabled: [C+]
Do: C+
State: 111
Enabled: [A-,B-]
snowleopard commented 8 years ago

This is great. Ping once you are happy with the result.

mvdan commented 8 years ago

IMO the only thing holding this from merging is the hard-coding of Signal. So once you get the signal stuff worked out in master, I can probably adapt both the sample input file and Main.hs to use it, allowing for concept-simulate to work with any input and not just those using A | B | C.

snowleopard commented 8 years ago

OK, I'll do my best to finish the Signal stuff soon.

mvdan commented 8 years ago

@snowleopard I removed the WIP as the two things left to do are done.

There are two major pitfalls with the current implementation that I left as TODOs. The first is that currently A | B | C don't play any role, other than giving the names to [0..n-1]. The other is that we assume that the initial state is in terms of a currently, so it will probably break if it's something other than const Bool.

I've documented everything, but it's not easy to read and understand. So we can go through it together tomorrow if you like.

mvdan commented 8 years ago

Also, I've left all commits as they illustrate the history of how I came up with this result. I'll squash before we merge.

mvdan commented 8 years ago

What do you think about making the inital state in terms of arguments too? For example:

initialState :: (Eq a) => a -> a -> a -> State a
initialState a b c = State (== a)

Or perhaps the initial state shouldn't be defined in the user-provided file, along with the circuit? I could ask for it to be specified interactively at the start of the program.

mvdan commented 8 years ago

@snowleopard stack (windows) is using an older version of hint (0.4.3, not 0.5.1). Any idea why that would be? cabal (linux) is using the correct version (the latest).

snowleopard commented 8 years ago

:+1: Windows build is failing though -- can we fix that?

snowleopard commented 8 years ago

:tada: