Skip to content

Commit 77acc8d

Browse files
committed
[Infra]: - Adding a new benchmark, hdl_include, splitting the ch_intrinsic into multiple files
- Adding hdl_include to vtr_reg_basic, to validate the include capability for tasks config file Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent d873c64 commit 77acc8d

File tree

7 files changed

+395
-0
lines changed

7 files changed

+395
-0
lines changed
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/*
2+
* Modified ch_intrinsic.v relies on definitons provided in header
3+
* files and a sub module, memeory_controller located at:
4+
* vtr_flow/benchmark/hdl_include/include/generic_definitions1.vh
5+
* vtr_flow/benchmark/hdl_include/include/generic_definitions2.vh
6+
* vtr_flow/benchmark/hdl_include/include/memory_controller.v
7+
*
8+
* This test is modified to allow testing of run_vtr_task capability to
9+
* include additional files in a benchmark
10+
*/
11+
12+
module memset
13+
(
14+
clk,
15+
reset,
16+
start,
17+
finish,
18+
return_val,
19+
m,
20+
c,
21+
n,
22+
memory_controller_write_enable,
23+
memory_controller_address,
24+
memory_controller_in,
25+
memory_controller_out
26+
);
27+
28+
output[`MEMORY_CONTROLLER_ADDR_SIZE-1:0] return_val;
29+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] return_val;
30+
input clk;
31+
input reset;
32+
input start;
33+
34+
output finish;
35+
reg finish;
36+
37+
input [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] m;
38+
input [31:0] c;
39+
input [31:0] n;
40+
41+
output [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
42+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
43+
44+
output memory_controller_write_enable;
45+
reg memory_controller_write_enable;
46+
47+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
48+
reg [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
49+
50+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
51+
52+
reg [3:0] cur_state;
53+
54+
/*
55+
parameter Wait = 4'd0;
56+
parameter entry = 4'd1;
57+
parameter entry_1 = 4'd2;
58+
parameter entry_2 = 4'd3;
59+
parameter bb = 4'd4;
60+
parameter bb_1 = 4'd5;
61+
parameter bb1 = 4'd6;
62+
parameter bb1_1 = 4'd7;
63+
parameter bb_nph = 4'd8;
64+
parameter bb2 = 4'd9;
65+
parameter bb2_1 = 4'd10;
66+
parameter bb2_2 = 4'd11;
67+
parameter bb2_3 = 4'd12;
68+
parameter bb2_4 = 4'd13;
69+
parameter bb4 = 4'd14;
70+
*/
71+
72+
memory_controller memtroll (clk,memory_controller_address, memory_controller_write_enable, memory_controller_in, memory_controller_out);
73+
74+
75+
reg [31:0] indvar;
76+
reg var1;
77+
reg [31:0] tmp;
78+
reg [31:0] tmp8;
79+
reg var2;
80+
reg [31:0] var0;
81+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] scevgep;
82+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] s_07;
83+
reg [31:0] indvar_next;
84+
reg exitcond;
85+
86+
always @(posedge clk)
87+
if (reset)
88+
cur_state <= 4'b0000;
89+
else
90+
case(cur_state)
91+
4'b0000:
92+
begin
93+
finish <= 1'b0;
94+
if (start == 1'b1)
95+
cur_state <= 4'b0001;
96+
else
97+
cur_state <= 4'b0000;
98+
end
99+
4'b0001:
100+
begin
101+
102+
103+
104+
var0 <= n & 32'b00000000000000000000000000000011;
105+
106+
cur_state <= 4'b0010;
107+
end
108+
4'b0010:
109+
begin
110+
111+
var1 <= 1'b0;
112+
var0 <= 32'b00000000000000000000000000000000;
113+
114+
cur_state <= 4'b0011;
115+
end
116+
4'b0011:
117+
begin
118+
119+
120+
if (|var1) begin
121+
cur_state <= 4'b0110;
122+
end
123+
else
124+
begin
125+
126+
cur_state <= 4'b0100;
127+
end
128+
end
129+
4'b0100:
130+
begin
131+
132+
cur_state <= 4'b0101;
133+
end
134+
4'b0101:
135+
begin
136+
cur_state <= 4'b0110;
137+
end
138+
4'b0110:
139+
begin
140+
141+
var2 <= | (n [31:4]);
142+
143+
cur_state <= 4'b0111;
144+
end
145+
4'b0111:
146+
begin
147+
148+
if (|var2)
149+
begin
150+
cur_state <= 4'b1110;
151+
end
152+
else
153+
begin
154+
cur_state <= 4'b1000;
155+
end
156+
end
157+
4'b1000:
158+
begin
159+
160+
tmp <= n ;
161+
162+
indvar <= 32'b00000000000000000000000000000000;
163+
cur_state <= 4'b1001;
164+
end
165+
4'b1001:
166+
begin
167+
168+
cur_state <= 4'b1010;
169+
end
170+
4'b1010:
171+
begin
172+
tmp8 <= indvar;
173+
indvar_next <= indvar;
174+
cur_state <= 4'b1011;
175+
end
176+
4'b1011:
177+
begin
178+
179+
scevgep <= (m & tmp8);
180+
181+
exitcond <= (indvar_next == tmp);
182+
183+
cur_state <= 4'b1100;
184+
end
185+
4'b1100:
186+
begin
187+
188+
s_07 <= scevgep;
189+
190+
cur_state <= 4'b1101;
191+
end
192+
4'b1101:
193+
194+
begin
195+
196+
197+
if (exitcond)
198+
begin
199+
cur_state <= 4'b1110;
200+
end
201+
else
202+
begin
203+
indvar <= indvar_next;
204+
cur_state <= 4'b1001;
205+
end
206+
end
207+
208+
209+
4'b1110:
210+
begin
211+
212+
return_val <= m;
213+
finish <= 1'b1;
214+
cur_state <= 4'b0000;
215+
end
216+
endcase
217+
218+
always @(cur_state)
219+
begin
220+
221+
case(cur_state)
222+
4'b1101:
223+
begin
224+
memory_controller_address = s_07;
225+
memory_controller_write_enable = 1'b1;
226+
memory_controller_in = c;
227+
end
228+
endcase
229+
end
230+
231+
endmodule
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# include files
2+
3+
This folder contains _include_ files for running the modified version of ch_intrisinc.
4+
5+
_include_ files can be either a Verilog file or a Verilog header file. The main point worth mentioning is that the union of include files and the circuit design includes the top module should not result in any conflict like having multiple top modules or declaring different variables with the same name.
6+
7+
To create a task config file, the syntax for _include_ files is pretty much like the circuits or architectures.
8+
In the beginning, _includes_dir_, a path to _include_ files should be specified. In the following, specifiers include_add_list adds specific _include_ files, using a relative path that will be pre-pended by the _includes_dir_ path.
9+
If config.txt file lists multiple benchmark circuits and multiple include files, all include files will be considered (unioned into) each circuit design. In other words, _include_ files are shared among given benchmark circuits.
10+
11+
___________________________hdl_include task config file____________________________
12+
##############################################
13+
\# Configuration file for running experiments
14+
##############################################
15+
16+
\# Path to directory of circuits to use
17+
circuits_dir=benchmarks/hdl_include
18+
19+
\# Path to directory of includes circuits to use
20+
includes_dir=benchmarks/hdl_include/include
21+
22+
\# Path to directory of architectures to use
23+
archs_dir=arch/no_timing/memory_sweep
24+
25+
\# Add circuits to list to sweep
26+
circuit_list_add=ch_intrinsics_top.v
27+
28+
\# Add circuits to includes list to sweep
29+
include_list_add=generic_definitions1.vh
30+
include_list_add=generic_definitions2.vh
31+
include_list_add=memory_controller.vh
32+
33+
\# Add architectures to list to sweep
34+
arch_list_add=k4_N10_memSize16384_memData64.xml
35+
36+
\# Parse info and how to parse
37+
parse_file=vpr_no_timing.txt
38+
39+
\# How to parse QoR info
40+
qor_parse_file=qor_no_timing.txt
41+
42+
\# Script parameters
43+
script_params_common=-track_memory_usage --timing_analysis off
44+
___________________________________________________________________________________
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* This header file provides definitions for ch_intrinsic_modified.v
3+
* located at:
4+
* vtr_flow/benchmarks/hdl_include/ch_intrinsic_modified.v
5+
*/
6+
`define MEMORY_CONTROLLER_ADDR_SIZE 32
7+
`define MEMORY_CONTROLLER_DATA_SIZE 32
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* This header file provides definitions for ch_intrinsic_modified.v
3+
* located at:
4+
* vtr_flow/benchmarks/hdl_include/ch_intrinsic_modified.v
5+
*/
6+
`define MEMORY_CONTROLLER_TAGS 1
7+
`define MEMORY_CONTROLLER_TAG_SIZE 1
8+
`define TAG__str 1'b0
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* This Verilog file provides the memory_controller description
3+
* for ch_intrinsic_modified.v located at:
4+
* vtr_flow/benchmarks/hdl_include/ch_intrinsic_modified.v
5+
*/
6+
module memory_controller
7+
(
8+
clk,
9+
memory_controller_address,
10+
memory_controller_write_enable,
11+
memory_controller_in,
12+
memory_controller_out
13+
);
14+
input clk;
15+
input [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
16+
input memory_controller_write_enable;
17+
input [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
18+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
19+
reg [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
20+
21+
22+
reg [4:0] str_address;
23+
reg str_write_enable;
24+
reg [7:0] str_in;
25+
wire [7:0] str_out;
26+
27+
single_port_ram _str (
28+
.clk( clk ),
29+
.addr( str_address ),
30+
.we( str_write_enable ),
31+
.data( str_in ),
32+
.out( str_out )
33+
);
34+
35+
36+
wire tag;
37+
38+
//must use all wires inside module.....
39+
assign tag = |memory_controller_address & |memory_controller_address & | memory_controller_in;
40+
reg [`MEMORY_CONTROLLER_TAG_SIZE-1:0] prevTag;
41+
always @(posedge clk)
42+
prevTag <= tag;
43+
always @( tag or memory_controller_address or memory_controller_write_enable or memory_controller_in)
44+
begin
45+
46+
case(tag)
47+
48+
1'b0:
49+
begin
50+
str_address = memory_controller_address[5-1+0:0];
51+
str_write_enable = memory_controller_write_enable;
52+
str_in[8-1:0] = memory_controller_in[8-1:0];
53+
end
54+
endcase
55+
56+
case(prevTag)
57+
58+
1'b0:
59+
memory_controller_out = str_out;
60+
endcase
61+
end
62+
63+
endmodule
64+

0 commit comments

Comments
 (0)