|
| 1 | +# Check that read_upf errors cross the C++/Tcl boundary without aborting. |
| 2 | +set test_name read_upf_errors |
| 3 | +source "helpers.tcl" |
| 4 | + |
| 5 | +read_liberty data/sky130hd/sky130_fd_sc_hd__tt_025C_1v80.lib |
| 6 | +read_lef data/sky130hd/sky130_fd_sc_hd.tlef |
| 7 | +read_lef data/sky130hd/sky130_fd_sc_hd_merged.lef |
| 8 | +read_verilog data/mpd_top/mpd_top.v |
| 9 | +link_design mpd_top |
| 10 | + |
| 11 | +read_upf -file data/mpd_top/mpd_top.upf |
| 12 | + |
| 13 | +set upf_file [make_result_file "${test_name}.upf"] |
| 14 | + |
| 15 | +foreach {description command expected_error} { |
| 16 | + "missing master" |
| 17 | + {map_power_switch psw_aes_1 -lib_cells {no_such_cell} -port_map {{vin1 A}}} |
| 18 | + UPF-0043 |
| 19 | + |
| 20 | + "missing master terminal" |
| 21 | + {map_power_switch psw_aes_1 -lib_cells {sky130_fd_sc_hd__and2_0} -port_map {{vin1 NOPE}}} |
| 22 | + ODB-0154 |
| 23 | + |
| 24 | + "missing isolation domain" |
| 25 | + {set_isolation iso_x} |
| 26 | + UPF-0073 |
| 27 | +} { |
| 28 | + set ::read_upf_after_error 0 |
| 29 | + set stream [open $upf_file w] |
| 30 | + puts $stream $command |
| 31 | + puts $stream {set ::read_upf_after_error 1} |
| 32 | + close $stream |
| 33 | + |
| 34 | + set status [catch { read_upf -file $upf_file } message] |
| 35 | + check "$description returns a Tcl error" { set status } 1 |
| 36 | + check "$description preserves the error ID" { set message } $expected_error |
| 37 | + check "$description stops the UPF file" { set ::read_upf_after_error } 0 |
| 38 | + |
| 39 | + set stream [open $upf_file w] |
| 40 | + puts $stream { |
| 41 | + map_power_switch psw_aes_1 \ |
| 42 | + -lib_cells {sky130_fd_sc_hd__and2_0} \ |
| 43 | + -port_map {{vin1 A}} |
| 44 | + } |
| 45 | + puts $stream {set ::read_upf_after_error 1} |
| 46 | + close $stream |
| 47 | + |
| 48 | + check "valid UPF succeeds after $description" { |
| 49 | + catch { read_upf -file $upf_file } |
| 50 | + } 0 |
| 51 | + check "valid UPF completes after $description" { set ::read_upf_after_error } 1 |
| 52 | +} |
| 53 | + |
| 54 | +exit_summary |
0 commit comments