当前位置:网站首页>HLS Experiment 1 -- multiplier
HLS Experiment 1 -- multiplier
2022-07-26 02:23:00 【J-JMF】
HLS Experiment 1 -- Multiplier
Preface
This experiment uses two methods , They are calling components directly and calling components in a pipeline .
Functions used by the pipeline
1. Queueing function
ihc_hls_enqueue(void *retptr, void *funcptr,/*function arguments*/)
Parameters :
retptr: Return value
funcptr: To be called HLS component
This function is right for HLS A call of the component is queued . The return value is stored in the first argument , The argument should be a pointer to the return type . Calling ihc_hls_component_run_all() Before , The component will not run .
2. Queued function without return type
ihc_hls_enqueue_noret(void* funcptr,/*function arguments*/)
Parameters :
funcptr: To be called HLS component
This function is right for HLS A call of the component is queued . When HLS The return type of the component is void when , This function should be used . Calling ihc_hls_component_run_all() Before , The component will not run .
3. Open component function
ihc_hls_component_run_all(void* funcptr)
Parameters :
funcptr: To be called HLS component
This function accepts a point HLS Pointer to component function . All queued calls of the component will be pushed at run time , When the component can accept new calls ,HDL The simulator can run at the fastest speed .
Reference article
https://blog.csdn.net/qq_42585108/article/details/120614492
One 、 Call the component directly
#include<HLS/stdio.h>
#include<HLS/hls.h>
#include<assert.h>
#include<stdlib.h>
component int multiplication(int a,int b) {
return a * b;
}
int main() {
srand(0);
int i, x[10] = {
0 }, y[10] = {
0}, z[10] = {
0 };
for (i = 0; i < 10; i++) {
x[i]= rand() % 10;
y[i]= rand() % 10;
z[i]= multiplication(x[i], y[i]);
printf("%d = %d * %d \n", z[i],x[i],y[i]); // Print to see if it is correct
assert(z[i] == x[i] * y[i]); // Call the assertion function
}
return 0;
}
1. Generate hls Environmental Science 
2. Use i++ -march=x86-64 multiplication.c -v see C Whether the language is written correctly . And run the generated a.exe.
3. Use i++ -march=CycloneV multiplication.c -v -ghdl Conduct hls Writing on 
4. Run the generated a.exe File and run vsim a.prj/verification/vsim.wlf Conduct simulation 

Two 、 The method of using pipeline
#include<HLS/stdio.h>
#include<HLS/hls.h>
#include<assert.h>
#include<stdlib.h>
component int multiplication(int a,int b) {
return a * b;
}
int main() {
srand(0);
int i, x[10] = {
0 }, y[10] = {
0}, z[10] = {
0 };
for (i = 0; i < 10; i++) {
x[i]= rand() % 10;
y[i]= rand() % 10;
// z[i]= add(x[i], y[i]);
// printf("%d = %d + %d \n", z[i],x[i],y[i]);
ihc_hls_enqueue(&z[i], &add, x[i], y[i]);
//ihc_hls_enqueue_noret(&add, x, y);
//assert(z[i] == x[i] + y[i]);
}
ihc_hls_component_run_all(add);
return 0;
}
The first three steps are the same as the above , Let's look at the simulation directly

3、 ... and 、 The contrast between the two models
1. Simulation
Through the simulation of both, we can clearly see , We started when we called the component directly 10 Sub components , When using assembly line , It just calls 1 Sub components . This greatly saves our hardware resources .
2. The report
Report address :a.prj/reports/report.html

It is obvious from the report , The first method has no queued components , The second method is 10 individual .
边栏推荐
- [early knowledge of activities] list of recent activities of livevideostack
- 1. Mx6ul core module serial use - touch screen calibration (IX)
- Kaggle registration method to solve the problem of man-machine verification
- Prove that perfect numbers are even
- Sqlyog data import and export graphic tutorial
- 1. Mx6ul core module uses serial NAND FLASH read / write test (III)
- 1. Mx6ul core module serial USB interface test (VI)
- Master-slave replication in MySQL
- TCP三次握手四次挥手
- 18.删除链表的倒数第n个节点
猜你喜欢

Postman reported JSON serialization error

Adruino basic experimental learning (I)

Kaggle registration method to solve the problem of man-machine verification

1. Mx6ul core module use serial -rs485 test (x)

1. Mx6ul core module uses serial NAND FLASH read / write test (III)

Are you still using ==0 null equal to judge null values? How much do you know about isempty and isblank

Tenant issues.

How to choose cloud note tool? What can I do with cloud notes?

HLS实验一--乘法器

Postman报Json序列化错误
随机推荐
[纯理论] YOLO v4: Optimal Speed and Accuracy of Object Detection
Illustration of the insertion process of b+ tree
Project management: lean management method
[paper reading] coat: CO scale conv attentional image transformers
Tenant issues.
17_ Form Data
prometheus+redis-exporter+grafana 监控redis服务
Wechat applet decryption and unpacking to obtain source code tutorial
1. Mx6ul core module use serialization - view system information (II)
1. Mx6ul core module uses serial can and buzzer test (XI)
Pytorch的API总览
scipy.sparse.vstack
Ggplot2 learning summary
Sword finger offer 28. symmetric binary tree
1. Mx6ul core module use serial TF card read / write test (V)
Prometheus+blackbox exporter+grafana monitoring server port and URL address
Audio and video technology development weekly | 254
墨天轮高分技术文档分享——数据库安全篇(共48个)
How to choose cloud note tool? What can I do with cloud notes?
1. Mx6ul core module uses serial EMMC read / write test (IV)