run.sh 27.1 KB
Newer Older
1 2
#!/bin/bash

3
set -x
4 5 6 7 8
test -d $1
test -f scripts/$2.ys

rm -rf $1/work_$2
mkdir $1/work_$2
9 10 11
if [ $2  == "cover_dir" ]; then
    mkdir $1/work_$2/out_dir
fi
12 13
cd $1/work_$2

14 15
touch .start

16
# cases where 'syntax error' or other errors are expected
17
if echo "$1" | grep ".*_error"; then
18

19
	expected_string=""
Miodrag Milanovic committed
20
	expect_fail=0
21 22 23 24 25 26 27 28 29 30 31
    #Change checked string for check other errors
	if [ "$2" = "abc_constr_no_liberty" ]; then
		expected_string="ERROR: Got -constr but no -liberty!"
	elif [ "$2" = "abc_cannot_open" ]; then
		expected_string="ERROR: Can't open ABC output file"
	elif [ "$2" = "abc_lut_liberty" ]; then
		expected_string="ERROR: Got -lut and -liberty! This two options are exclusive."
	elif [ "$2" = "abc_unsup_gate_type" ]; then
		expected_string="ERROR: Command syntax error: Unsupported gate type:"
	elif [ "$2" = "abc_inv_luts_synt" ]; then
		expected_string="Invalid -luts syntax"
32 33
	elif [ "$2" = "abc_dff" ]; then
		expected_string="Unknown option or option in arguments"
34 35 36 37 38
	elif [ "$2" = "abc_return_code" ]; then
		expected_string="failed: return code"
	elif [ "$2" = "abc_clk_domain_not_found" ]; then
		expected_string="ERROR: Clock domain u not found"
	elif [ "$2" = "abc_script_o" ]; then
SergeyDegtyar committed
39
		expected_string="ERROR: Can't open ABC output file"
40
	elif [ "$2" = "abc_script_top" ]; then
