Comments (1)
Comment by HWoidt
Thursday Jan 21, 2016 at 15:32 GMT
This issue is a bit more involved than initially thought:
There is a simulation mismatch between Haskell and VHDL concerning the Integer types:
- Haskell: Native Int8,Int16,... have traditional wrap-around semantics
- VHDL: Integers will not wrap around (-128 -1 = -129 which is not a valid Integer value)
For this specific example, the bug originates in the fact, that all processes are executed once initially. That way the nextState function is called once with the initial value of the delayOut signal, and not with the one assigned by the reset statement (if reset then delay = 0...).
This nextState function is not formally correct VHDL as it produces an invalid output for the valid (although not normally attainable) input of -128. This specific input value is the default initial value for the Integer type.
There are some options for solving this:
- Fix the simulation mismatch: Implement the Int8 type using numeric_std.unsigned instead of Integer in VHDL. This has the correct semantics regarding the Haskell-Int8 type and would make this simulate correctly in this context.
- Fix the initial values of all signals connected to the delay element. This would need to have some way of tracing the netlist and catch all the important signals.
- fix the example to behave correctly for out-of range values less then 0 (which doesn't solve the underlying issue):
nextStateFun = $(newProcFun
[d| nextState state dir
= if dir == H then
if state < 9 then state + 1
else 0
else
if state <= 0 then 9
else state - 1
|])
I currently have no estimate of the amount of work needed for either 1. or 2.
from forsyde-deep.
Related Issues (20)
- Redesign: Netlist Node data structure (NlNode)
- VHDL backend support for arbitrary function orders in where clauses
- Provide line and file information in errors
- [CLOSED] VHDL functions for the AbstExt type are not generated correctly HOT 1
- [CLOSED] Synthesis of FSVec HOT 5
- [CLOSED] Counter hw issue24 HOT 1
- Print version information
- [CLOSED] Porting ghc7101
- Migrate this repository to the public github HOT 5
- [CLOSED] Introduce new FSDTypeRep type
- GHC 7.8.4 compatibility HOT 2
- [CLOSED] Remove redundant use of the array package
- GHC 8.0 Compatibility HOT 3
- Create a stable master version
- Not compatible with ghc-8.2 HOT 1
- ForSyDe-Deep Webpage
- Prepare forsyde-deep release HOT 1
- take in FSVec HOT 4
- multidimentional fixed size vector error in modelsim simulation on generated vhdl code 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 forsyde-deep.