Skip to content

Commit 630e9fc

Browse files
committed
finish lab3_hls
can run
1 parent 66e53c8 commit 630e9fc

File tree

1,614 files changed

+1316652
-17002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,614 files changed

+1316652
-17002
lines changed

README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
- [3.6 实验 6](#36-实验-6)
1717
- [4.HLS\_lab](#4hls_lab)
1818
- [4.1 实验1](#41-实验1)
19-
- [4.2 实验2(linux问题)](#42-实验2linux问题)
20-
- [4.3 实验3(linux问题)](#43-实验3linux问题)
19+
- [4.2 实验2](#42-实验2)
20+
- [4.3 实验3](#43-实验3)
2121
- [4.4 实验4](#44-实验4)
2222
- [5.课程设计(开发中)](#5课程设计开发中)
2323
- [勘误](#勘误)
@@ -477,9 +477,24 @@ clogb2(DIVIDER)的作用是计算DIVIDER的二进制位数,这样就可以得
477477
## 4.1 实验1
478478
这个实验可以注意到有很多个版本,首先是最原始的使用vivadoHLS的版本,这个适用较老的工具。其次是Vitis HLS的版本,这个适用于较新的工具。还有最新的Vitis版本,这个版本我使用跑完了实验1同时有一个教学文档。</p>
479479
> **Vitis的教学文档** [Vitis开发lab1](./datasheet/lab1_vitis.pdf)
480-
## 4.2 实验2(linux问题)
481-
## 4.3 实验3(linux问题)
480+
## 4.2 实验2
481+
可与使用强制命令打开Vitis_HLS软件的项目,使用代码:</p>
482+
```
483+
vitis_hls -p <your prj name> -classic
484+
```
485+
请注意,要使用Vitis_HLS的命令行工具完成该操作。
486+
<p align="center">
487+
<img src ="./images/Figure1.jpg">
488+
</p>
489+
<p align = "center">
490+
<i>打开会提示GUI未来将会弃用</i>
491+
</p>
492+
<sub>本人遇到一定的小问题无法正常打开,但是这个流程操作应该是没有太大问题的</sub>
493+
## 4.3 实验3
494+
make之后可以使用类似于lab1的教程部分,使用Vitis进行操作,可以跟着跑完流程。</p>
495+
几乎一样 只是前面的选择文件还有top_function命名之类的不一样而已。
482496
## 4.4 实验4
497+
官方仓库有一个是直接打包好的prj,使用Vitis的terminal直接编译TCL文件即可直接输出最后的IP核文件。
483498

484499
## 5.课程设计(开发中)
485500

ZedBoard/HLS_lab/lab2/.wsdata/clang_dir_map.json

-8
This file was deleted.

ZedBoard/HLS_lab/lab2/Makefile

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# MIT License
2+
# Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
# SOFTWARE.
21+
# makefile-generator v1.0.3
22+
23+
# ######################################################
24+
# Define design information
25+
# - assumes the design files are .c (update to .cpp for C++ and SystemC)
26+
# - assumes test bench is <design>_test.c
27+
28+
DESIGN := yuv_filter
29+
SOURCES := $(DESIGN).c $(DESIGN)_test.c image_aux.c
30+
OBJECTS := $(SOURCES:.c=.o)
31+
INCLUDES := $(DESIGN).h image_aux.h
32+
CLEAN_FILES := $(OBJECTS) $(DESIGN) $(DESIGN).exe
33+
CLEAN_FILES += test_data/output.dat
34+
VIVADO_HLS_CLEANUP := $(DESIGN)_prj $(DESIGN).log vivado_hls.log
35+
# Change to true if using ap[u]int in ISO-C project
36+
USE_ARBITRARY_PRECISION = false
37+
# Change to true if using SystemC types or SC_MODULE, etc.
38+
USE_SYSTEMC = false
39+
40+
# ######################################################
41+
# Automatically setup the software paths
42+
SHELL := sh
43+
KERNEL := Win
44+
ARCH := x86_64
45+
OS := $(KERNEL)_$(ARCH)
46+
47+
# Vitis HLS specific configuration
48+
VITIS_HLS_EXE_FILENAME := vitis_hls.exe # For Windows; use vitis_hls for Linux
49+
APCC= $(VITIS_HLS_ROOT)/$(OS)/bin/apcc_bin.exe
50+
51+
# Directly reference the Vitis HLS executable
52+
VITIS_HLS_EXE := E:/vivado/Vitis/2024.1/bin/vitis_hls.exe
53+
54+
VITIS_HLS_ROOT := $(VITIS_HLS_EXE:/bin/$(VITIS_HLS_EXE_FILENAME)=)
55+
56+
# Include and library paths
57+
VITIS_HLS_INC_PATH := $(VITIS_HLS_ROOT)/include
58+
SYSTEMC_INC_PATH := $(VITIS_HLS_ROOT)/$(OS)/tools/systemc/include
59+
SYSTEMC_LIB_PATH := $(VITIS_HLS_ROOT)/$(OS)/tools/systemc/lib
60+
61+
62+
# ######################################################
63+
# Setup C compiler and options
64+
#
65+
# Use APCC for ISO-C projects that use ap[u]int types; gcc otherwise
66+
ifeq ($(USE_ARBITRARY_PRECISION),true)
67+
CC := $(APCC)
68+
CFLAGS += -DBIT_ACCURATE
69+
else
70+
CC := gcc
71+
endif
72+
CXX := g++
73+
# C compiler flags
74+
CFLAGS += -ggdb
75+
CFLAGS += -w
76+
CFLAGS += -I$(VIVADO_HLS_INC_PATH)
77+
# C++ compiler flags
78+
CXXFLAGS += -ggdb
79+
CXXFLAGS += -I$(VIVADO_HLS_INC_PATH)
80+
# Linker flags
81+
LDFLAGS += -lm
82+
# # SystemC additional flags
83+
ifeq ($(USE_SYSTEMC), true)
84+
CXXFLAGS += -I$(SYSTEMC_INC_PATH)
85+
LDFLAGS += -L$(SYSTEMC_LIB_PATH)
86+
LDLIBS += -lsystemc
87+
endif
88+
89+
# ######################################################
90+
# Rules
91+
92+
all: sim
93+
94+
clean:
95+
rm -rf $(CLEAN_FILES) $(VIVADO_HLS_CLEANUP)
96+
97+
VIVADO_HLS: $(DESIGN).tcl
98+
vitis_hls $<
99+
100+
sim: $(DESIGN)
101+
./$(DESIGN)
102+
103+
$(DESIGN): $(OBJECTS)
104+
# Uses implicit recipes, i.e.:
105+
# $([CC|CXX]) $(CPPFLAGS) $([CFLAGS|CXXFLAGS]) -c # For each SOURCE
106+
# $(CC) $(LDFLAGS) $(OBJECTS) $(LOADLIBES) $(LDLIBS) # To link OBJECTS
107+
108+
# TODO: add rule to rebuild OBJECT when its .h file changes

ZedBoard/HLS_lab/lab2/image_aux.c

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// MIT License
2+
// Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in all
12+
// copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// SOFTWARE.
21+
#include <stdio.h>
22+
#include "image_aux.h"
23+
24+
25+
void image_read (
26+
image_t *in_image
27+
) {
28+
image_dim_t width, height;
29+
int x, y;
30+
FILE *fp;
31+
32+
fp=fopen("test_data/input.dat","r");
33+
int tmp;
34+
fscanf(fp, "%d", &tmp);
35+
width = tmp;
36+
fscanf(fp, "%d", &tmp);
37+
height = tmp;
38+
39+
in_image->width = width;
40+
in_image->height = height;
41+
for (x=0;x<width;x++) {
42+
for (y=0;y<height;y++) {
43+
fscanf(fp, "%d", &tmp);
44+
in_image->channels.ch1[x][y] = tmp;
45+
fscanf(fp, "%d", &tmp);
46+
in_image->channels.ch2[x][y] = tmp;
47+
fscanf(fp, "%d", &tmp);
48+
in_image->channels.ch3[x][y] = tmp;
49+
}
50+
}
51+
fclose(fp);
52+
53+
}
54+
55+
56+
void image_write (
57+
image_t *out_image
58+
) {
59+
FILE *fp;
60+
int x, y;
61+
image_dim_t width, height;
62+
image_pix_t tmp;
63+
64+
fp=fopen("test_data/output.dat","w");
65+
66+
width = out_image->width;
67+
fprintf(fp, "%d \n", width);
68+
69+
height = out_image->height;
70+
fprintf(fp, "%d \n", height);
71+
72+
for (y=0;y<height;y++) {
73+
/* Scan-line: */
74+
for (x=0;x<width;x++) {
75+
tmp = out_image->channels.ch1[x][y];
76+
fprintf(fp, "%d\n", tmp);
77+
tmp = out_image->channels.ch2[x][y];
78+
fprintf(fp, "%d\n", tmp);
79+
tmp = out_image->channels.ch3[x][y];
80+
fprintf(fp, "%d\n", tmp);
81+
}
82+
}
83+
fclose(fp);
84+
}

ZedBoard/HLS_lab/lab2/image_aux.h

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// MIT License
2+
// Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in all
12+
// copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// SOFTWARE.
21+
#ifndef IMAGE_AUX_H_
22+
#define IMAGE_AUX_H_
23+
24+
#ifdef BIT_ACCURATE
25+
#include "autopilot_tech.h"
26+
27+
typedef uint8 image_pix_t;
28+
typedef uint11 image_dim_t;
29+
30+
#else // Use native C types
31+
32+
typedef unsigned char image_pix_t;
33+
typedef unsigned short image_dim_t;
34+
35+
#endif // ifdef BIT_ACCURATE
36+
37+
#define WIDTH 1920
38+
#define HEIGHT 1280
39+
40+
typedef struct {
41+
image_pix_t ch1[WIDTH][HEIGHT];
42+
image_pix_t ch2[WIDTH][HEIGHT];
43+
image_pix_t ch3[WIDTH][HEIGHT];
44+
} channel_t;
45+
46+
typedef struct {
47+
channel_t channels;
48+
image_dim_t width;
49+
image_dim_t height;
50+
} image_t;
51+
52+
void image_read(image_t *in_image);
53+
54+
void image_write(image_t *out_image);
55+
56+
#endif

ZedBoard/HLS_lab/lab2/image_aux.o

4.91 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

ZedBoard/HLS_lab/lab2/lab2/compile_commands.json

-38
This file was deleted.

ZedBoard/HLS_lab/lab2/lab2/hls_config.cfg

-11
This file was deleted.

ZedBoard/HLS_lab/lab2/lab2/lab2/hls/.autopilot/db/.message_csim.xml

-8
This file was deleted.

0 commit comments

Comments
 (0)