SergeyDegtyar committed
41
		expected_string="ERROR: Can't open ABC output file"
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
	elif [ "$2" = "add_error" ]; then
		expected_string="ERROR: Found incompatible object with same name in module"
	elif [ "$2" = "bugpoint_missing_script" ]; then
		expected_string="ERROR: Missing -script option"
	elif [ "$2" = "bugpoint_do_not_crash" ]; then
		expected_string="ERROR: The provided script file and Yosys binary do not crash on this design"
	elif [ "$2" = "bugpoint_grep_string_not_found" ]; then
		expected_string="ERROR: The provided grep string is not found in the log file"
	elif [ "$2" = "bugpoint_fully_selected_des" ]; then
		expected_string="ERROR: This command only operates on fully selected designs"
	elif [ "$2" = "check_error" ]; then
		expected_string="ERROR: Found 1 problems in 'check -assert'"
	elif [ "$2" = "chformal_error" ]; then
		expected_string="ERROR: Mode option is missing"
	elif [ "$2" = "chparam_error" ]; then
		expected_string="ERROR: The options -set and -list cannot be used together"
	elif [ "$2" = "connect_multiple_modules" ]; then
		expected_string="ERROR: Multiple modules selected:"
	elif [ "$2" = "connect_found_process" ]; then
		expected_string="ERROR: Found processes in selected module"
	elif [ "$2" = "connect_no_modules" ]; then
		expected_string="ERROR: No modules selected."
	elif [ "$2" = "connect_set_with_unset" ] || \
		 [ "$2" = "connect_set_with_port" ] || \
		 [ "$2" = "connect_set_with_unset_and_port" ]; then
		expected_string="ERROR: Can't use -set together with -unset and/or -port."
	elif [ "$2" = "connect_cannot_parse_set_lhs_expr" ]; then
		expected_string="ERROR: Failed to parse set lhs expression"
	elif [ "$2" = "connect_cannot_parse_set_rhs_expr" ]; then
		expected_string="ERROR: Failed to parse set rhs expression"
	elif [ "$2" = "connect_unset_with_nounset" ] || \
		 [ "$2" = "connect_unset_with_port" ] || \
		 [ "$2" = "connect_unset_with_nounset_and_port" ]; then
		expected_string="ERROR: Can't use -unset together with -port and/or -nounset."
	elif [ "$2" = "connect_failed_parse_unset" ]; then
		expected_string="ERROR: Failed to parse unset expression"
	elif [ "$2" = "connect_port_with_nounset" ]; then
		expected_string="ERROR: Can't use -port together with -nounset."
	elif [ "$2" = "connect_cant_find_cell" ]; then
		expected_string="ERROR: Can't find cell"
	elif [ "$2" = "connect_failed_to_parse_port_expr" ]; then
		expected_string="ERROR: Failed to parse port expression"
	elif [ "$2" = "connect_opt_expected" ]; then
		expected_string="Expected -set, -unset, or -port."
	elif [ "$2" = "cover_cant_create_file" ]; then
		expected_string="ERROR: Can't create file"
	elif [ "$2" = "design_no_saved_design_copy_from" ] || \
		 [ "$2" = "design_no_saved_design_import" ] || \
		 [ "$2" = "design_no_saved_design_load" ]; then
		expected_string="ERROR: No saved design"
	elif [ "$2" = "design_no_pushed_design" ]; then
		expected_string="ERROR: No pushed designs"
	elif [ "$2" = "design_no_top_module" ]; then
		expected_string="ERROR: No top module found in source design."
	elif [ "$2" = "eval_only_one_module" ]; then
		expected_string="ERROR: Only one module must be selected for the EVAL pass!"
	elif [ "$2" = "eval_failed_to_parse_lhs" ]; then
		expected_string="ERROR: Failed to parse lhs set expression"
	elif [ "$2" = "eval_failed_to_parse_rhs" ]; then
		expected_string="ERROR: Failed to parse rhs set expression"
	elif [ "$2" = "eval_rhs_expr" ]; then
		expected_string="ERROR: Right-hand-side set expression"
	elif [ "$2" = "eval_diff_lhs_rhs_sizes" ]; then
		expected_string="ERROR: Set expression with different lhs and rhs sizes:"
	elif [ "$2" = "eval_failed_to_parse_show_expr" ]; then
		expected_string="ERROR: Failed to parse show expression"
	elif [ "$2" = "eval_failed_to_parse_table_expr" ]; then
		expected_string="ERROR: Failed to parse table expression"
	elif [ "$2" = "eval_empty_selection" ]; then
		expected_string="ERROR: Can't perform EVAL on an empty selection!"
	elif [ "$2" = "eval_port_doesnt_match" ]; then
		expected_string="in module 1 does not match its counterpart in module 2!"
	elif [ "$2" = "eval_has_no_counterpart" ]; then
		expected_string="in module 1 has no counterpart in module 2!"
	elif [ "$2" = "eval_cant_find_mod_1" ] || \
		 [ "$2" = "eval_cant_find_mod_2" ]; then
		expected_string="ERROR: Can't find module"
	elif [ "$2" = "eval_mods_arent_equiv" ]; then
		expected_string="ERROR: Modules are not equivalent!"
	elif [ "$2" = "eval_cant_find_mod_in_curr_des" ]; then
		expected_string="ERROR: Can't find module dle in current design!"
	elif [ "$2" = "eval_no_output_wire" ]; then
		expected_string="ERROR: No output wire"
	elif [ "$2" = "eval_cant_find_input" ]; then
 		expected_string="ERROR: Can't find input s in module middle!"
	elif [ "$2" = "eval_wire_isnt_an_input" ]; then
 		expected_string="ERROR: Wire w in module middle is not an input!"
	elif [ "$2" = "eval_failed_to_parse_pattern" ]; then
 		expected_string="ERROR: Failed to parse pattern d!"
	elif [ "$2" = "eval_pattern_is_to_short" ]; then
 		expected_string="ERROR: Pattern 1'b1 is to short!"
	elif [ "$2" = "eval_two_distinct_solutions" ]; then
 		expected_string="ERROR: Found two distinct solutions to SAT problem."
	elif [ "$2" = "fmcombine_invalid_number_of_param" ]; then
 		expected_string="ERROR: Invalid number of arguments."
	elif [ "$2" = "fmcombine_module_not_found" ]; then
 		expected_string="ERROR: Module topp not found."
	elif [ "$2" = "fmcombine_gold_cell_not_found" ]; then
 		expected_string="ERROR: Gold cell u_mid8 not found in module top."
	elif [ "$2" = "fmcombine_gate_cell_not_found" ]; then
 		expected_string="ERROR: Gate cell u_mid8 not found in module top."
	elif [ "$2" = "fmcombine_types_not_match" ]; then
 		expected_string="ERROR: Types of gold and gate cells do not match."
	elif [ "$2" = "fmcombine_nop_with_fwd" ] || \
		 [ "$2" = "fmcombine_nop_with_bwd" ] || \
		 [ "$2" = "fmcombine_nop_with_fwd_bwd" ]; then
		expected_string="ERROR: Option -nop can not be combined with -fwd and/or -bwd."
	elif [ "$2" = "freduce_logic_loop" ]; then
 		expected_string="ERROR: Found logic loop:"
	elif [ "$2" = "miter_cant_find_gate_module" ]; then
 		expected_string="ERROR: Can't find gate module"
	elif [ "$2" = "miter_cant_find_gold_module" ]; then
 		expected_string="ERROR: Can't find gold module"
	elif [ "$2" = "miter_cant_find_module" ]; then
 		expected_string="ERROR: Can't find module"
	elif [ "$2" = "miter_missing_mode_param" ]; then
 		expected_string="ERROR: Missing mode parameter!"
	elif [ "$2" = "miter_no_match_in_gate" ]; then
 		expected_string="ERROR: No matching port in gate module was found for"
	elif [ "$2" = "miter_no_match_in_gold" ]; then
 		expected_string="ERROR: No matching port in gold module was found for"
	elif [ "$2" = "miter_there_is_already_a_module" ]; then
 		expected_string="ERROR: There is already a module"
	elif [ "$2" = "mutate_error" ]; then
 		expected_string="ERROR: Invalid mode:"
	elif [ "$2" = "plugin_error" ]; then
 		expected_string="ERROR: Can't load module"
	elif [ "$2" = "rename_obj_not_found" ]; then
 		expected_string="ERROR: Object \`u' not found!"
	elif [ "$2" = "rename_no_top_module" ]; then
 		expected_string="ERROR: No top module found!"
	elif [ "$2" = "rename_invalid_number_of_args" ] || \
		 [ "$2" = "rename_invalid_number_of_args_top" ]; then
 		expected_string="ERROR: Invalid number of arguments!"
	elif [ "$2" = "rename_mode_out_requires" ]; then
 		expected_string="ERROR: Mode -output requires that there is an active module selected."
	elif [ "$2" = "sat_show_fail" ]; then
 		expected_string="ERROR: Failed to parse show expression"
	elif [ "$2" = "sat_provex_diff_size" ]; then
 		expected_string="ERROR: Proof-x expression with different lhs and rhs sizes:"
	elif [ "$2" = "sat_provex_lhs_fail" ]; then
 		expected_string="ERROR: Failed to parse lhs proof-x expression "
	elif [ "$2" = "sat_provex_rhs_fail" ]; then
 		expected_string="ERROR: Failed to parse rhs proof-x expression "
	elif [ "$2" = "sat_prove_rhs_fail" ]; then
 		expected_string="ERROR: Failed to parse rhs proof expression "
	elif [ "$2" = "sat_prove_lhs_fail" ]; then
 		expected_string="ERROR: Failed to parse lhs proof expression "
	elif [ "$2" = "sat_prove_diff_size" ]; then
 		expected_string="ERROR: Proof expression with different lhs and rhs sizes:"
	elif [ "$2" = "sat_set_all_undef_at_fail" ] || \
		 [ "$2" = "sat_set_any_undef_at_fail" ] || \
		 [ "$2" = "sat_set_def_at_fail" ] || \
		 [ "$2" = "sat_set_all_undef_fail" ] || \
		 [ "$2" = "sat_set_any_undef_fail" ] || \
		 [ "$2" = "sat_set_def_fail" ]; then
 		expected_string="ERROR: Failed to parse set-def expression "
	elif [ "$2" = "sat_unset_at_fail" ]; then
 		expected_string="ERROR: Failed to parse lhs set expression "
	elif [ "$2" = "sat_set_at_diff_size" ]; then
 		expected_string="ERROR: Set expression with different lhs and rhs sizes:"
	elif [ "$2" = "sat_set_at_lhs_fail" ]; then
 		expected_string="ERROR: Failed to parse lhs set expression"
	elif [ "$2" = "sat_set_at_rhs_fail" ]; then
 		expected_string="ERROR: Failed to parse rhs set expression"
	elif [ "$2" = "sat_set_diff_size" ]; then
 		expected_string="ERROR: Set expression with different lhs and rhs sizes:"
	elif [ "$2" = "sat_set_rhs_fail" ]; then
 		expected_string="ERROR: Failed to parse rhs set expression"
	elif [ "$2" = "sat_set_lhs_fail" ]; then
 		expected_string="ERROR: Failed to parse lhs set expression"
	elif [ "$2" = "sat_cnf_open_json_file" ] || \
		 [ "$2" = "sat_cant_open_json_file" ] || \
		 [ "$2" = "sat_cant_open_vcd_file" ] ; then
 		expected_string="ERROR: Can't open output file"
	elif [ "$2" = "sat_falsify_fail" ]; then
 		expected_string="ERROR: Called with -falsify and found a model"
	elif [ "$2" = "sat_verify_fail" ]; then
 		expected_string="ERROR: Called with -verify and proof did fail!"
