Skip to content

Commit 8768f22

Browse files
Merge branch 'master' into submodule_pycparser
2 parents e2660b3 + 5185a7a commit 8768f22

File tree

4,282 files changed

+1599
-5351
lines changed

Some content is hidden

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

4,282 files changed

+1599
-5351
lines changed

README.md

Lines changed: 1 addition & 1 deletion
File renamed without changes.
File renamed without changes.

examples/instance_array_fsms.c

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#include "intN_t.h"
2+
#include "uintN_t.h"
3+
4+
#define N_THREADS 10
5+
6+
// Each thread is providing these values to the increment handler module simultaneously
7+
uint32_t increment_input_value;
8+
uint32_t increment_input_tid;
9+
// And expects an output of the sum after the thread's addition (same cycle)
10+
uint32_t increment_output_sum;
11+
// A 'thread'/FSM instance definition trying to increment some accumulator this clock cycle
12+
uint32_t incrementer_thread(uint8_t tid)
13+
{
14+
while(1)
15+
{
16+
increment_input_value = tid + 1;
17+
increment_input_tid = tid;
18+
// increment_output_sum ready same cycle
19+
printf("Thread %d trying to increment by %d, got new total %d.\n",
20+
tid, increment_input_value, increment_output_sum);
21+
__out(increment_output_sum); // "return" that continues
22+
//return increment_output_sum;
23+
}
24+
}
25+
// Derive FSM from above function
26+
#include "incrementer_thread_FSM.h"
27+
28+
// The module doing the incrementing/accumulating
29+
// sees an array of values, one from each thread
30+
uint32_t increment_input_values[N_THREADS];
31+
uint32_t increment_input_tids[N_THREADS];
32+
#pragma INST_ARRAY increment_input_value increment_input_values
33+
#pragma INST_ARRAY increment_input_tid increment_input_tids
34+
// And drives output totals back to each thread as an array
35+
uint32_t increment_output_sums[N_THREADS];
36+
#pragma INST_ARRAY increment_output_sum increment_output_sums
37+
#pragma MAIN increment_handler
38+
void increment_handler()
39+
{
40+
// Accumulator reg
41+
static uint32_t total;
42+
43+
// In one cycle accumulate from each thread with chained adders
44+
uint32_t i;
45+
for(i=0; i<N_THREADS; i+=1)
46+
{
47+
increment_output_sums[i] = total + increment_input_values[i];
48+
printf("Thread %d incrementing total %d by %d -> new total %d.\n",
49+
increment_input_tids[i], total, increment_input_values[i], increment_output_sums[i]);
50+
total = increment_output_sums[i]; // accumulate
51+
}
52+
53+
return total;
54+
}
55+
56+
// Top level wrapper for N parallel instances of incrementer_thread
57+
58+
// Connect FSM outputs to top level output
59+
// So doesnt synthesize away
60+
typedef struct n_thread_outputs_t
61+
{
62+
incrementer_thread_OUTPUT_t data[N_THREADS];
63+
}n_thread_outputs_t;
64+
#pragma MAIN main
65+
n_thread_outputs_t main()
66+
{
67+
// Registers keeping time count and knowning when done
68+
static uint32_t clk_cycle_count;
69+
printf("Clock Cycle %d:\n", clk_cycle_count);
70+
71+
// N parallel instances of incrementer_thread
72+
uint8_t tid;
73+
incrementer_thread_INPUT_t inputs[N_THREADS];
74+
n_thread_outputs_t outputs;
75+
for(tid=0; tid<N_THREADS; tid+=1)
76+
{
77+
inputs[tid].tid = tid;
78+
inputs[tid].input_valid = 1;
79+
inputs[tid].output_ready = 1;
80+
outputs.data[tid] = incrementer_thread_FSM(inputs[tid]);
81+
//if(outputs.data[tid].input_ready)
82+
//{
83+
// printf("Clock# %d: Thread %d starting.\n",
84+
// clk_cycle_count, tid);
85+
//}
86+
//if(outputs.data[tid].output_valid)
87+
//{
88+
// printf("Clock# %d: Thread %d output value = %d.\n",
89+
// clk_cycle_count, tid, outputs.data[tid].return_output);
90+
//}
91+
}
92+
93+
// Func occuring each clk cycle
94+
clk_cycle_count += 1;
95+
96+
// Wire up outputs
97+
return outputs;
98+
}

examples/vitis_import/README.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
Tested with Vivado/Vitis tools version 2022.2
2-
3-
Source Xilinx env first -> for example: "source /tools/Xilinx/Vitis/2022.2/settings64.sh"
4-
Use build_all.sh to build and run example project.
5-
If you wish to build for hw change target in build_all.sh script.
1+
See information on [wiki](github.com/JulianKemmerer/PipelineC/wiki/Vitis).

examples/vitis_import/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
../../src/pipelinec axis.c --out_dir OUT --coarse --sweep --start 100 --stop 100
2+
# Must use default top module name = 'top' (same as --top top)
3+
../../src/pipelinec axis.c --out_dir OUT --xo_axis --coarse --sweep

examples/vitis_import/vitis_scripts/build_all.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/bash
2+
3+
# Use ../build.sh to produce PipelineC ../OUT/package_axis_xo.tcl file
4+
5+
# Vitis build steps:
26
#TARGET=hw
37
TARGET=hw_emu
48
VITIS_PLATFORM=xilinx_u50_gen3x16_xdma_5_202210_1
5-
vivado -source sources/package_xo.tcl -mode batch
9+
vivado -source ../OUT/package_axis_xo.tcl -mode batch
610
./vitis_compile.sh ${TARGET} ${VITIS_PLATFORM}
711
./vitis_link.sh ${TARGET} ${VITIS_PLATFORM}
812
./gpp.sh

examples/vitis_import/vitis_scripts/sources/package_xo.tcl

Lines changed: 0 additions & 50 deletions
This file was deleted.

examples/vitis_import/vitis_scripts/sources/utils.tcl

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/vitis_import/vitis_scripts/sources/vitis_link.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ synth.jobs=4
33
impl.jobs=12
44

55
[connectivity]
6-
stream_connect=maxi_to_stream_1.output:my_ip_1.input_stream
7-
stream_connect=my_ip_1.output_stream:stream_to_maxi_1.input
6+
stream_connect=maxi_to_stream_1.output:top_ip_1.input_stream
7+
stream_connect=top_ip_1.output_stream:stream_to_maxi_1.input

0 commit comments

Comments
 (0)