Skip to content

Commit e452f4d

Browse files
author
djns1
committed
Implemented InOuts
1 parent 5704dd0 commit e452f4d

18 files changed

+301
-178
lines changed

ODIN_II/SRC/ast_elaborate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2660,12 +2660,12 @@ void create_param_table_for_scope(ast_node_t* module_items, sc_hierarchy* local_
26602660
/* symbols are already dealt with */
26612661
if (var_declare->types.variable.is_input
26622662
|| var_declare->types.variable.is_output
2663+
|| var_declare->types.variable.is_inout
26632664
|| var_declare->types.variable.is_reg
26642665
|| var_declare->types.variable.is_integer
26652666
|| var_declare->types.variable.is_genvar
26662667
|| var_declare->types.variable.is_wire
26672668
|| var_declare->types.variable.is_defparam)
2668-
26692669
continue;
26702670

26712671
oassert(module_items->children[i]->children[j]->type == VAR_DECLARE);

ODIN_II/SRC/netlist_create_from_ast.cpp

Lines changed: 98 additions & 90 deletions
Large diffs are not rendered by default.

ODIN_II/SRC/parse_making_ast.cpp

Lines changed: 82 additions & 50 deletions
Large diffs are not rendered by default.

ODIN_II/SRC/read_blif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static void build_top_input_node(const char* name_str, Hashtable* output_nets_ha
10161016

10171017
void add_top_input_nodes(FILE* file, Hashtable* output_nets_hash) {
10181018
/**
1019-
* insert a global clock for fall back.
1019+
* insert a global clock for fall back.
10201020
* in case of undriven internal clocks, they will attach to the global clock
10211021
* this also fix the issue of constant verilog (no input)
10221022
* that cannot simulate due to empty input vector

ODIN_II/regression_test/benchmark/task/syntax/task.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ arch_list_add=k6_frac_N10_frac_chain_mem32K_40nm.xml
1616
circuits_dir=regression_test/benchmark/verilog/
1717

1818
circuit_list_add=syntax/*.v
19+
circuit_list_add=syntax/inout-syntax/*.v
1920

2021
synthesis_parse_file=regression_test/parse_result/conf/synth.toml
2122
simulation_parse_file=regression_test/parse_result/conf/sim.toml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module simple_op(in_out1,in_out2,en);
2+
inout in_out1;
3+
inout in_out2;
4+
input en;
5+
6+
assign in_out1 = (en) ? in_out2 : 1'bz;
7+
assign in_out2 = (!en) ? in_out1 : 1'bz;
8+
endmodule
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
GLOBAL_SIM_BASE_CLK en in_out1 in_out2
2+
0 1 z z
3+
1 0 z z
4+
0 1 z 0
5+
1 1 z 1
6+
0 0 1 z
7+
1 0 0 z
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
in_out1 in_out2
2+
0 0
3+
1 1
4+
0 0
5+
0 x
6+
1 1
7+
x 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module inout_basic(input dir, inout io, output out);
2+
assign io = (dir) ? dir : 1'bz;
3+
assign out = (!dir) ? io : 1'bx;
4+
endmodule
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
GLOBAL_SIM_BASE_CLK dir io
2+
0 1 0
3+
0 1 0
4+
0 1 1
5+
0 1 1
6+
0 0 0
7+
0 0 0
8+
0 0 1
9+
0 0 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
io out
2+
1 x
3+
1 x
4+
1 x
5+
1 x
6+
0 0
7+
0 0
8+
1 1
9+
1 1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module inout_assign(inout a, output b);
2+
assign b = a;
3+
endmodule
4+
5+
module inout_basic(input a, output b);
6+
inout_assign c(a, b);
7+
endmodule
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GLOBAL_SIM_BASE_CLK a
2+
0 0
3+
0 1
4+
0 1
5+
0 0
6+
0 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
b
2+
0
3+
1
4+
1
5+
0
6+
1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module inout_assign(input a, inout b);
2+
assign b = a;
3+
endmodule
4+
5+
module inout_basic(input a, output b);
6+
inout_assign c(a, b);
7+
endmodule
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GLOBAL_SIM_BASE_CLK a
2+
0 0
3+
0 1
4+
0 1
5+
0 0
6+
0 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
b
2+
0
3+
1
4+
1
5+
0
6+
1

ODIN_II/verify_odin.sh

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ _GENERATE_EXPECTATION="off"
9999
function help() {
100100

101101
printf "Called program with $INPUT
102-
Usage:
102+
Usage:
103103
$0 [ OPTIONS / FLAGS ] [ SUBTEST_LIST ... ]
104104
105105
SUBTEST_LIST
@@ -114,17 +114,17 @@ printf "Called program with $INPUT
114114
-c|--clean $(_prt_cur_arg off ) Clean temporary directory
115115
-f|--force_simulate $(_prt_cur_arg ${_FORCE_SIM}) Force the simulation to be executed regardless of the config
116116
--override $(_prt_cur_arg ${_OVERRIDE_CONFIG}) if a config file is passed in, override arguments rather than append
117-
--dry_run $(_prt_cur_arg ${_DRY_RUN}) performs a dry run to check the validity of the task and flow
118-
--randomize $(_prt_cur_arg ${_RANDOM_DRY_RUN}) performs a dry run randomly to check the validity of the task and flow
117+
--dry_run $(_prt_cur_arg ${_DRY_RUN}) performs a dry run to check the validity of the task and flow
118+
--randomize $(_prt_cur_arg ${_RANDOM_DRY_RUN}) performs a dry run randomly to check the validity of the task and flow
119119
--regenerate_expectation $(_prt_cur_arg ${_REGENERATE_EXPECTATION}) regenerate the expectation and overrides the expected value mismatches only
120120
--generate_expectation $(_prt_cur_arg ${_GENERATE_EXPECTATION}) generate the expectation and overrides the expectation file
121121
OPTIONS
122122
-h|--help $(_prt_cur_arg off) print this
123123
-j|--nb_of_process < N > $(_prt_cur_arg ${_NUMBER_OF_PROCESS}) Number of process requested to be used
124124
-d|--output_dir < /abs/path > $(_prt_cur_arg ${_RUN_DIR_OVERRIDE}) Change the run directory output
125125
-C|--config <path/to/config> $(_prt_cur_arg ${_EXTRA_CONFIG}) Add a config file to append to the config for the tests
126-
-t|--test < test name > $(_prt_cur_arg ${_TEST_INPUT_LIST[*]}) Test name is either a absolute or relative path to
127-
a directory containing a task.conf, task_list.conf
126+
-t|--test < test name > $(_prt_cur_arg ${_TEST_INPUT_LIST[*]}) Test name is either a absolute or relative path to
127+
a directory containing a task.conf, task_list.conf
128128
(see CONFIG FILE HELP) or one of the following predefined test
129129
130130
AVAILABLE_TEST:
@@ -208,7 +208,7 @@ function create_temp() {
208208

209209
ln -s "${NEW_RUN_DIR}" "${REGRESSION_DIR}/latest"
210210

211-
# put in the passed parameter for keepsake
211+
# put in the passed parameter for keepsake
212212
echo "${_TEST_INPUT_LIST[@]}" | xargs -n 1 -I {} echo {} > "${NEW_RUN_DIR}/cmd.task"
213213
echo "========="
214214
echo "$0 ${INPUT}" >> "${NEW_RUN_DIR}/cmd.task"
@@ -223,7 +223,7 @@ function cleanup_temp() {
223223
fi
224224

225225
for runs in "${OUTPUT_DIRECTORY}"/run*
226-
do
226+
do
227227
rm -Rf "${runs}"
228228
done
229229

@@ -268,28 +268,28 @@ function disable_failed_bm() {
268268
function parse_args() {
269269
PARSE_SUBTEST="off"
270270
while [ "_$*" != "_" ]
271-
do
271+
do
272272
if [ ${PARSE_SUBTEST} == "on" ];
273273
then
274274
# parse subtest
275275
_SUBTEST_LIST+=( "$1" )
276276
shift
277277
else
278-
# parse [ OPTIONS / FLAGS ]
279-
case $1 in
278+
# parse [ OPTIONS / FLAGS ]
279+
case $1 in
280280

281281
# Help Desk
282282
-h|--help)
283283
echo "Printing Help information"
284284
help
285285
_exit_with_code "0"
286286

287-
287+
288288
## directory in benchmark
289289
;;-t|--test)
290290
# this is handled down stream
291291
if [ "_$2" == "_" ]
292-
then
292+
then
293293
echo "empty argument for $1"
294294
_exit_with_code "-1"
295295
fi
@@ -300,11 +300,11 @@ function parse_args() {
300300
;;-d|--output_dir)
301301

302302
if [ "_$2" == "_" ]
303-
then
303+
then
304304
echo "empty argument for $1"
305305
_exit_with_code "-1"
306306
fi
307-
307+
308308
_RUN_DIR_OVERRIDE=$2
309309

310310
if [ ! -d "${_RUN_DIR_OVERRIDE}" ]
@@ -318,11 +318,11 @@ function parse_args() {
318318
;;-C|--config)
319319

320320
if [ "_$2" == "_" ]
321-
then
321+
then
322322
echo "empty argument for $1"
323323
_exit_with_code "-1"
324324
fi
325-
325+
326326
_EXTRA_CONFIG=$2
327327
echo "Reading extra config directive from ${_EXTRA_CONFIG}"
328328

@@ -335,29 +335,29 @@ function parse_args() {
335335
shift
336336

337337
# Boolean flags
338-
;;-g|--generate_bench)
338+
;;-g|--generate_bench)
339339
_GENERATE_BENCH="on"
340340
echo "generating output vector for test given predefined input"
341341

342-
;;-o|--generate_output)
342+
;;-o|--generate_output)
343343
_GENERATE_OUTPUT="on"
344344
echo "generating input and output vector for test"
345345

346-
;;-b|--build_config)
346+
;;-b|--build_config)
347347
_GENERATE_CONFIG="on"
348348
echo "generating a config file for test directory"
349349

350-
;;-c|--clean)
350+
;;-c|--clean)
351351
echo "Cleaning temporary run in directory"
352352
cleanup_temp
353353

354-
;;-f|--force_simulate)
354+
;;-f|--force_simulate)
355355
_FORCE_SIM="on"
356-
echo "Forcing Simulation"
356+
echo "Forcing Simulation"
357357

358358
;;--override)
359359
_OVERRIDE_CONFIG="on"
360-
echo "Forcing override of config"
360+
echo "Forcing override of config"
361361

362362
;;--dry_run)
363363
_DRY_RUN="on"
@@ -375,7 +375,7 @@ function parse_args() {
375375
_GENERATE_EXPECTATION="on"
376376
echo "generating new expected values"
377377

378-
;;*)
378+
;;*)
379379
PARSE_SUBTEST="on"
380380
esac
381381

@@ -432,9 +432,9 @@ printf "
432432
simulation_parse_file = < path/to/parse/file >
433433
script_synthesis_params = [see exec_wrapper.sh options]
434434
script_simulation_params= [see exec_wrapper.sh options]
435-
synthesis_params = [see Odin options]
435+
synthesis_params = [see Odin options]
436436
simulation_params = [see Odin options]
437-
regression_params =
437+
regression_params =
438438
{
439439
--verbose # display error logs after batch of tests
440440
--concat_circuit_list # concatenate the circuit list and pass it straight through to odin
@@ -486,13 +486,13 @@ function populate_arg_from_file() {
486486
_key="$(echo "${formatted_line}" | cut -d '=' -f1 )"
487487
_value="$(echo "${formatted_line}" | cut -d '=' -f2 )"
488488

489-
if [ "_${_key}" != "_" ] && [ "_${_value}" == "_" ]
489+
if [ "_${_key}" != "_" ] && [ "_${_value}" == "_" ]
490490
then
491491
echo "Specifying empty value for ${_key}, skipping assignment"
492-
elif [ "_${_key}" == "_" ] && [ "_${_value}" != "_" ]
492+
elif [ "_${_key}" == "_" ] && [ "_${_value}" != "_" ]
493493
then
494494
echo "Specifying empty key for value: ${_value}, skipping assignment"
495-
elif [ "_${_key}" != "_" ] && [ "_${_value}" != "_" ]
495+
elif [ "_${_key}" != "_" ] && [ "_${_value}" != "_" ]
496496
then
497497
case _${_key} in
498498

@@ -505,7 +505,7 @@ function populate_arg_from_file() {
505505

506506
;;_circuit_list_add)
507507
# glob the value
508-
_circuit_list_add+=( "${_circuits_dir}"/${_value} )
508+
_circuit_list_add+=( "${_circuits_dir}"/${_value} )
509509

510510
;;_archs_dir)
511511
if [ ! -d "${_value}" ]
@@ -531,8 +531,8 @@ function populate_arg_from_file() {
531531
_local_synthesis_parse_file="${_value}"
532532

533533
;;_synthesis_params)
534-
_local_synthesis_params="${_local_synthesis_params} ${_value}"
535-
534+
_local_synthesis_params="${_local_synthesis_params} ${_value}"
535+
536536
;;_simulation_params)
537537
_local_simulation_params="${_local_simulation_params} ${_value}"
538538

@@ -602,7 +602,7 @@ function populate_arg_from_file() {
602602
fi
603603
fi
604604

605-
605+
606606
for circuit_list_item in "${_circuit_list_add[@]}"
607607
do
608608
if [ ! -f "${circuit_list_item}" ]
@@ -618,7 +618,7 @@ function populate_arg_from_file() {
618618
echo "Passed a config file with no circuit to test"
619619
_exit_with_code "-1"
620620
fi
621-
621+
622622

623623
for arch_list_item in "${_arch_list_add[@]}"
624624
do
@@ -660,7 +660,7 @@ function move_vector() {
660660
file_name="$2"
661661
replacement_suffix="$3"
662662

663-
find_in_bench "${file_dir}" "${file_name}"
663+
find_in_bench "${file_dir}" "${file_name}"
664664
# move the output vectors
665665
for sim_vectors in "${TMP_BENCH_FIND_ARRAY[@]}"
666666
do
@@ -1216,7 +1216,7 @@ function run_task() {
12161216
if [ ! -d "${test_dir}" ]
12171217
then
12181218
echo "${test_dir} Not Found! Skipping this test"
1219-
elif [ ! -f "${test_dir}/task.conf" ]
1219+
elif [ ! -f "${test_dir}/task.conf" ]
12201220
then
12211221
if [ ${_GENERATE_CONFIG} == "on" ]
12221222
then

0 commit comments

Comments
 (0)