Miodrag Milanovic committed
221
	elif [ "$2" = "sat_maxundef_with_tempinduct" ] || \
222 223 224 225 226
		 [ "$2" = "sat_max_with_tempinduct" ] || \
		 [ "$2" = "sat_max_max_undef_with_tempinduct" ] || \
		 [ "$2" = "sat_max_maxundef_with_tempinduct" ] || \
		 [ "$2" = "sat_max_maxundef_all_with_tempinduct" ]; then
 		expected_string="ERROR: The options -max, -all, and -max_undef are not supported for temporal induction proofs!"
Miodrag Milanovic committed
227 228 229 230
	elif [ "$2" = "sat_all_with_tempinduct" ] || \
		 [ "$2" = "sat_max_all_with_tempinduct" ]; then
		expect_fail=1
 		expected_string="SAT temporal induction proof finished - model found for base case: FAIL!"
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
	elif [ "$2" = "sat_maxsteps_only_for_tempinduct" ]; then
 		expected_string="ERROR: The options -maxsteps is only supported for temporal induction proofs!"
	elif [ "$2" = "sat_si_def_zero" ] || \
		 [ "$2" = "sat_si_undef_zero" ] || \
		 [ "$2" = "sat_si_def_undef" ] || \
		 [ "$2" = "sat_si_def_undef_zero" ]; then
 		expected_string="ERROR: The options -set-init-undef, -set-init-def, and -set-init-zero are exclusive!"
	elif [ "$2" = "sat_failed_to_import_cell" ]; then
 		expected_string="ERROR: Failed to import cell "
	elif [ "$2" = "sat_prove_skip_must_be_smaller_than_seq" ]; then
 		expected_string="ERROR: The value of -prove-skip must be smaller than the one of -seq."
	elif [ "$2" = "sat_prove_and_tempinduct" ]; then
 		expected_string="ERROR: Options -prove-skip and -tempinduct don't work with each other. Use -seq instead of -prove-skip."
	elif [ "$2" = "sat_got_tempinduct_but_nothing_to_prove" ]; then
 		expected_string="ERROR: Got -tempinduct but nothing to prove!"
	elif [ "$2" = "sat_cant_perform_sat_on_empty_sel" ]; then
 		expected_string="ERROR: Can't perform SAT on an empty selection!"
	elif [ "$2" = "sat_only_one_module_must_be_sel" ]; then
 		expected_string="ERROR: Only one module must be selected for the SAT pass! "
	elif [ "$2" = "scc_expect1" ]; then
 		expected_string="ERROR: Found 0 SCCs but expected 1"
	elif [ "$2" = "select_add_with_del" ] || \
		 [ "$2" = "select_assert_any_with_count" ] || \
		 [ "$2" = "select_assert_max_with_del" ] || \
		 [ "$2" = "select_assert_none_with_min" ]; then
 		expected_string="ERROR: Options -add, -del, -assert-none, -assert-any, assert-count, -assert-max or -assert-min can not be combined"
	elif [ "$2" = "select_assert_any_failed" ]; then
 		expected_string="ERROR: Assertion failed: selection is empty: uuu"
	elif [ "$2" = "select_assert_count_failed" ]; then
 		expected_string="ERROR: Assertion failed: selection contains 11 elements instead of the asserted 30: top"
	elif [ "$2" = "select_assert_list_with_assert_max" ] || \
		 [ "$2" = "select_assert_list_with_del" ] || \
		 [ "$2" = "select_write_with_assert_count" ] || \
		 [ "$2" = "select_write_with_del" ] || \
		 [ "$2" = "select_count_with_assert_min" ] || \
		 [ "$2" = "select_count_with_assert_none" ]; then
 		expected_string="ERROR: Options -list, -write and -count can not be combined with -add, -del, -assert-none, -assert-any, assert-count, -assert-max, or -assert-min."
	elif [ "$2" = "select_assert_max_failed" ]; then
 		expected_string="ERROR: Assertion failed: selection contains 11 elements, more than the maximum number 1: top"
	elif [ "$2" = "select_assert_min_failed" ]; then
 		expected_string="ERROR: Assertion failed: selection contains 11 elements, less than the minimum number 30: top"
	elif [ "$2" = "select_assert_none_failed" ]; then
 		expected_string="ERROR: Assertion failed: selection is not empty: top"
	elif [ "$2" = "select_cant_open_for_reading" ]; then
 		expected_string="ERROR: Can't open 'txt.txt' for reading: No such file or directory"
	elif [ "$2" = "select_cant_open_for_writing" ]; then
 		expected_string="ERROR: Can't open './tt/ot.txt' for writing: No such file or directory"
	elif [ "$2" = "select_clear_with_other_opt" ]; then
 		expected_string="ERROR: Option -clear can not be combined with any other options."
	elif [ "$2" = "select_error_in_expand_op" ]; then
 		expected_string="ERROR: Syntax error in expand operator '%x:'."
	elif [ "$2" = "select_none_with_other_opt" ]; then
 		expected_string="ERROR: Option -none can not be combined with any other options."
	elif [ "$2" = "select_no_sel_to_check_as_any" ] || \
		 [ "$2" = "select_no_sel_to_check_as_count" ] || \
		 [ "$2" = "select_no_sel_to_check_as_max" ] || \
		 [ "$2" = "select_no_sel_to_check_as_min" ] || \
		 [ "$2" = "select_no_sel_to_check_as_none" ]; then
 		expected_string="ERROR: No selection to check."
	elif [ "$2" = "select_no_such_module" ]; then
 		expected_string="ERROR: No such module: x"
	elif [ "$2" = "select_nothing_to_add" ]; then
 		expected_string="ERROR: Nothing to add to selection."
	elif [ "$2" = "select_nothing_to_del" ]; then
 		expected_string="ERROR: Nothing to delete from selection."
	elif [ "$2" = "select_one_elem_for__a" ] || \
		 [ "$2" = "select_one_elem_for__cie" ] || \
		 [ "$2" = "select_one_elem_for__ci" ] || \
		 [ "$2" = "select_one_elem_for__coe" ] || \
		 [ "$2" = "select_one_elem_for__co" ] || \
		 [ "$2" = "select_one_elem_for__C" ] || \
		 [ "$2" = "select_one_elem_for__c" ] || \
		 [ "$2" = "select_one_elem_for__m" ] || \
		 [ "$2" = "select_one_elem_for__M" ] || \
		 [ "$2" = "select_one_elem_for__n" ] || \
		 [ "$2" = "select_one_elem_for__R" ] || \
		 [ "$2" = "select_one_elem_for__s" ] || \
		 [ "$2" = "select_one_elem_for__xe" ] || \
		 [ "$2" = "select_one_elem_for__x" ]; then
 		expected_string="ERROR: Must have at least one element on the stack for operator"
	elif [ "$2" = "select_one_elem_for__D" ] || \
		 [ "$2" = "select_one_elem_for__d" ] || \
		 [ "$2" = "select_one_elem_for__i" ] || \
		 [ "$2" = "select_one_elem_for__u" ]; then
 		expected_string="ERROR: Must have at least two elements on the stack for operator"
	elif [ "$2" = "select_read_with_selection_expr" ]; then
 		expected_string="ERROR: Option -read can not be combined with a selection expression."
	elif [ "$2" = "select_selection_isnt_defined" ]; then
 		expected_string="ERROR: Selection @ is not defined!"
	elif [ "$2" = "select_set_with_assert_any" ] || \
		 [ "$2" = "select_set_with_assert_max" ] || \
		 [ "$2" = "select_set_with_count" ] || \
		 [ "$2" = "select_set_with_del" ] || \
		 [ "$2" = "select_set_with_list" ]; then
 		expected_string="ERROR: Option -set can not be combined with -list, -write, -count, -add, -del, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min."
	elif [ "$2" = "select_unknown_opt" ]; then
 		expected_string="ERROR: Unknown option -x."
	elif [ "$2" = "select_unknown_selection" ]; then
 		expected_string="ERROR: Unknown selection operator '%xmux'"
	elif [ "$2" = "select_cd_invalid_number_of_args" ]; then
 		expected_string="ERROR: Invalid number of arguments."
	elif [ "$2" = "select_cd_no_such_module" ]; then
 		expected_string="ERROR: No such module \`tt/tt' found!"
	elif [ "$2" = "setattr_cant_decode_value" ]; then
 		expected_string="ERROR: Can't decode value "
	elif [ "$2" = "setundef_expose_without_undriven" ]; then
 		expected_string="ERROR: Option -expose must be used with option -undriven."
	elif [ "$2" = "setundef_init_with_anyconst" ] || \
		 [ "$2" = "setundef_init_with_anyseq" ]; then
 		expected_string="ERROR: The options -init and -anyseq / -anyconst are exclusive."
	elif [ "$2" = "setundef_one_of_options" ]; then
 		expected_string="ERROR: One of the options -zero, -one, -anyseq, -anyconst, or -random <seed> must be specified."
	elif [ "$2" = "setundef_undriven_with_process" ]; then
 		expected_string="ERROR: The 'setundef' command can't operate in -undriven mode on modules with processes. Run 'proc' first."
	elif [ "$2" = "show_only_one_module" ]; then
 		expected_string="ERROR: For formats different than 'ps' or 'dot' only one module must be selected."
	elif [ "$2" = "show_cant_open_dot_file" ]; then
 		expected_string="ERROR: Can't open dot file "
	elif [ "$2" = "show_cant_open_lib_file" ]; then
 		expected_string="ERROR: Can't open lib file "
	elif [ "$2" = "show_nothing_there_to_show" ]; then
 		expected_string="ERROR: Nothing there to show."
	elif [ "$2" = "splice_port_and_no_port" ]; then
 		expected_string="ERROR: The options -port and -no_port are exclusive!"
	elif [ "$2" = "splice_sel_by_cell_and_sel_any_bit" ]; then
 		expected_string="ERROR: The options -sel_by_cell and -sel_any_bit are exclusive!"
	elif [ "$2" = "splice_sel_by_cell_and_sel_by_wire" ]; then
 		expected_string="ERROR: The options -sel_by_cell and -sel_by_wire are exclusive!"
	elif [ "$2" = "stat_unsupported_tech" ]; then
 		expected_string="ERROR: Unsupported technology: "
	elif [ "$2" = "stat_cant_find_module" ]; then
 		expected_string="ERROR: Can't find module"
	elif [ "$2" = "stat_cant_open_lib_file" ]; then
 		expected_string="ERROR: Can't open liberty file "
	elif [ "$2" = "tee_o_cant_create_file" ] || \
		 [ "$2" = "tee_a_cant_create_file" ]; then
 		expected_string="ERROR: Can't create file"
	elif [ "$2" = "test_cell_failed_to_open" ]; then
 		expected_string="ERROR: Failed to open output file "
	elif [ "$2" = "test_cell_unexpected_opt" ]; then
 		expected_string="ERROR: Unexpected option: "
	elif [ "$2" = "test_cell_cell_type_not_supported" ]; then
 		expected_string="ERROR: The cell type \`\$_XOR_' is currently not supported. Try one of these:"
	elif [ "$2" = "test_cell_no_cell_t_specified" ]; then
 		expected_string="ERROR: No cell type to test specified."
	elif [ "$2" = "test_cell_dont_spec_cell_type_with_f" ]; then
 		expected_string="ERROR: Do not specify any cell types when using -f."
	elif [ "$2" = "write_file_missing_name" ] || \
		 [ "$2" = "write_file_a_missing_name" ]; then
 		expected_string="ERROR: Missing output filename."
