Comments (2)
Thanks a lot for the report. I will expand on the following when I have time (probably next week, if that's OK).
-
On DerivingShow: It could/should be made smarter to avoid collisions; in the meantime it's the user's job to provide custom names or avoid collisions in naming. Using $ would lead to less readable names in C++, so I'm not too sure about that.
-
On vectors: The way reg_t works makes the semantics a lot simpler (no need to reason about finite sets of strings). Kôika lets you define family of vectors, and in your example they indeed don't all have the same size.
-
On verilog names: we should do proper encoding of names like it's done in C++ (where we need tricks to avoid
__
, for example).
from koika.
As promised, some details:
In practice, this problem is easy to deal with and in fact the solution is always some register renamings away.
I think that's key. I'd rather not invest too much in generating complicated names, since renaming makes the generated nicer too. We could try to issue a warning in case of name collisions, though. And we should definitely check for too-long verilog names.
The context of this question is that I am looking for a way to generate Verilog through Kôika in such a way as to get BRAM blocks to be used through inference when using vectors past a certain size.
That's a nice goal, though I think it's a bit hard with the current Kôika set-up. The issue is basically that in Kôika right now everything needs to be reversible, and writing to a BRAM isn't really, so you need to make sure that you write to the corresponding array only from a rule that cannot fail. Without doing guard lifting or similar tricks, you find yourself playing the game that the memory bus rule plays in the RV core. The general solution would be to have a clean notion of modules with a request/response interface, and @threonorm is working on that.
This does not correspond to a vector in the traditional sense and it would in particular not be suitable for BRAM storage. Is this behavior desired or just a natural consequence of the way registers are managed?
It's desired; for a bram-style device, you'd probably want to use array_t instead — but for reasons of trust we actually compile arrays away when lowering to Verilog (it wasn't always like that; we used to produce arrays in the generated Verilog, but we removed them after a while). Reintroducing types at the RTL level could be a good way to start tackling this problem; it would also make it possible to introduce a bram type. But it would be quite a bit of work.
am I missing situations where a full blown inductive type is useful?
You get very nice compositionality properties from using an inductive; in particular, you can nicely isolate the type of each submodules without having to deal with strings (that is precisely the kind of aliasing problems that pop up when using show
), and you can trivially define environments based on FiniteType instances.
from koika.
Related Issues (18)
- Building error (Ocaml 4.11.1) HOT 10
- About the upcoming module system and Kôika's semantics HOT 1
- `unit_t` in ext_fn_t input generates invalid verliog HOT 8
- External function incorrectly pruned if rule is otherwise uneffectful HOT 3
- Context unknown during type checking HOT 2
- Different behavior in simulation and FPGA HOT 3
- Avoidable stalling in the RISC-V example HOT 2
- Potential optimization in the RISC-V example HOT 5
- Multiplier correctness example HOT 1
- Build issues on macOS HOT 26
- Some circuits that include extcalls behave unexpectedly when simulated through Verilator HOT 3
- Infinite loop HOT 4
- "make verilator-tests" results in a failure (cannot find file containing module: 'ext_host_id') HOT 2
- Outdated information in examples/rv/README.rst HOT 8
- Errors in examples/rv/MultiplierCorrectness.v HOT 2
- Proof failures with (unsupported) Coq 8.12 HOT 3
- Warning message about Boost version triggers spuriously HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koika.