-
Notifications
You must be signed in to change notification settings - Fork 3
/
create_verilog_list
executable file
·55 lines (52 loc) · 1.01 KB
/
create_verilog_list
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
#! /usr/bin/env bash
if [[ $# -ne 2 ]]; then
echo "usage: $0 <directory> <top>"
exit 1
fi
DIR=$1
TOP=$2
cd $DIR
#ls $PWD/*.v
grep ' (' *.v |
sed 's/:/ /' |
awk -v top=$TOP '
$1 ~ /\/\// {
next;
}
$2 == "module" {
module = $3;
source[$3] = $1;
#print "source", $3, $1;
next;
}
{
key = module SUBSEP $2;
if ( ! ( key in hierarchy ) ) {
hierarchy[module, $2] = $2;
#print module, $2;
}
}
END {
if ( ! ( top in source ) ) {
print "ERROR: Could not find", top;
exit 1;
}
PrintFile(top);
}
function PrintFile(cell) {
for ( key in hierarchy ) {
regex = "^" cell SUBSEP;
if ( key ~ regex && hierarchy[key] != "" ) {
PrintFile(hierarchy[key]);
hierarcy[key] = "";
}
}
if ( cell in source ) {
print source[cell];
}
}' |
sed -e '1i/VERILOG_FILES/a\\' -e 's:.*: "$UPRJ_ROOT/verilog/gl/&",\\:' |
grep -v $TOP |
sed -e '/user_proj_example/d' -f - $LVS_ROOT/tech/$PDK/lvs_config.user_project_wrapper.json |
grep -v "^$" |
uniq