381
	fi
382

383

Miodrag Milanovic committed
384 385 386 387 388 389 390 391 392 393
	if   [ "$expect_fail" = "0" ]; then
		if yosys -ql yosys.log ../../scripts/$2.ys; then
			echo FAIL > ${1}_${2}.status
		else
			if  grep "$expected_string" yosys.log && [ "$expected_string" != "" ]; then
				echo PASS > ${1}_${2}.status
			else
				echo FAIL > ${1}_${2}.status
			fi
		fi
394
	else
Miodrag Milanovic committed
395
		if yosys -ql yosys.log ../../scripts/$2.ys; then
396 397
			echo PASS > ${1}_${2}.status
		else
Miodrag Milanovic committed
398 399 400 401 402
			if  grep "$expected_string" yosys.log && [ "$expected_string" != "" ]; then
				echo FAIL > ${1}_${2}.status
			else
				echo PASS > ${1}_${2}.status
			fi
403
		fi
404
	fi
405 406 407 408 409 410 411
else

	yosys -ql yosys.log ../../scripts/$2.ys
	if [ $? != 0 ] ; then
		echo FAIL > ${1}_${2}.status
		touch .stamp
		exit 0
412
	fi
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479

	#cases where some object names are/aren't expected in output file (tee -o result.log in the test script)
	cell_failed="0"
	expected_string=""
	expected="1"

	if   [ "$2" = "add" ]; then
		expected_string="wire width 0 \\\w"
	elif [ "$2" = "add_global_input" ]; then
		expected_string="wire width 32000 input 6 \\\gi"
	elif [ "$2" = "add_input" ]; then
		expected_string="wire width 2 input 6 \\\i"
	elif [ "$2" = "add_output" ]; then
		expected_string="wire width 3 output 6 \\\o"
	elif [ "$2" = "add_inout" ]; then
		expected_string="wire width 3 inout 6 \\\34"
	elif [ "$2" = "add_wire" ]; then
		expected_string="wire \\\w"
	elif [ "$2" = "assertpmux" ]; then
		expected_string="cell \$assert"
	elif [ "$2" = "assertpmux_always" ]; then
		expected_string="cell \$assert"
	elif [ "$2" = "assertpmux_noinit" ]; then
		expected_string="cell \$assert"
	elif [ "$1" = "blackbox" ]; then
		expected_string="attribute \\\blackbox 1"
	elif [ "$2" = "chformal" ]; then
		expected_string="cell \$assert"
		expected="0"
	elif [ "$2" = "chformal_assert" ]; then
		expected_string="cell \$assert"
		expected="0"
	elif [ "$2" = "chformal_assert2assume" ]; then
		expected_string="cell \$assert"
		expected="0"
	elif [ "$2" = "chformal_assume" ]; then
		expected_string="cell \$assume"
		expected="0"
	elif [ "$2" = "chformal_assume2assert" ]; then
		expected_string="cell \$assume"
		expected="0"
	elif [ "$2" = "chformal_fair" ]; then
		expected_string="cell \$fair"
		expected="0"
	elif [ "$2" = "chformal_fair2live" ]; then
		expected_string="cell \$fair"
		expected="0"
	elif [ "$2" = "chformal_fair2live_assert2assume" ]; then
		expected_string="cell \$fair"
		expected="0"
	elif [ "$2" = "chformal_live" ]; then
		expected_string="cell \$live"
		expected="0"
	elif [ "$2" = "chformal_live2fair" ]; then
		expected_string="cell \$live"
		expected="0"
	elif [ "$2" = "delete" ]; then
		expected_string="module \\\middle"
		expected="0"
	elif [ "$2" = "delete_proc" ]; then
		expected_string="process \$proc\$../top.v:13\$1"
		expected="0"
	elif [ "$2" = "delete_input" ]; then
		expected_string="wire input 1 \\\x"
		expected="0"
	elif [ "$2" = "delete_output" ]; then
		expected_string="wire output 3 \\\o"
