Skip to content

Commit abe100a

Browse files
committed
[Infra]: - Adding a modified version of ch_intrinsics without `define macros
- Adding header files to cover the ch_intrinsics definiton - Adding a new task, hdl_include, to validate the include capability for tasks config file Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent ae1d995 commit abe100a

File tree

6 files changed

+380
-0
lines changed

6 files changed

+380
-0
lines changed
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
/*
2+
* Modified ch_intrinsic.v relies on definitons provided in
3+
* two header files located at:
4+
* vtr_flow/benchmark/hdl_include/include/generic_definitions1.vh
5+
* vtr_flow/benchmark/hdl_include/include/generic_definitions2.vh
6+
*
7+
* This test is modified to allow testing of run_vtr_task capability to
8+
* include additional files in a benchmark
9+
*/
10+
11+
module memory_controller
12+
(
13+
clk,
14+
memory_controller_address,
15+
memory_controller_write_enable,
16+
memory_controller_in,
17+
memory_controller_out
18+
);
19+
input clk;
20+
input [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
21+
input memory_controller_write_enable;
22+
input [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
23+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
24+
reg [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
25+
26+
27+
reg [4:0] str_address;
28+
reg str_write_enable;
29+
reg [7:0] str_in;
30+
wire [7:0] str_out;
31+
32+
single_port_ram _str (
33+
.clk( clk ),
34+
.addr( str_address ),
35+
.we( str_write_enable ),
36+
.data( str_in ),
37+
.out( str_out )
38+
);
39+
40+
41+
wire tag;
42+
43+
//must use all wires inside module.....
44+
assign tag = |memory_controller_address & |memory_controller_address & | memory_controller_in;
45+
reg [`MEMORY_CONTROLLER_TAG_SIZE-1:0] prevTag;
46+
always @(posedge clk)
47+
prevTag <= tag;
48+
always @( tag or memory_controller_address or memory_controller_write_enable or memory_controller_in)
49+
begin
50+
51+
case(tag)
52+
53+
1'b0:
54+
begin
55+
str_address = memory_controller_address[5-1+0:0];
56+
str_write_enable = memory_controller_write_enable;
57+
str_in[8-1:0] = memory_controller_in[8-1:0];
58+
end
59+
endcase
60+
61+
case(prevTag)
62+
63+
1'b0:
64+
memory_controller_out = str_out;
65+
endcase
66+
end
67+
68+
endmodule
69+
70+
71+
module memset
72+
(
73+
clk,
74+
reset,
75+
start,
76+
finish,
77+
return_val,
78+
m,
79+
c,
80+
n,
81+
memory_controller_write_enable,
82+
memory_controller_address,
83+
memory_controller_in,
84+
memory_controller_out
85+
);
86+
87+
output[`MEMORY_CONTROLLER_ADDR_SIZE-1:0] return_val;
88+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] return_val;
89+
input clk;
90+
input reset;
91+
input start;
92+
93+
output finish;
94+
reg finish;
95+
96+
input [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] m;
97+
input [31:0] c;
98+
input [31:0] n;
99+
100+
output [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
101+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] memory_controller_address;
102+
103+
output memory_controller_write_enable;
104+
reg memory_controller_write_enable;
105+
106+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
107+
reg [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_in;
108+
109+
output [`MEMORY_CONTROLLER_DATA_SIZE-1:0] memory_controller_out;
110+
111+
reg [3:0] cur_state;
112+
113+
/*
114+
parameter Wait = 4'd0;
115+
parameter entry = 4'd1;
116+
parameter entry_1 = 4'd2;
117+
parameter entry_2 = 4'd3;
118+
parameter bb = 4'd4;
119+
parameter bb_1 = 4'd5;
120+
parameter bb1 = 4'd6;
121+
parameter bb1_1 = 4'd7;
122+
parameter bb_nph = 4'd8;
123+
parameter bb2 = 4'd9;
124+
parameter bb2_1 = 4'd10;
125+
parameter bb2_2 = 4'd11;
126+
parameter bb2_3 = 4'd12;
127+
parameter bb2_4 = 4'd13;
128+
parameter bb4 = 4'd14;
129+
*/
130+
131+
memory_controller memtroll (clk,memory_controller_address, memory_controller_write_enable, memory_controller_in, memory_controller_out);
132+
133+
134+
reg [31:0] indvar;
135+
reg var1;
136+
reg [31:0] tmp;
137+
reg [31:0] tmp8;
138+
reg var2;
139+
reg [31:0] var0;
140+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] scevgep;
141+
reg [`MEMORY_CONTROLLER_ADDR_SIZE-1:0] s_07;
142+
reg [31:0] indvar_next;
143+
reg exitcond;
144+
145+
always @(posedge clk)
146+
if (reset)
147+
cur_state <= 4'b0000;
148+
else
149+
case(cur_state)
150+
4'b0000:
151+
begin
152+
finish <= 1'b0;
153+
if (start == 1'b1)
154+
cur_state <= 4'b0001;
155+
else
156+
cur_state <= 4'b0000;
157+
end
158+
4'b0001:
159+
begin
160+
161+
162+
163+
var0 <= n & 32'b00000000000000000000000000000011;
164+
165+
cur_state <= 4'b0010;
166+
end
167+
4'b0010:
168+
begin
169+
170+
var1 <= 1'b0;
171+
var0 <= 32'b00000000000000000000000000000000;
172+
173+
cur_state <= 4'b0011;
174+
end
175+
4'b0011:
176+
begin
177+
178+
179+
if (|var1) begin
180+
cur_state <= 4'b0110;
181+
end
182+
else
183+
begin
184+
185+
cur_state <= 4'b0100;
186+
end
187+
end
188+
4'b0100:
189+
begin
190+
191+
cur_state <= 4'b0101;
192+
end
193+
4'b0101:
194+
begin
195+
cur_state <= 4'b0110;
196+
end
197+
4'b0110:
198+
begin
199+
200+
var2 <= | (n [31:4]);
201+
202+
cur_state <= 4'b0111;
203+
end
204+
4'b0111:
205+
begin
206+
207+
if (|var2)
208+
begin
209+
cur_state <= 4'b1110;
210+
end
211+
else
212+
begin
213+
cur_state <= 4'b1000;
214+
end
215+
end
216+
4'b1000:
217+
begin
218+
219+
tmp <= n ;
220+
221+
indvar <= 32'b00000000000000000000000000000000;
222+
cur_state <= 4'b1001;
223+
end
224+
4'b1001:
225+
begin
226+
227+
cur_state <= 4'b1010;
228+
end
229+
4'b1010:
230+
begin
231+
tmp8 <= indvar;
232+
indvar_next <= indvar;
233+
cur_state <= 4'b1011;
234+
end
235+
4'b1011:
236+
begin
237+
238+
scevgep <= (m & tmp8);
239+
240+
exitcond <= (indvar_next == tmp);
241+
242+
cur_state <= 4'b1100;
243+
end
244+
4'b1100:
245+
begin
246+
247+
s_07 <= scevgep;
248+
249+
cur_state <= 4'b1101;
250+
end
251+
4'b1101:
252+
253+
begin
254+
255+
256+
if (exitcond)
257+
begin
258+
cur_state <= 4'b1110;
259+
end
260+
else
261+
begin
262+
indvar <= indvar_next;
263+
cur_state <= 4'b1001;
264+
end
265+
end
266+
267+
268+
4'b1110:
269+
begin
270+
271+
return_val <= m;
272+
finish <= 1'b1;
273+
cur_state <= 4'b0000;
274+
end
275+
endcase
276+
277+
always @(cur_state)
278+
begin
279+
280+
case(cur_state)
281+
4'b1101:
282+
begin
283+
memory_controller_address = s_07;
284+
memory_controller_write_enable = 1'b1;
285+
memory_controller_in = c;
286+
end
287+
endcase
288+
end
289+
290+
endmodule
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 primary circuit 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, _inlcudes_dir_, a path to _include_ files should be specified. In the following, specifiers include_add_list show the _include_ files with a relative path to the _includes_dir_ path.
9+
In the case of having multiple designs with multiple _include_ files, all _include_ files will be considered for each circuit design.
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_modified.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+
32+
\# Add architectures to list to sweep
33+
arch_list_add=k4_N10_memSize16384_memData64.xml
34+
35+
\# Parse info and how to parse
36+
parse_file=vpr_no_timing.txt
37+
38+
\# How to parse QoR info
39+
qor_parse_file=qor_no_timing.txt
40+
41+
\# Script parameters
42+
script_params_common=-track_memory_usage --timing_analysis off
43+
___________________________________________________________________________________
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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
##############################################
2+
# Configuration file for running experiments
3+
##############################################
4+
5+
# Path to directory of circuits to use
6+
circuits_dir=benchmarks/hdl_include
7+
8+
# Path to directory of includes circuits to use
9+
includes_dir=benchmarks/hdl_include/include
10+
11+
# Path to directory of architectures to use
12+
archs_dir=arch/no_timing/memory_sweep
13+
14+
# Add circuits to list to sweep
15+
circuit_list_add=ch_intrinsics_modified.v
16+
17+
# Add circuits to includes list to sweep
18+
include_list_add=generic_definitions1.vh
19+
include_list_add=generic_definitions2.vh
20+
21+
# Add architectures to list to sweep
22+
arch_list_add=k4_N10_memSize16384_memData64.xml
23+
24+
# Parse info and how to parse
25+
parse_file=vpr_no_timing.txt
26+
27+
# How to parse QoR info
28+
qor_parse_file=qor_no_timing.txt
29+
30+
# Script parameters
31+
script_params_common=-track_memory_usage --timing_analysis off
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
regression_tests/vtr_reg_basic/basic_no_timing
22
regression_tests/vtr_reg_basic/basic_timing
33
regression_tests/vtr_reg_basic/basic_timing_no_sdc
4+
regression_tests/vtr_reg_basic/hdl_include

0 commit comments

Comments
 (0)