Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 1 | # Copyright lowRISC contributors. |
| 2 | # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | # This script has commands to run the design using VC Formal |
| 6 | |
| 7 | #------------------------------------------------------------------------- |
| 8 | # Analysing and elaborating the design |
| 9 | #------------------------------------------------------------------------- |
| 10 | # only one scr file exists in this folder |
| 11 | |
| 12 | analyze -format sverilog \ |
| 13 | -vcs "+define+FPV_ON -assert svaext \ |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 14 | -f [glob *.scr]" |
| 15 | |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 16 | elaborate -sva $env(FPV_TOP) |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 17 | |
| 18 | #------------------------------------------------------------------------- |
| 19 | # Specify clock(s) and reset(s) |
| 20 | #------------------------------------------------------------------------- |
| 21 | # specify the primary clocks and resets in the design. |
| 22 | # use "-period" option with "create_clock" to specify the period |
| 23 | # use "-sense low/high" option with "create_reset" to specify active low or high reset respectively |
| 24 | # |
| 25 | # note: the TL-UL protocol checker tlul_assert.sv operates on the negedge clock |
| 26 | |
| 27 | if {$env(FPV_TOP) == "rv_dm"} { |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 28 | create_clock clk_i -period 100 |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 29 | create_clock tck_i -period 100 |
| 30 | create_reset rst_ni -sense low |
| 31 | create_reset trst_ni -sense low |
| 32 | } elseif {$env(FPV_TOP) == "spi_device"} { |
| 33 | create_clock clk_i -period 100 |
| 34 | create_clock cio_sck_i -period 100 |
| 35 | create_reset rst_ni -sense low |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 36 | create_reset cio_csb_i -sense high |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 37 | } elseif {$env(FPV_TOP) == "usb_fs_nb_pe"} { |
| 38 | create_clock clk_48mhz_i -period 100 |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 39 | create_reset rst_ni -sense low |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 40 | } elseif {$env(FPV_TOP) == "usbuart"} { |
| 41 | create_clock clk_i -period 100 |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 42 | create_clock clk_48mhz_i -period 100 |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 43 | create_reset rst_ni -sense low |
| 44 | } elseif {$env(FPV_TOP) == "usbdev"} { |
| 45 | create_clock clk_i -period 100 |
| 46 | create_clock clk_usb_48mhz_i -period 100 |
| 47 | create_reset rst_ni -sense low |
| 48 | } elseif {$env(FPV_TOP) == "top_earlgrey"} { |
| 49 | create_clock clk_i -period 100 |
| 50 | create_clock jtag_tck_i -period 100 |
| 51 | create_reset rst_ni -sense low |
| 52 | create_reset jtag_trst_ni -sense low |
| 53 | } elseif {$env(FPV_TOP) == "xbar_main"} { |
| 54 | create_clock clk_main_i -period 100 |
| 55 | create_reset rst_main_ni -sense low |
| 56 | } else { |
| 57 | create_clock clk_i -period 100 |
| 58 | create_reset rst_ni -sense low |
| 59 | } |
| 60 | |
| 61 | #------------------------------------------------------------------------- |
| 62 | # Assume properties for inputs |
| 63 | #------------------------------------------------------------------------- |
| 64 | |
| 65 | # For sram2tlul, input tl_i.a_ready is constrained by below asssertion |
| 66 | fvassume sram2tlul.validNotReady* |
| 67 | |
| 68 | # Input scanmode_i should not be X |
| 69 | fvassume *.scanmodeKnown |
| 70 | |
| 71 | #------------------------------------------------------------------------- |
| 72 | # TODO: eventually remove below assert disable lines |
| 73 | # To reduce prohibitive runtimes, below assertions are simply turned off for now |
| 74 | #------------------------------------------------------------------------- |
| 75 | |
| 76 | # spi_device |
| 77 | fvdisable {*spi_device.u_tlul2sram.tlul_assert_host.responseSize*} |
| 78 | fvdisable {*spi_device.u_tlul2sram.tlul_assert_host.onlyOnePendingReq*} |
| 79 | fvdisable {*spi_device.tlul_assert_host.responseMustHaveReq*} |
| 80 | fvdisable {*spi_device.tlul_assert_host.checkResponseOpcode*} |
| 81 | fvdisable {*spi_device.u_reg.tlul_assert_host.responseMustHaveReq*} |
| 82 | fvdisable {*spi_device.u_reg.tlul_assert_host.checkResponseOpcode*} |
| 83 | fvdisable {*spi_device.u_reg.u_socket.tlul_assert_host.responseMustHaveReq*} |
| 84 | fvdisable {*spi_device.u_reg.u_socket.tlul_assert_host.checkResponseOpcode*} |
| 85 | fvdisable {*spi_device.u_reg.u_socket.tlul_assert_device.gen_assert*.tlul_assert.responseSize*} |
| 86 | fvdisable {*spi_device.u_reg.u_socket.tlul_assert_device.gen_assert*.tlul_assert.onlyOnePendingReq*} |
| 87 | fvdisable {*spi_device.u_reg.u_socket.tlul_assert_host.responseSizeMustEqualReq*} |
| 88 | fvdisable {*spi_device.tlul_assert_host.responseSizeMustEqualReq*} |
| 89 | |
| 90 | # hmac |
| 91 | fvdisable {*hmac.u_tlul_adapter.tlul_assert_host.onlyOnePendingReq*} |
| 92 | fvdisable {*hmac.u_reg.u_socket.tlul_assert_device.gen_assert[0]*onlyOnePendingReq*} |
| 93 | |
| 94 | # flash_ctrl |
| 95 | fvdisable {*flash_ctrl.tlul_assert_host.response*Must*} |
| 96 | fvdisable {*flash_ctrl.u_reg.u_socket.tlul_assert_*.response*Must*} |
| 97 | fvdisable {*flash_ctrl.u_reg.u_socket.tlul_assert_device.gen_assert*.tlul_assert.onlyOnePendingReq*} |
| 98 | |
| 99 | # xbar |
| 100 | fvdisable {*xbar_main.tlul_assert_device_*.sizeMatches*} |
| 101 | fvdisable {*xbar_main.tlul_assert_device_*.legalA*} |
| 102 | fvdisable {*xbar_main.tlul_assert_device_*.addressAligned*} |
| 103 | fvdisable {*xbar_main.tlul_assert_device_*.maskMustBeCont*} |
| 104 | fvdisable {*xbar_main.tlul_assert_host_*.legal*} |
| 105 | fvdisable {*xbar_main.u_*.tlul_assert_host.legalDParam*} |
| 106 | fvdisable {*xbar_main.u_*.tlul_assert_device.response*} |
| 107 | fvdisable {*xbar_main.u_*.tlul_assert_device.legalA*} |
| 108 | fvdisable {*xbar_main.u_*.tlul_assert_device.addressAligned*} |
| 109 | fvdisable {*xbar_main.u_*.tlul_assert_device.checkResponseOp*} |
| 110 | fvdisable {*xbar_main.u_*.tlul_assert_device.maskMustBeCont*} |
| 111 | fvdisable {*xbar_main.u_*.tlul_assert_device.sizeMatches*} |
| 112 | fvdisable {*xbar_main.u_*.tlul_assert_*.gen_assert*.tlul_assert.maskMustBeCont*} |
| 113 | fvdisable {*xbar_main.u_*.tlul_assert_*.gen_assert*.tlul_assert.addressAlignedToSize*} |
| 114 | fvdisable {*xbar_main.u_*.tlul_assert_*.gen_assert*.tlul_assert.legal*} |
| 115 | fvdisable {*xbar_main.u_*.tlul_assert_*.gen_assert*.tlul_assert.sizeMatches*} |
| 116 | |
| 117 | # top_earlgrey |
| 118 | fvdisable {top_earlgrey.*addressAligned*} |
| 119 | fvdisable {top_earlgrey.*tlul_assert*Must*} |
| 120 | fvdisable {top_earlgrey.*onlyOne*} |
| 121 | fvdisable {top_earlgrey.*Response*} |
| 122 | fvdisable {top_earlgrey.*legal*} |
| 123 | fvdisable {top_earlgrey.u_xbar_main.u_sm1_*.rspIdInRange} |
| 124 | fvdisable {top_earlgrey.u_xbar_main.*depthShall*} |
| 125 | fvdisable {top_earlgrey.u_xbar_main.*tlul_assert*DataKnown*} |
| 126 | fvdisable {top_earlgrey.u_dm_top.*tlul_assert_*DataKnown*} |
| 127 | |
| 128 | #------------------------------------------------------------------------- |
| 129 | # Configure grid usage |
| 130 | #------------------------------------------------------------------------- |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 131 | # Use "set_grid_usage" option to launch the run on the grid. |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 132 | # Use option "-type <LSF|RTDA|SGE>=<# of workers>" to specify the type of grid and the numbers of workers |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 133 | # "-control {<submission commands>} is used to specify the exact qsub/bsub string to use for accessing the grid resources |
| 134 | # Ex: set_grid_usage -type sge=12 -control { qsub -P <machine name> } |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 135 | set_grid_usage -type RSH=12 |
| 136 | |
| 137 | #------------------------------------------------------------------------- |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 138 | # Run all the assertion and cover properties |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 139 | #------------------------------------------------------------------------- |
| 140 | # time limit set to 2 hours |
| 141 | set_fml_var fml_max_time 2H |
| 142 | |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 143 | # initialize the design |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 144 | sim_run -stable |
| 145 | sim_save_reset |
| 146 | |
| 147 | check_fv -block |
| 148 | |
| 149 | #------------------------------------------------------------------------- |
| 150 | # Report |
| 151 | #------------------------------------------------------------------------- |
| 152 | # to generate detailed report add "-verbose" option to "report_fv" |
| 153 | # Ex: report_fv -verbose > ../../../$env(FPV_TOP)_verbose.result |
| 154 | report_fv > ../../../$env(FPV_TOP).result |
| 155 | |
| 156 | #------------------------------------------------------------------------- |
| 157 | # Generate Formal Coverage |
| 158 | #------------------------------------------------------------------------- |
Cindy Chen | c37f697 | 2020-06-24 14:25:02 -0700 | [diff] [blame] | 159 | # VC Formal also provides formal coverage metrics as part of formal signoff flow. |
Will Chen | 4af6c25 | 2020-03-12 11:30:59 -0700 | [diff] [blame] | 160 | # If you would like to generate formal coverage or need any other help, please send email to vcf_support@synopsys.com |
| 161 | |
| 162 | quit |