480
		expected="0"
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
	elif [ "$2" = "delete_port" ]; then
		expected_string="wire output 4 \\\A"
		expected="0"
	elif [ "$2" = "delete_cell" ]; then
		expected_string="cell \$mux \$ternary\$../top.v:16\$2"
		expected="0"
	elif [ "$2" = "delete_wire" ]; then
		expected_string="wire \\\o"
		expected="0"
	elif [ "$2" = "delete_mem" ]; then
		expected_string="cell \$memrd \$memrd\$\ram\$../top.v:30\$7"
		expected="0"
	elif [ "$2" = "edgetypes" ]; then
		expected_string="\$add"
	elif [ "$1" = "fmcombine" ]; then
		expected_string="Combining cells "
	elif [ "$1" = "insbuf" ]; then
		expected_string="cell \$_BUF_ \$auto\$insbuf"
	elif [ "$1" = "ltp" ]; then
		expected_string="Longest topological path in"
	elif [ "$1" = "mutate" ]; then
		if [ "$2" = "mutate_all" ] || \
		[ "$2" = "mutate_cnot0" ] || \
		[ "$2" = "mutate_cnot1" ] || \
		[ "$2" = "mutate_const0" ] || \
		[ "$2" = "mutate_const1" ] || \
		[ "$2" = "mutate_inv" ]; then
		expected_string="\$auto\$mutate"
		fi
	elif [ "$1" = "mutate_mem" ]; then
		if [ "$2" = "mutate_all" ]; then
		expected_string="\$auto\$mutate"
		fi
	elif [ "$2" = "pmuxtree" ]; then
		expected_string="cell \$pmux"
		expected="0"
