Comments (3)
Hi, the first issue you mention is actually a parsing issue with CompCert, it just doesn't allow empty initialiser lists. Instead the following will actually parse and compile with CompCert:
#define NUM_TAPS 4
void fir ( int input, int *output, int taps [NUM_TAPS] ) {
static int delay_line [NUM_TAPS] = {0};
int result = 0;
for ( int i = NUM_TAPS -1 ; i > 0 ; i--) {
delay_line[i] = delay_line[i - 1];
}
delay_line[0] = input;
for ( int i = 0 ; i < NUM_TAPS ; i ++ ) {
result += delay_line[i] * taps[i];
}
*output = result;
}
Finally though, unfortunavely Vericert doesn't support a large subset of C yet, so the designs that you can compile at the moment don't really look like typical HLS designs as you have written here. The below function will at least compile and kind of do what you want:
#define NUM_TAPS 4
int main ( int input ) {
int taps [NUM_TAPS] = {1, 2, 3, 4};
int delay_line [NUM_TAPS] = {0};
int result = 0;
for ( int i = NUM_TAPS -1 ; i > 0 ; i--) {
delay_line[i] = delay_line[i - 1];
}
delay_line[0] = input;
for ( int i = 0 ; i < NUM_TAPS ; i ++ ) {
result += delay_line[i] * taps[i];
}
return result;
}
In general though, the things that you are using which are not supported in Vericert but used all the time in HLS are (which actually incidentally all have to do with the simplistic memory handling in Vericert:
- Static variables, very useful for persistent state. This is related to the simplistic memory layout that Vericert supports.
- Passing arrays into functions as arguments.
- Returning a value by modifying a pointer.
- Supporting not having a
main
function. This one is also quite difficult to tackle, but would be necessary for the HLS tool to be usable in practice.
Thanks for trying out Vericert though! I'm happy you managed to compile it in the first place. I hope this helps, and let me know if you have any thoughts.
from vericert.
But I will admit, without static the second design I posted does not implement an FIR filter.
from vericert.
Thanks a lot for the detailed reply!
from vericert.
Related Issues (7)
- installation issue HOT 2
- `make` failed HOT 4
- Compile failed. HOT 2
- Implement Oshrximm HOT 1
- Optimise division implementation
- make error on macOS 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 vericert.