File size: 3,655 Bytes
8c7dd56
 
 
 
 
 
 
 
 
6104d33
 
 
 
 
 
8c7dd56
2e4ea50
8c7dd56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51debf3
8c7dd56
 
 
51debf3
8c7dd56
 
 
 
 
 
6104d33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8c7dd56
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
#!/bin/bash

# Usage: ./verify_design.sh <design_name>

if [ -z "$1" ]; then
    echo "Usage: ./verify_design.sh <design_name>"
    exit 1
fi

# Auto-load environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/setup_env.sh" ]; then
    source "$SCRIPT_DIR/setup_env.sh" > /dev/null
fi

DESIGN=$1
OPENLANE_ROOT="${OPENLANE_ROOT:-$HOME/OpenLane}"
DESIGN_DIR=$OPENLANE_ROOT/designs/$DESIGN

echo "========================================"
echo "Verifying Design: $DESIGN"
echo "========================================"

# 1. Functional Verification (RTL Simulation)
echo "[1] Functional Verification (Icarus Verilog)"
if [ -f "$DESIGN_DIR/src/${DESIGN}_tb.v" ]; then
    echo "    Found Testbench: ${DESIGN}_tb.v"
    cd $DESIGN_DIR/src
    iverilog -o sim ${DESIGN}.v ${DESIGN}_tb.v
    if [ $? -eq 0 ]; then
        echo "    Compilation Successful."
        echo "    Running Simulation..."
        vvp sim > simulation.log
        cat simulation.log
        echo "    (Check output above for expected behavior)"
    else
        echo "    [ERROR] Compilation Failed."
    fi
    cd $OPENLANE_ROOT
else
    echo "    [WARNING] No testbench found at $DESIGN_DIR/src/${DESIGN}_tb.v"
    echo "    Please create one to run functional simulation."
fi

echo ""
echo "========================================"

# 2. Physical Verification (OpenLane Reports)
echo "[2] Physical Verification (Latest Run)"
LATEST_RUN=$(ls -td $DESIGN_DIR/runs/* | head -1)

if [ -z "$LATEST_RUN" ]; then
    echo "    [ERROR] No runs found for $DESIGN."
else
    echo "    Checking run: $(basename $LATEST_RUN)"
    
    # Check DRC
    DRC_RPT=$(find $LATEST_RUN -name "*drc.rpt" | head -1)
    if [ -f "$DRC_RPT" ]; then
        echo "    --- DRC Report ($(basename $DRC_RPT)) ---"
        COUNT=$(grep -c "violation" $DRC_RPT)
        if [ "$COUNT" -eq "0" ]; then
             # Some reports might use different format, check content
             grep "Count: 0" $DRC_RPT > /dev/null
             if [ $? -eq 0 ]; then
                echo "    [PASS] No DRC Violations found."
             else
                # Print last few lines
                tail -n 5 $DRC_RPT
             fi
        else
            echo "    [FAIL] Found potential violations."
            tail -n 5 $DRC_RPT
        fi
    else
        echo "    [WARNING] DRC Report not found."
    fi

    echo ""
    
    # Check LVS
    LVS_RPT=$(find $LATEST_RUN -name "*lvs.log" | head -1)
    if [ -f "$LVS_RPT" ]; then
        echo "    --- LVS Report ($(basename $LVS_RPT)) ---"
        if grep -q "Total errors = 0" $LVS_RPT || grep -q "Circuits match uniquely" $LVS_RPT; then
            echo "    [PASS] LVS Clean. Layout matches Schematic."
        else
            echo "    [FAIL] LVS Mismatch."
            tail -n 3 $LVS_RPT
        fi
    else
         echo "    [WARNING] LVS Report not found."
    fi
fi

echo ""
echo "========================================"

# 3. Formal Verification (SymbiYosys)
echo "[3] Formal Verification (SymbiYosys)"
if [ -f "$DESIGN_DIR/src/${DESIGN}.sby" ]; then
    echo "    Found SBY Config: ${DESIGN}.sby"
    cd $DESIGN_DIR/src
    if command -v sby &> /dev/null; then
        sby -f ${DESIGN}.sby
        if [ $? -eq 0 ]; then
             echo "    [PASS] Formal Proof Successful."
        else
             echo "    [FAIL] Formal Proof Failed."
        fi
    else
        echo "    [WARNING] 'sby' command not found. Skipping Formal Verification."
    fi
    cd $OPENLANE_ROOT
else
    echo "    [INFO] No SBY config found. Skipping."
fi

echo "========================================"
echo "Verification Complete."