SergeyDegtyar committed
517 518 519 520 521 522
	elif [ "$1" = "pmux2shiftx" ]; then
		if [ "$2" = "pmux2shiftx_min_choices_3000" ] || \
		   [ "$2" = "pmux2shiftx_min_dens_3000" ]; then
		   expected="0"
		fi
		expected_string="cell \$shiftx"
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
	elif [ "$1" = "qwp" ]; then
		expected_string="attribute \\\qwp_position"
	elif [ "$2" = "rename" ]; then
		expected_string="module \\\mid_module"
	elif [ "$2" = "rename_low" ]; then
		expected_string="module \\\newlow"
	elif [ "$2" = "rename_top" ]; then
		expected_string="module \\\new_top"
	elif [ "$2" = "rmports" ]; then
		expected_string="wire output 5 \\\cout"
		expected="0"
	elif [ "$2" = "scatter" ]; then
		expected_string="\$auto\$scatter"
	elif [ "$1" = "scc" ] || \
		[ "$1" = "scc_hier_feedback" ]; then
		expected_string="0 SCCs"
		if [ "$1" = "scc_hier_feedback" ] && [ "$2" = "scc_all_cell_types" ]; then
			expected="0"
		fi
	elif [ "$1" = "scc_feedback" ]; then
		expected_string="0 SCCs"
		expected="0"
	elif [ "$1" = "setattr" ] || \
		[ "$1" = "setattr_mem" ]; then
		if [ "$2" = "setattr" ] || \
		[ "$2" = "setattr_top" ] || \
		[ "$2" = "setattr_unset" ]; then
		expected_string="attribute \\\u 1"
		expected="0"
		else
		expected_string="attribute \\\u 1"
		fi
	elif [ "$1" = "sim" ] || \
		[ "$1" = "sim_mem" ]; then
		if [ "$2" != "sim_d" ]; then
		expected_string="Simulating cycle"
		fi
	elif [ "$1" = "splice" ]; then
		expected_string="\$auto\$splice"
	elif [ "$1" = "splitnets" ]; then
		if [ "$2" = "splitnets_dpf" ] || \
		[ "$2" = "splitnets_driver" ]; then
		expected_string="wire width 8 \$memwr"
		else
		expected_string="wire width 8 \$memwr"
		expected="0"
		fi
	elif [ "$1" = "stat" ]; then
		expected_string="middle                          1"
	elif [ "$1" = "supercover" ]; then
		expected_string="cell \$cover \$auto\$supercover"
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
	elif [ "$1" = "help" ]; then
		if [ "$2" = "help" ]; then
		expected_string="abc                  use ABC for technology mapping"
		elif [ "$2" = "help_all" ]; then
		expected_string="abc  --  use ABC for technology mapping"
		elif [ "$2" = "help_cells" ]; then
		expected_string="\$_ANDNOT_        (A, B, Y)"
		elif [ "$2" = "help_celltype" ]; then
		expected_string="\$dff (CLK, D, Q)"
		elif [ "$2" = "help_celltype_plus" ]; then
		expected_string="\$dff (CLK, D, Q);"
		elif [ "$2" = "help_command" ]; then
		expected_string="read_verilog \[options\] \[filename\]"
		elif [ "$2" = "help_no_such_command" ]; then
		expected_string="No such command or cell type:"
		fi
590
	fi
591 592 593 594 595 596 597 598

	if [ "$expected_string" != "" ]; then
	if grep "$expected_string" result.log; then
		if [ $expected = "1" ]; then
			cell_failed="0"
		else
			cell_failed="1"
		fi
599
	else
600 601 602 603 604
		if [ $expected = "1" ]; then
			cell_failed="1"
		else
			cell_failed="0"
		fi
605 606 607
	fi
	fi

608 609 610 611
	if grep 'Assert' result.log || grep 'failed in' result.log || grep 'ERROR' result.log; then
		echo FAIL > ${1}_${2}.status
	elif [ $cell_failed = '1' ]; then
		echo FAIL > ${1}_${2}.status
612
	else
613
		echo PASS > ${1}_${2}.status
614 615
	fi

616

617
fi
618
touch .stamp