├── image
├── vsh.png
├── disasm.png
├── marker.png
└── macro_display.png
├── vcd_example
├── gate.vcd
└── curva_wave.vcd
├── Makefile
├── README.md
├── LISENCE
└── vsh.py
/image/vsh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/secure-v/vsh/HEAD/image/vsh.png
--------------------------------------------------------------------------------
/image/disasm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/secure-v/vsh/HEAD/image/disasm.png
--------------------------------------------------------------------------------
/image/marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/secure-v/vsh/HEAD/image/marker.png
--------------------------------------------------------------------------------
/image/macro_display.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/secure-v/vsh/HEAD/image/macro_display.png
--------------------------------------------------------------------------------
/vcd_example/gate.vcd:
--------------------------------------------------------------------------------
1 | $version Generated by VerilatedVcd $end
2 | $timescale 1ps $end
3 |
4 | $scope module TOP $end
5 | $var wire 1 # a $end
6 | $var wire 1 $ b $end
7 | $var wire 1 % y $end
8 | $scope module gate $end
9 | $var wire 1 # a $end
10 | $var wire 1 $ b $end
11 | $var wire 1 % y $end
12 | $upscope $end
13 | $upscope $end
14 | $enddefinitions $end
15 |
16 |
17 | #0
18 | 0#
19 | 0$
20 | 1%
21 | #1
22 | 1#
23 | 0%
24 | #2
25 | 0#
26 | 1$
27 | #3
28 | 1#
29 | #4
30 | 0#
31 | 0$
32 | 1%
33 | #5
34 | 1#
35 | 0%
36 | #6
37 | 0#
38 | 1$
39 | #7
40 | 1#
41 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # SHELL := /usr/bin/zsh
2 |
3 | all: install
4 |
5 | SHELLRC = bashrc
6 |
7 |
8 | install:
9 | pip install pyDigitalWaveTools
10 | pip install cmd2
11 | pip install capstone
12 | chmod +x vsh.py
13 | mkdir -p ~/eda/vsh
14 | cp vsh.py ~/eda/vsh/vsh
15 | cp -r vcd_example ~/eda/vsh/
16 | sed -i '/eda\/vsh/d' ~/.$(SHELLRC)
17 | echo 'export PATH="$$HOME/eda/vsh/:$$PATH"' >> ~/.$(SHELLRC)
18 | bash -c "source ~/.$(SHELLRC)"
19 | @bash -c "source ~/.$(SHELLRC)"
20 |
21 |
22 | install-zsh:
23 | pip install pyDigitalWaveTools
24 | pip install cmd2
25 | pip install capstone
26 | chmod +x vsh.py
27 | mkdir -p ~/eda/vsh
28 | cp vsh.py ~/eda/vsh/vsh
29 | cp -r vcd_example ~/eda/vsh/
30 | sed -i '/eda\/vsh/d' ~/.zshrc
31 | echo 'export PATH="$$HOME/eda/vsh/:$$PATH"' >> ~/.zshrc
32 | @zsh ~/.zshrc
33 |
34 |
35 | uninstall:
36 | sed -i '/eda\/vsh/d' ~/.$(SHELLRC)
37 | sed -i '/eda\/vsh/d' ~/.zshrc
38 | rm -rf ~/eda/vsh
39 |
40 | clean:
41 | rm -rf ~/eda/vsh
42 |
43 | .PHONY: instal clean
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VSH
2 | 
3 | ## 项目概述
4 | 1. VSH(SHell for Visualizing vcd file)项目为数字波形文件(目前仅支持 VCD,Value Change Dump)命令行查看器。
5 | 2. 本项目采用的开源协议为:GPL v3。
6 |
7 | ## 安装
8 | 1. 部署 VSH 的环境需求(Makefile 可一键完成):
9 | ```
10 | python3
11 | pip
12 | # 国内用户建议配置清华源
13 | pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
14 | pip install pyDigitalWaveTools
15 | pip install cmd2
16 | pip install capstone
17 | ```
18 | 2. 安装方法(项目默认放置到 ~/eda/vsh):
19 | ```shell
20 | make install # 注意:如果您的默认 shell 是 zsh,请使用 make install-zsh
21 | cd ~/eda/vsh/ # 默认安装路径
22 | # 若想要实现命令行直接启动 vsh,请将 ~/eda/vsh/ 加入到环境变量 PATH 当中(默认);
23 | ```
24 |
25 | ## 命令与操作
26 | 1. load:加载 VCD 文件。
27 | 2. pwm:显示当前工作模块所在的层次,显示方式与 Linux 文件系统路径名一致。
28 | 3. cm:改变当前工作模块。
29 | 4. add:添加信号到观察列表,-f 参数可指定信号显示时的数据显示方式(a/b/o/d/h/f/s,即 ascii/bin/oct/dec/hex/float/signed),若不指定,默认的数据显示方式为十六进制;-bg 参数指定背景色;-fg 参数指定前景色;-m 指定显示样式(0:常规;1: 加粗;2:淡色;3:斜体;4:下划线;5:闪烁等,注:与终端文本样式设置一致)。
30 | 5. del:删除观察列表中对应信号名的信号。
31 | 6. show:显示观察列表中的信号波形,-n 参数可设置时间点的增量(先完成增量运算,后显示信号波形);其中第一列为信号名称;其中第一行为波形的时间参数。
32 | 7. list: 显示当前模块下的信号和子模块,-s 参数用于显示加入到观察列表的信号信息(信号名 位宽 信号所属的层次);-M 参数显示所有设置的宏定义组。
33 | 8. t:无参数时显示当前显示波形的时间起点与最大时间点,有整数参数 n 输入时,将 t 修改为 t + n;通过指定 -a 参数,将时间起点设置为设置值。
34 | 9. search:对指定的表达式进行分析,打印出该表达式成立的时间区间。
35 | 10. conv:对参数(二进制/八进制/十进制/十六进制的自然数)进行进制转换。
36 | 11. sfl: 当参数为 0 / 其他 时,关闭 / 启用 显示单比特信号电平状态功能。
37 | ```shell
38 | python vsh.py "sfl" "load vcd_example/gate.vcd" "cm TOP" "add *" "show" quit
39 | ```
40 | 12. reorder:对观察列表中的信号进行重排序,将参数(index)指定的信号放在前面,其他未指明的信号不变更次序。
41 | ```shell
42 | /TOP > list -s
43 | 0 a 1 /TOP
44 | 1 b 1 /TOP
45 | 2 y 1 /TOP
46 | /TOP > reorder 1 1 0 0 2
47 | /TOP > list -s
48 | 0 b 1 /TOP
49 | 1 b 1 /TOP
50 | 2 a 1 /TOP
51 | 3 a 1 /TOP
52 | 4 y 1 /TOP
53 | ```
54 | 13. disasm:反汇编功能(默认为 RV64G 汇编,目前仅支持 RV32 / RV64):
55 | ```shell
56 | /TOP > disasm 0x17010001
57 | auipc sp, 0x1000
58 | /TOP > disasm -arv32 0x17010032
59 | auipc sp, 0x32000
60 | ```
61 | 14. mg:设置一组宏定义(当没有任何参数时,显示所有已经设置的宏定义组):
62 | ```shell
63 | # 设置一组名称为 bus_state 的宏定义:STATE_IDLE == 0、STATE_START == 1、STATE_FINISH == 2、STATE_BUSY == 3
64 | mg -mSTATE_IDLE&STATE_START&STATE_FINISH&STATE_BUSY -v0&1&2&3 -n bus_state
65 | ```
66 | 15. bm:将一个观察列表中的信号绑定到一组宏定义(从而可以在显示时采用宏定义进行显示):
67 | ```shell
68 | # 将名称为 state 的信号绑定到名称为 bus_state 的宏定义组
69 | bm -nbus_state -sstate
70 | ```
71 | 16. bd:将信号绑定到指定架构的反汇编器(若不指定则绑定到 RV64 反汇编器):
72 | ```shell
73 | 将名称为 instr 的信号绑定到 rv32 反汇编器
74 | bd -arv32 -sinstr
75 | ```
76 | 17. color: 设置信号显示时的前景色(-fg)、背景色(-bg)、显示样式(-m),其中前景色 / 背景色,均使用六位的八进制数指定,如 0xff0000 为红色;如果想要设置一种随机的前景色 / 背景色,可通过 -fgr / -bgr 指定。
77 | 18. marker:设置标号,-l 参数显示所有标号;-t 参数指定标号对应的时间点;-d 参数删除指定标号;-i 参数用于根据下标指定标号;-fg / -bg / -m 用于指定标号的颜色与样式;-fgr / -bgr 用于为标号设置随机的前景色 / 背景色。
78 | 19. precision:设置浮点数显示时的小数位数。
79 | 20. randc:生成一组随机的色彩,显示其颜色值,-n 参数可设置显示的随机颜色数量(超过 100 时,仅显示 100 项)。
80 | 22. save:保持当前使用的所有命令,参数用于指定文件名。
81 | 23. n:显示下一时间点的波形。
82 | 24. p:显示上一时间点的波形。
83 |
84 | ## 使用示例
85 | 1. 打开 vcd_example 目录下的 gate.vcd 文件并显示波形(在 vsh 项目目录下运行 vsh):
86 | ``` shell
87 | vsh> load vcd_example/gate.vcd
88 | / > cm TOP
89 | /TOP > list
90 | a 1
91 | b 1
92 | y 1
93 | gate
94 | /TOP > add *
95 | /TOP > show
96 | ----------------------------------------------------------------------------------
97 | T=0 \0 /\1 /\2 /\3 /\4 /\5 /\6 /\7 /\8 /\9 /\10/\11/\12/\13/\14/\15/\16/\17/\18/
98 | ----------------------------------------------------------------------------------
99 | a[H] \0 /\1 /\0 /\1 /\0 /\1 /\0 /\ 1 /
100 | b[H] \ 0 /\ 1 /\ 0 /\ 1 /
101 | y[H] \1 /\ 0 /\1 /\ 0 /
102 | ==================================================================================
103 | /TOP > e
104 | ```
105 | 2. 使用 search 功能:
106 | ```shell
107 | vsh> load vcd_example/gate.vcd
108 | / > cm TOP
109 | /TOP > add *
110 | /TOP > search "y==1"
111 | [0, 1) [4, 5)
112 | # 该结果说明,在 t = 0 和 t = 4 两个时间点上,y == 1 的条件成立;
113 | ```
114 | 3. 通过反汇编器显示指令的具体内容:
115 | ```shell
116 | python vsh.py "sfl" "load vcd_example/curva_wave.vcd" "cm TOP" "t" "add *" "bd -arv64 -sinstr" "show" "exit"
117 | ```
118 | 
119 |
120 | 4. 通过绑定宏定义组,显示信号的宏而非值(clk 信号显示为 HIGH / LOW 以表示 1 / 0):
121 | ```shell
122 | python vsh.py "sfl" "load vcd_example/curva_wave.vcd" "cm TOP" "add *" "mg -mHIGH&LOW -v1&0 -nCLK" "bm -nCLK -sclk" "show" "exit"
123 | ```
124 | 
125 |
126 | 5. **通常定位 RTL 中的 BUG 需要在 vsh 中执行一系列的操作;而在下一次打开 vsh 时,我们希望能够重新定位该处 BUG,这时对命令历史进行导出以形成启动文件将有助于提高调试效率:**
127 | ```shell
128 | # 执行若干调试操作
129 | vsh> ...
130 | # 保存操作为启动文件
131 | vsh> save
132 | ```
133 | **启动文件被保存后,可以通过命令行方式执行:**
134 | ```shell
135 | vsh "run_script .vsh_start_up_2025_01_01_19_00_00" "exit"
136 | # 注意:如果 VCD 文件较大,文件解析过程将消耗较多时间,此时可以将脚本的执行置于后台:
137 | vsh "run_script .vsh_start_up_2025_01_01_19_00_00" "exit" &
138 | ```
139 | 6. 设置显示时的信号颜色:
140 | ```python
141 | python vsh.py "load vcd_example/curva_wave.vcd" "cm TOP" "add clk -fg 0x194235" "add data_addr -fg 0x594235" "add instr -fg 0x594285" "add wdata -fg 0xe9f235" "show" "list -s"
142 | ```
143 | 7. 修改显示时的信号颜色:
144 | ```shell
145 | # python vsh.py "load vcd_example/curva_wave.vcd" "cm TOP" "add clk -fg 0x194235" "add data_addr -fg 0x594235" "add instr -fg 0x594285" "add wdata -fg 0xe9f235" "show"
146 | vsh> color -fg 0x323672 -i 3
147 | vsh> show
148 | vsh> list -s
149 | ```
150 | 8. 设置随机的背景 / 前景颜色:
151 | ```shell
152 | vsh> color -fgr -i 3
153 | vsh> color -bgr -i 0
154 | vsh> show
155 | ```
156 | 9. 添加标号并显示(通过 -i 参数指定要删除、修改的某个 marker 的下标):
157 | ```shell
158 | # 在时间点 3 添加一个名称为 m0 的标号,设置随机的前景色
159 | vsh> marker -t 3 m0 -fgr
160 |
161 | # 修改标号 m0,使得其时间点变更为 4,并设置随机的前景色(注意:相同时间点设置不同名称 / 相同名称设置不同时间的标号后者会覆盖前者)
162 | vsh> marker -t 4 m0 -fgr
163 |
164 | # 显示所有标号
165 | vsh> marker -l
166 |
167 | # 删除标号 m0
168 | vsh> marker -d m0
169 | vsh> marker -d -i 0
170 |
171 | # 演示
172 | python vsh.py "load vcd_example/curva_wave.vcd" "cm TOP" "add clk -fg 0x194235" "add data_addr -fg 0x594235" "add instr -fg 0x594285" "add wdata -fg 0xe9f235" "show" "list -s" "marker -t 0 a -fgr" "marker -t 1 b -fgr" "marker -t 2 c -fgr" "marker -t 3 d -fgr" "marker -t 5 e -fgr" "marker -t 6 f -fgr" "show"
173 | ```
174 | 
175 |
176 | ## 注意事项
177 | 1. 在加载 vcd 文件成功以后,prompt 会变为 /,此时代表目前在根模块,即 TOP 模块的父模块,通过 cm TOP 命令即可进入 TOP 模块。
178 | 2. 显示的波形文件中,\ / 为分隔符,无任何含义;信号名后的 [H] 代表数据当前的显示格式为十六进制(在添加信号进入观察列表时,可以通过 add -f b/o/d/h/s/u signal_name 设置)。
179 |
180 | ## 其他说明
181 | 1. 在命令行启动 vsh 时通过指定字符串参数,可以使得该应用在启动以后自动执行参数指定的命令:
182 | ```shell
183 | ./vsh.py "t" "intro" "t 1" "intro" quit
184 |
185 | # 在该项目的 vsh 目录下执行:
186 | python vsh.py "load vcd_example/gate.vcd" "cm TOP" "add *" "show" quit
187 | python vsh.py "sfl" "load vcd_example/gate.vcd" "cm TOP" "add *" "show" quit
188 | ```
189 | 2. 默认情况下,VSH 支持命令历史,其历史将保存在同一目录下的 .vsh_history 文件中。
190 | 3. 通过 verilator 导出的 vcd 文件,TOP 模块对仿真的顶层模块进行了封装,相当于 TOP 模块当中包含了整个顶层模块,因此顶层模块的接口和模块本身都可以通过在 TOP 模块调用 list 命令查看。
191 | 4. 若不希望显示启动后的介绍页面,可通过 VSH_INTRO 宏进行设置:
192 | ```shell
193 | export VSH_INTRO=off && ./vsh.py
194 | ```
195 |
196 | ## 贡献列表
197 | 1. 参与本项目的成员如下:
198 | ```
199 | 扶摇 fuyao-cu@outlook.com
200 | ```
201 |
202 | ## TODO:
203 | 1. show 命令下,部分信号的名称可能太长,支持观察列表中信号的 alias 会更好。
204 | 2. load 命令尚不支持相对路径(比如家目录:~),而只能使用绝对路径。
205 | 3. 目前尚未约束 vcd 文件中定义的最大时间,导致信号显示的范围有可能比 vcd 文件本身所定义的时间范围更大(使用了最后一个时刻的信号值填充)。
206 | 4. 考虑改进 list 命令显示的格式:模块下不同类型的子节点(信号/子模块)显示不同的颜色;命令输出的内容一项占据了一行,可考虑将其改进为类似于 linux 的 ls 命令的显示格式。
207 | 5. 命令的 help 信息有待完善。
208 | 6. 添加英文版 readme.md。
209 | 7. 显示信号支持 x / z 态,而搜索功能暂不支持 x / z 态。
210 |
211 | ## 开发者说明
212 | 1. search 方法的实现机制:(注意,超过 vcd 文件最大时间的信号值,vsh 认为它保持了原值并一直持续到 +inf)
213 | - 它首先分解表达式形式语法树,对于表达式中的常量部分直接解析为常量节点,而非常量(信号值)则转换为右值并附加一个 ? 运算符以表明其为非常量(注意:内置的一个非常量为时间 t 值,它的名称为 @t 或 @T);
214 | - 在解析表达式的过程中每个非常量(即信号名)会被放入到全局变量 search_var_list 当中,此后检查这些非常量是否已经被添加到 spy list 中,若发现未添加则报错并退出;
215 | - 此后再对所有加入 search_var_list 的信号值发生变化的时间点进行收集构成 time_point_for_search,在这些时间点上对该表达式进行 eval,从而判断表达式是否成立;
216 | - 对所有表达式成立的时间点进行组合,并打印出表达式成立的区间(T 的一系列左闭右开的区间),如:[1, 7) [11, 9) [100, +inf)。
217 | 2. search 方法目前存在的问题:关于 @T 的表达式所形成的区间节点无法被纳入到 time_point_for_search 当中,从而出现问题,如 search "@T>3",无法正确地分析出结果(结果应该为[3, +inf)),或许放弃在表达式中支持 @T,转而通过增加一个 -t 参数项以支持时间值的筛选更合适。
218 |
219 | ## BUG
220 | 1. 待测试 ...
221 |
222 | ## 更新说明
223 | 1. 为 list 以及 mg 命令设置显示宏定义组的功能;
224 |
225 |
--------------------------------------------------------------------------------
/LISENCE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
676 |
--------------------------------------------------------------------------------
/vcd_example/curva_wave.vcd:
--------------------------------------------------------------------------------
1 | $version Generated by VerilatedVcd $end
2 | $timescale 1ps $end
3 |
4 | $scope module TOP $end
5 | $var wire 1 J! clk $end
6 | $var wire 64 S! data_addr [63:0] $end
7 | $var wire 32 L! instr [31:0] $end
8 | $var wire 64 Q! instr_addr [63:0] $end
9 | $var wire 1 O! instr_valid $end
10 | $var wire 64 M! rdata [63:0] $end
11 | $var wire 1 P! rdata_valid $end
12 | $var wire 1 K! rstn $end
13 | $var wire 64 U! wdata [63:0] $end
14 | $var wire 1 X! wdata_en $end
15 | $var wire 4 W! wlen [3:0] $end
16 | $scope module curva $end
17 | $var wire 64 A alu_res [63:0] $end
18 | $var wire 1 J! clk $end
19 | $var wire 6 % ctrl_sig [5:0] $end
20 | $var wire 64 5 data_addr [63:0] $end
21 | $var wire 64 ]! ext_rdata [63:0] $end
22 | $var wire 32 L! instr [31:0] $end
23 | $var wire 64 f instr_addr [63:0] $end
24 | $var wire 7 ' instr_type [6:0] $end
25 | $var wire 1 O! instr_valid $end
26 | $var wire 1 ( is_word_op $end
27 | $var wire 64 9 next_pc [63:0] $end
28 | $var wire 64 = op0 [63:0] $end
29 | $var wire 64 ? op1 [63:0] $end
30 | $var wire 19 & op_type [18:0] $end
31 | $var wire 64 M! rdata [63:0] $end
32 | $var wire 1 P! rdata_valid $end
33 | $var wire 64 ; reg_data0 [63:0] $end
34 | $var wire 64 7 reg_data1 [63:0] $end
35 | $var wire 1 K! rstn $end
36 | $var wire 64 # sext_imm [63:0] $end
37 | $var wire 64 7 wdata [63:0] $end
38 | $var wire 1 Z! wdata_en $end
39 | $var wire 4 Y! wlen [3:0] $end
40 | $var wire 64 [! wreg_data [63:0] $end
41 | $scope module alu_inst0 $end
42 | $var wire 64 E add_res [63:0] $end
43 | $var wire 64 [ add_temp [63:0] $end
44 | $var wire 64 A alu_res [63:0] $end
45 | $var wire 64 S eq_res [63:0] $end
46 | $var wire 64 W ge_res [63:0] $end
47 | $var wire 64 Y geu_res [63:0] $end
48 | $var wire 1 ( is_word_op $end
49 | $var wire 64 C mask_for_sra [63:0] $end
50 | $var wire 64 U ne_res [63:0] $end
51 | $var wire 64 = op0 [63:0] $end
52 | $var wire 64 ? op1 [63:0] $end
53 | $var wire 19 & op_type [18:0] $end
54 | $var wire 6 e shamt [5:0] $end
55 | $var wire 64 K signed_less_cmp_res [63:0] $end
56 | $var wire 64 M sll_res [63:0] $end
57 | $var wire 64 _ sll_temp [63:0] $end
58 | $var wire 64 O sra_res [63:0] $end
59 | $var wire 64 a sra_temp [63:0] $end
60 | $var wire 64 Q srl_res [63:0] $end
61 | $var wire 64 c srl_temp [63:0] $end
62 | $var wire 64 G sub_res [63:0] $end
63 | $var wire 64 ] sub_temp [63:0] $end
64 | $var wire 64 I unsigned_less_cmp_res [63:0] $end
65 | $upscope $end
66 | $scope module ctrl_inst0 $end
67 | $var wire 6 % ctrl_sig [5:0] $end
68 | $var wire 3 `! func3 [2:0] $end
69 | $var wire 6 b! func6 [5:0] $end
70 | $var wire 7 a! func7 [6:0] $end
71 | $var wire 32 L! instr [31:0] $end
72 | $var wire 7 ' instr_type [6:0] $end
73 | $var wire 1 ( is_word_op $end
74 | $var wire 19 & op_type [18:0] $end
75 | $var wire 7 _! opcode [6:0] $end
76 | $var wire 1 Z! wdata_en $end
77 | $var wire 4 Y! wlen [3:0] $end
78 | $upscope $end
79 | $scope module gen_data_addr_inst0 $end
80 | $var wire 64 A alu_res [63:0] $end
81 | $var wire 64 5 data_addr [63:0] $end
82 | $var wire 1 ) is_load_or_store_instr $end
83 | $upscope $end
84 | $scope module gen_next_pc_inst0 $end
85 | $var wire 64 A alu_res [63:0] $end
86 | $var wire 7 ' instr_type [6:0] $end
87 | $var wire 1 * is_jalr $end
88 | $var wire 64 9 next_pc [63:0] $end
89 | $var wire 64 f pc [63:0] $end
90 | $var wire 64 ; reg_data0 [63:0] $end
91 | $var wire 64 # sext_imm [63:0] $end
92 | $upscope $end
93 | $scope module gen_wdata_inst0 $end
94 | $var wire 64 7 reg_data1 [63:0] $end
95 | $var wire 64 7 wdata [63:0] $end
96 | $upscope $end
97 | $scope module instr_sign_ext_inst0 $end
98 | $var wire 64 h! btype_sext_imm [63:0] $end
99 | $var wire 64 + btype_zext_imm [63:0] $end
100 | $var wire 32 L! instr [31:0] $end
101 | $var wire 7 ' instr_type [6:0] $end
102 | $var wire 64 j! itype_sext_imm [63:0] $end
103 | $var wire 64 d! itype_zext_imm [63:0] $end
104 | $var wire 64 l! jtype_sext_imm [63:0] $end
105 | $var wire 64 - jtype_zext_imm [63:0] $end
106 | $var wire 64 # sext_imm [63:0] $end
107 | $var wire 1 c! sign_flag $end
108 | $var wire 64 n! stype_sext_imm [63:0] $end
109 | $var wire 64 / stype_zext_imm [63:0] $end
110 | $var wire 64 p! utype_sext_imm [63:0] $end
111 | $var wire 64 f! utype_zext_imm [63:0] $end
112 | $upscope $end
113 | $scope module program_counter_inst0 $end
114 | $var wire 1 J! clk $end
115 | $var wire 64 9 next_pc [63:0] $end
116 | $var wire 64 f pc [63:0] $end
117 | $var wire 1 K! rstn $end
118 | $upscope $end
119 | $scope module rdata_ext_inst0 $end
120 | $var wire 64 x! byte_sext_data [63:0] $end
121 | $var wire 64 r! byte_zext_data [63:0] $end
122 | $var wire 64 ]! ext_rdata [63:0] $end
123 | $var wire 3 `! func3 [2:0] $end
124 | $var wire 64 z! half_sext_data [63:0] $end
125 | $var wire 64 t! half_zext_data [63:0] $end
126 | $var wire 64 M! rdata [63:0] $end
127 | $var wire 64 |! word_sext_data [63:0] $end
128 | $var wire 64 v! word_zext_data [63:0] $end
129 | $upscope $end
130 | $scope module reg_file_inst0 $end
131 | $var wire 1 J! clk $end
132 | $var wire 64 ; reg_data0 [63:0] $end
133 | $var wire 64 7 reg_data1 [63:0] $end
134 | $var wire 5 ~! reg_id0 [4:0] $end
135 | $var wire 5 !" reg_id1 [4:0] $end
136 | $var wire 64 h regs[0] [63:0] $end
137 | $var wire 64 | regs[10] [63:0] $end
138 | $var wire 64 ~ regs[11] [63:0] $end
139 | $var wire 64 "! regs[12] [63:0] $end
140 | $var wire 64 $! regs[13] [63:0] $end
141 | $var wire 64 &! regs[14] [63:0] $end
142 | $var wire 64 (! regs[15] [63:0] $end
143 | $var wire 64 *! regs[16] [63:0] $end
144 | $var wire 64 ,! regs[17] [63:0] $end
145 | $var wire 64 .! regs[18] [63:0] $end
146 | $var wire 64 0! regs[19] [63:0] $end
147 | $var wire 64 j regs[1] [63:0] $end
148 | $var wire 64 2! regs[20] [63:0] $end
149 | $var wire 64 4! regs[21] [63:0] $end
150 | $var wire 64 6! regs[22] [63:0] $end
151 | $var wire 64 8! regs[23] [63:0] $end
152 | $var wire 64 :! regs[24] [63:0] $end
153 | $var wire 64 ! regs[26] [63:0] $end
155 | $var wire 64 @! regs[27] [63:0] $end
156 | $var wire 64 B! regs[28] [63:0] $end
157 | $var wire 64 D! regs[29] [63:0] $end
158 | $var wire 64 l regs[2] [63:0] $end
159 | $var wire 64 F! regs[30] [63:0] $end
160 | $var wire 64 H! regs[31] [63:0] $end
161 | $var wire 64 n regs[3] [63:0] $end
162 | $var wire 64 p regs[4] [63:0] $end
163 | $var wire 64 r regs[5] [63:0] $end
164 | $var wire 64 t regs[6] [63:0] $end
165 | $var wire 64 v regs[7] [63:0] $end
166 | $var wire 64 x regs[8] [63:0] $end
167 | $var wire 64 z regs[9] [63:0] $end
168 | $var wire 1 K! rstn $end
169 | $var wire 1 4 wen0 $end
170 | $var wire 64 [! wreg_data [63:0] $end
171 | $var wire 5 "" wreg_id [4:0] $end
172 | $var wire 64 #" x0 [63:0] $end
173 | $var wire 64 %" x1 [63:0] $end
174 | $var wire 64 7" x10 [63:0] $end
175 | $var wire 64 9" x11 [63:0] $end
176 | $var wire 64 ;" x12 [63:0] $end
177 | $var wire 64 =" x13 [63:0] $end
178 | $var wire 64 ?" x14 [63:0] $end
179 | $var wire 64 A" x15 [63:0] $end
180 | $var wire 64 C" x16 [63:0] $end
181 | $var wire 64 E" x17 [63:0] $end
182 | $var wire 64 G" x18 [63:0] $end
183 | $var wire 64 I" x19 [63:0] $end
184 | $var wire 64 '" x2 [63:0] $end
185 | $var wire 64 K" x20 [63:0] $end
186 | $var wire 64 M" x21 [63:0] $end
187 | $var wire 64 O" x22 [63:0] $end
188 | $var wire 64 Q" x23 [63:0] $end
189 | $var wire 64 S" x24 [63:0] $end
190 | $var wire 64 U" x25 [63:0] $end
191 | $var wire 64 W" x26 [63:0] $end
192 | $var wire 64 Y" x27 [63:0] $end
193 | $var wire 64 [" x28 [63:0] $end
194 | $var wire 64 ]" x29 [63:0] $end
195 | $var wire 64 )" x3 [63:0] $end
196 | $var wire 64 _" x30 [63:0] $end
197 | $var wire 64 a" x31 [63:0] $end
198 | $var wire 64 +" x4 [63:0] $end
199 | $var wire 64 -" x5 [63:0] $end
200 | $var wire 64 /" x6 [63:0] $end
201 | $var wire 64 1" x7 [63:0] $end
202 | $var wire 64 3" x8 [63:0] $end
203 | $var wire 64 5" x9 [63:0] $end
204 | $upscope $end
205 | $scope module sel_op_to_alu_inst0 $end
206 | $var wire 7 ' instr_type [6:0] $end
207 | $var wire 1 * is_jalr $end
208 | $var wire 64 = op0 [63:0] $end
209 | $var wire 1 1 op0_sel $end
210 | $var wire 64 ? op1 [63:0] $end
211 | $var wire 1 2 op1_sel $end
212 | $var wire 64 f pc [63:0] $end
213 | $var wire 64 ; reg_data0 [63:0] $end
214 | $var wire 64 7 reg_data1 [63:0] $end
215 | $var wire 64 # sext_imm [63:0] $end
216 | $upscope $end
217 | $scope module sel_wdata_to_reg_inst0 $end
218 | $var wire 64 A alu_res [63:0] $end
219 | $var wire 64 ]! mem_data [63:0] $end
220 | $var wire 64 [! wreg_data [63:0] $end
221 | $var wire 1 3 wreg_src $end
222 | $upscope $end
223 | $upscope $end
224 | $upscope $end
225 | $enddefinitions $end
226 |
227 |
228 | #0
229 | b0000000000000000000000000000000000000000000000000000000000000000 #
230 | b001100 %
231 | b1000000000000000000 &
232 | b1000000 '
233 | 0(
234 | 0)
235 | 0*
236 | b0000000000000000000000000000000000000000000000000000000000000000 +
237 | b0000000000000000000000000000000000000000000000000000000000000000 -
238 | b0000000000000000000000000000000000000000000000000000000000000000 /
239 | 11
240 | 12
241 | 03
242 | 04
243 | b0000000000000000000000000000000010000000000000000000000000000000 5
244 | b0000000000000000000000000000000000000000000000000000000000000000 7
245 | b0000000000000000000000000000000000000000000000000000000000000100 9
246 | b0000000000000000000000000000000000000000000000000000000000000000 ;
247 | b0000000000000000000000000000000000000000000000000000000000000000 =
248 | b0000000000000000000000000000000000000000000000000000000000000000 ?
249 | b0000000000000000000000000000000000000000000000000000000000000000 A
250 | b0000000000000000000000000000000000000000000000000000000000000000 C
251 | b0000000000000000000000000000000000000000000000000000000000000000 E
252 | b0000000000000000000000000000000000000000000000000000000000000000 G
253 | b0000000000000000000000000000000000000000000000000000000000000000 I
254 | b0000000000000000000000000000000000000000000000000000000000000000 K
255 | b0000000000000000000000000000000000000000000000000000000000000000 M
256 | b0000000000000000000000000000000000000000000000000000000000000000 O
257 | b0000000000000000000000000000000000000000000000000000000000000000 Q
258 | b0000000000000000000000000000000000000000000000000000000000000001 S
259 | b0000000000000000000000000000000000000000000000000000000000000000 U
260 | b0000000000000000000000000000000000000000000000000000000000000001 W
261 | b0000000000000000000000000000000000000000000000000000000000000001 Y
262 | b0000000000000000000000000000000000000000000000000000000000000000 [
263 | b0000000000000000000000000000000000000000000000000000000000000000 ]
264 | b0000000000000000000000000000000000000000000000000000000000000000 _
265 | b0000000000000000000000000000000000000000000000000000000000000000 a
266 | b0000000000000000000000000000000000000000000000000000000000000000 c
267 | b000000 e
268 | b0000000000000000000000000000000000000000000000000000000000000000 f
269 | b0000000000000000000000000000000000000000000000000000000000000000 h
270 | b0000000000000000000000000000000000000000000000000000000000000000 j
271 | b0000000000000000000000000000000000000000000000000000000000000000 l
272 | b0000000000000000000000000000000000000000000000000000000000000000 n
273 | b0000000000000000000000000000000000000000000000000000000000000000 p
274 | b0000000000000000000000000000000000000000000000000000000000000000 r
275 | b0000000000000000000000000000000000000000000000000000000000000000 t
276 | b0000000000000000000000000000000000000000000000000000000000000000 v
277 | b0000000000000000000000000000000000000000000000000000000000000000 x
278 | b0000000000000000000000000000000000000000000000000000000000000000 z
279 | b0000000000000000000000000000000000000000000000000000000000000000 |
280 | b0000000000000000000000000000000000000000000000000000000000000000 ~
281 | b0000000000000000000000000000000000000000000000000000000000000000 "!
282 | b0000000000000000000000000000000000000000000000000000000000000000 $!
283 | b0000000000000000000000000000000000000000000000000000000000000000 &!
284 | b0000000000000000000000000000000000000000000000000000000000000000 (!
285 | b0000000000000000000000000000000000000000000000000000000000000000 *!
286 | b0000000000000000000000000000000000000000000000000000000000000000 ,!
287 | b0000000000000000000000000000000000000000000000000000000000000000 .!
288 | b0000000000000000000000000000000000000000000000000000000000000000 0!
289 | b0000000000000000000000000000000000000000000000000000000000000000 2!
290 | b0000000000000000000000000000000000000000000000000000000000000000 4!
291 | b0000000000000000000000000000000000000000000000000000000000000000 6!
292 | b0000000000000000000000000000000000000000000000000000000000000000 8!
293 | b0000000000000000000000000000000000000000000000000000000000000000 :!
294 | b0000000000000000000000000000000000000000000000000000000000000000 !
296 | b0000000000000000000000000000000000000000000000000000000000000000 @!
297 | b0000000000000000000000000000000000000000000000000000000000000000 B!
298 | b0000000000000000000000000000000000000000000000000000000000000000 D!
299 | b0000000000000000000000000000000000000000000000000000000000000000 F!
300 | b0000000000000000000000000000000000000000000000000000000000000000 H!
301 | 0J!
302 | 0K!
303 | b00000000000000000000000000000000 L!
304 | b0000000010000001000000010001001100000000010000001000000010010011 M!
305 | 1O!
306 | 1P!
307 | b0000000000000000000000000000000000000000000000000000000000000000 Q!
308 | b0000000000000000000000000000000010000000000000000000000000000000 S!
309 | b0000000000000000000000000000000000000000000000000000000000000000 U!
310 | b0001 W!
311 | 0X!
312 | b0001 Y!
313 | 0Z!
314 | b1111111111111111111111111111111111111111111111111111111110010011 [!
315 | b1111111111111111111111111111111111111111111111111111111110010011 ]!
316 | b0000000 _!
317 | b000 `!
318 | b0000000 a!
319 | b000000 b!
320 | 0c!
321 | b0000000000000000000000000000000000000000000000000000000000000000 d!
322 | b0000000000000000000000000000000000000000000000000000000000000000 f!
323 | b0000000000000000000000000000000000000000000000000000000000000000 h!
324 | b0000000000000000000000000000000000000000000000000000000000000000 j!
325 | b0000000000000000000000000000000000000000000000000000000000000000 l!
326 | b0000000000000000000000000000000000000000000000000000000000000000 n!
327 | b0000000000000000000000000000000000000000000000000000000000000000 p!
328 | b0000000000000000000000000000000000000000000000000000000010010011 r!
329 | b0000000000000000000000000000000000000000000000001000000010010011 t!
330 | b0000000000000000000000000000000000000000010000001000000010010011 v!
331 | b1111111111111111111111111111111111111111111111111111111110010011 x!
332 | b1111111111111111111111111111111111111111111111111000000010010011 z!
333 | b0000000000000000000000000000000000000000010000001000000010010011 |!
334 | b00000 ~!
335 | b00000 !"
336 | b00000 ""
337 | b0000000000000000000000000000000000000000000000000000000000000000 #"
338 | b0000000000000000000000000000000000000000000000000000000000000000 %"
339 | b0000000000000000000000000000000000000000000000000000000000000000 '"
340 | b0000000000000000000000000000000000000000000000000000000000000000 )"
341 | b0000000000000000000000000000000000000000000000000000000000000000 +"
342 | b0000000000000000000000000000000000000000000000000000000000000000 -"
343 | b0000000000000000000000000000000000000000000000000000000000000000 /"
344 | b0000000000000000000000000000000000000000000000000000000000000000 1"
345 | b0000000000000000000000000000000000000000000000000000000000000000 3"
346 | b0000000000000000000000000000000000000000000000000000000000000000 5"
347 | b0000000000000000000000000000000000000000000000000000000000000000 7"
348 | b0000000000000000000000000000000000000000000000000000000000000000 9"
349 | b0000000000000000000000000000000000000000000000000000000000000000 ;"
350 | b0000000000000000000000000000000000000000000000000000000000000000 ="
351 | b0000000000000000000000000000000000000000000000000000000000000000 ?"
352 | b0000000000000000000000000000000000000000000000000000000000000000 A"
353 | b0000000000000000000000000000000000000000000000000000000000000000 C"
354 | b0000000000000000000000000000000000000000000000000000000000000000 E"
355 | b0000000000000000000000000000000000000000000000000000000000000000 G"
356 | b0000000000000000000000000000000000000000000000000000000000000000 I"
357 | b0000000000000000000000000000000000000000000000000000000000000000 K"
358 | b0000000000000000000000000000000000000000000000000000000000000000 M"
359 | b0000000000000000000000000000000000000000000000000000000000000000 O"
360 | b0000000000000000000000000000000000000000000000000000000000000000 Q"
361 | b0000000000000000000000000000000000000000000000000000000000000000 S"
362 | b0000000000000000000000000000000000000000000000000000000000000000 U"
363 | b0000000000000000000000000000000000000000000000000000000000000000 W"
364 | b0000000000000000000000000000000000000000000000000000000000000000 Y"
365 | b0000000000000000000000000000000000000000000000000000000000000000 ["
366 | b0000000000000000000000000000000000000000000000000000000000000000 ]"
367 | b0000000000000000000000000000000000000000000000000000000000000000 _"
368 | b0000000000000000000000000000000000000000000000000000000000000000 a"
369 | #1
370 | b0000000000000000000000000000000010000000000000000000000000000100 9
371 | b0000000000000000000000000000000010000000000000000000000000000000 f
372 | 1J!
373 | b00000000010000001000000010010011 L!
374 | b0000000000000000000000000000000010000000000000000000000000000000 Q!
375 | b0010011 _!
376 | b0000000000000000000000000000000000000000000000000000000000000100 d!
377 | b0000000000000000000000000000000000000000010000001000000000000000 f!
378 | b0000000000000000000000000000000000000000000000000000000000000100 j!
379 | b0000000000000000000000000000000000000000010000001000000000000000 p!
380 | b00001 ~!
381 | b00100 !"
382 | b00001 ""
383 | #2
384 | b0000000000000000000000000000000000000000000000000000000000000100 #
385 | b000111 %
386 | b0000000000000000001 &
387 | b0000010 '
388 | b0000000000000000000000000000000000000000000000000000100000000000 +
389 | b0000000000000000000000000000000000000000000000001000000000000100 -
390 | b0000000000000000000000000000000000000000000000000000000000000001 /
391 | 02
392 | 13
393 | 14
394 | b0000000000000000000000000000000000000000000000000000000000000100 ?
395 | b0000000000000000000000000000000000000000000000000000000000000100 A
396 | b0000000000000000000000000000000000000000000000000000000000000100 E
397 | b1111111111111111111111111111111111111111111111111111111111111100 G
398 | b0000000000000000000000000000000000000000000000000000000000000001 I
399 | b0000000000000000000000000000000000000000000000000000000000000001 K
400 | b0000000000000000000000000000000000000000000000000000000000000000 S
401 | b0000000000000000000000000000000000000000000000000000000000000001 U
402 | b0000000000000000000000000000000000000000000000000000000000000000 W
403 | b0000000000000000000000000000000000000000000000000000000000000000 Y
404 | b0000000000000000000000000000000000000000000000000000000000000100 [
405 | b1111111111111111111111111111111111111111111111111111111111111100 ]
406 | b000100 e
407 | 0J!
408 | b0000000000000000000000000000000000000000000000000000000000000100 [!
409 | b0000000000000000000000000000000000000000000000000000100000000000 h!
410 | b0000000000000000000000000000000000000000000000001000000000000100 l!
411 | b0000000000000000000000000000000000000000000000000000000000000001 n!
412 | #3
413 | 1J!
414 | #4
415 | 0J!
416 | #5
417 | 1J!
418 | #6
419 | 0J!
420 | #7
421 | 1J!
422 | #8
423 | 0J!
424 | #9
425 | 1J!
426 | #10
427 | 0J!
428 | #11
429 | 1J!
430 | #12
431 | 0J!
432 | 1K!
433 | #13
434 | b0000000000000000000000000000000010000000000000000000000000001000 9
435 | b0000000000000000000000000000000000000000000000000000000000000100 ;
436 | b0000000000000000000000000000000000000000000000000000000000000100 =
437 | b0000000000000000000000000000000000000000000000000000000000001000 A
438 | b0000000000000000000000000000000000000000000000000000000000001000 E
439 | b0000000000000000000000000000000000000000000000000000000000000000 G
440 | b0000000000000000000000000000000000000000000000000000000000000000 I
441 | b0000000000000000000000000000000000000000000000000000000000000000 K
442 | b0000000000000000000000000000000000000000000000000000000001000000 M
443 | b0000000000000000000000000000000000000000000000000000000000000001 S
444 | b0000000000000000000000000000000000000000000000000000000000000000 U
445 | b0000000000000000000000000000000000000000000000000000000000000001 W
446 | b0000000000000000000000000000000000000000000000000000000000000001 Y
447 | b0000000000000000000000000000000000000000000000000000000000001000 [
448 | b0000000000000000000000000000000000000000000000000000000000000000 ]
449 | b0000000000000000000000000000000000000000000000000000000001000000 _
450 | b0000000000000000000000000000000010000000000000000000000000000100 f
451 | b0000000000000000000000000000000000000000000000000000000000000100 j
452 | 1J!
453 | b00000000100000010000000100010011 L!
454 | b0000000000000000000000000000000010000000000000000000000000000100 Q!
455 | b0000000000000000000000000000000000000000000000000000000000001000 [!
456 | b0000000000000000000000000000000000000000000000000000000000001000 d!
457 | b0000000000000000000000000000000000000000100000010000000000000000 f!
458 | b0000000000000000000000000000000000000000000000000000000000001000 j!
459 | b0000000000000000000000000000000000000000100000010000000000000000 p!
460 | b00010 ~!
461 | b01000 !"
462 | b00010 ""
463 | b0000000000000000000000000000000000000000000000000000000000000100 %"
464 | #14
465 | b0000000000000000000000000000000000000000000000000000000000001000 #
466 | b0000000000000000000000000000000000000000000000000000000000000010 +
467 | b0000000000000000000000000000000000000000000000010000000000001000 -
468 | b0000000000000000000000000000000000000000000000000000000000000010 /
469 | b0000000000000000000000000000000000000000000000000000000000000000 ;
470 | b0000000000000000000000000000000000000000000000000000000000000000 =
471 | b0000000000000000000000000000000000000000000000000000000000001000 ?
472 | b1111111111111111111111111111111111111111111111111111111111111000 G
473 | b0000000000000000000000000000000000000000000000000000000000000001 I
474 | b0000000000000000000000000000000000000000000000000000000000000001 K
475 | b0000000000000000000000000000000000000000000000000000000000000000 M
476 | b0000000000000000000000000000000000000000000000000000000000000000 S
477 | b0000000000000000000000000000000000000000000000000000000000000001 U
478 | b0000000000000000000000000000000000000000000000000000000000000000 W
479 | b0000000000000000000000000000000000000000000000000000000000000000 Y
480 | b1111111111111111111111111111111111111111111111111111111111111000 ]
481 | b0000000000000000000000000000000000000000000000000000000000000000 _
482 | b001000 e
483 | 0J!
484 | b0000000000000000000000000000000000000000000000000000000000000010 h!
485 | b0000000000000000000000000000000000000000000000010000000000001000 l!
486 | b0000000000000000000000000000000000000000000000000000000000000010 n!
487 | #15
488 | b0000000000000000000000000000000010000000000000000000000000001100 9
489 | b0000000000000000000000000000000000000000000000000000000000001000 ;
490 | b0000000000000000000000000000000000000000000000000000000000001000 =
491 | b0000000000000000000000000000000000000000000000000000000000010000 A
492 | b0000000000000000000000000000000000000000000000000000000000010000 E
493 | b0000000000000000000000000000000000000000000000000000000000000000 G
494 | b0000000000000000000000000000000000000000000000000000000000000000 I
495 | b0000000000000000000000000000000000000000000000000000000000000000 K
496 | b0000000000000000000000000000000000000000000000000000100000000000 M
497 | b0000000000000000000000000000000000000000000000000000000000000001 S
498 | b0000000000000000000000000000000000000000000000000000000000000000 U
499 | b0000000000000000000000000000000000000000000000000000000000000001 W
500 | b0000000000000000000000000000000000000000000000000000000000000001 Y
501 | b0000000000000000000000000000000000000000000000000000000000010000 [
502 | b0000000000000000000000000000000000000000000000000000000000000000 ]
503 | b0000000000000000000000000000000000000000000000000000100000000000 _
504 | b0000000000000000000000000000000010000000000000000000000000001000 f
505 | b0000000000000000000000000000000000000000000000000000000000001000 l
506 | 1J!
507 | b00000001000000011000000110010011 L!
508 | b0000000000000000000000000000000010000000000000000000000000001000 Q!
509 | b0000000000000000000000000000000000000000000000000000000000010000 [!
510 | b0000000000000000000000000000000000000000000000000000000000010000 d!
511 | b0000000000000000000000000000000000000001000000011000000000000000 f!
512 | b0000000000000000000000000000000000000000000000000000000000010000 j!
513 | b0000000000000000000000000000000000000001000000011000000000000000 p!
514 | b00011 ~!
515 | b10000 !"
516 | b00011 ""
517 | b0000000000000000000000000000000000000000000000000000000000001000 '"
518 | #16
519 | b0000000000000000000000000000000000000000000000000000000000010000 #
520 | b0000000000000000000000000000000000000000000000000000100000000010 +
521 | b0000000000000000000000000000000000000000000000011000000000010000 -
522 | b0000000000000000000000000000000000000000000000000000000000000011 /
523 | b0000000000000000000000000000000000000000000000000000000000000000 ;
524 | b0000000000000000000000000000000000000000000000000000000000000000 =
525 | b0000000000000000000000000000000000000000000000000000000000010000 ?
526 | b1111111111111111111111111111111111111111111111111111111111110000 G
527 | b0000000000000000000000000000000000000000000000000000000000000001 I
528 | b0000000000000000000000000000000000000000000000000000000000000001 K
529 | b0000000000000000000000000000000000000000000000000000000000000000 M
530 | b0000000000000000000000000000000000000000000000000000000000000000 S
531 | b0000000000000000000000000000000000000000000000000000000000000001 U
532 | b0000000000000000000000000000000000000000000000000000000000000000 W
533 | b0000000000000000000000000000000000000000000000000000000000000000 Y
534 | b1111111111111111111111111111111111111111111111111111111111110000 ]
535 | b0000000000000000000000000000000000000000000000000000000000000000 _
536 | b010000 e
537 | 0J!
538 | b0000000000000000000000000000000000000000000000000000100000000010 h!
539 | b0000000000000000000000000000000000000000000000011000000000010000 l!
540 | b0000000000000000000000000000000000000000000000000000000000000011 n!
541 | #17
542 | b0000000000000000000000000000000010000000000000000000000000010000 9
543 | b0000000000000000000000000000000000000000000000000000000000010000 ;
544 | b0000000000000000000000000000000000000000000000000000000000010000 =
545 | b0000000000000000000000000000000000000000000000000000000000100000 A
546 | b0000000000000000000000000000000000000000000000000000000000100000 E
547 | b0000000000000000000000000000000000000000000000000000000000000000 G
548 | b0000000000000000000000000000000000000000000000000000000000000000 I
549 | b0000000000000000000000000000000000000000000000000000000000000000 K
550 | b0000000000000000000000000000000000000000000100000000000000000000 M
551 | b0000000000000000000000000000000000000000000000000000000000000001 S
552 | b0000000000000000000000000000000000000000000000000000000000000000 U
553 | b0000000000000000000000000000000000000000000000000000000000000001 W
554 | b0000000000000000000000000000000000000000000000000000000000000001 Y
555 | b0000000000000000000000000000000000000000000000000000000000100000 [
556 | b0000000000000000000000000000000000000000000000000000000000000000 ]
557 | b0000000000000000000000000000000000000000000100000000000000000000 _
558 | b0000000000000000000000000000000010000000000000000000000000001100 f
559 | b0000000000000000000000000000000000000000000000000000000000010000 n
560 | 1J!
561 | b00000001000100100000001000010011 L!
562 | b0000000000000000000000000000000010000000000000000000000000001100 Q!
563 | b0000000000000000000000000000000000000000000000000000000000100000 [!
564 | b0000000000000000000000000000000000000000000000000000000000010001 d!
565 | b0000000000000000000000000000000000000001000100100000000000000000 f!
566 | b0000000000000000000000000000000000000000000000000000000000010001 j!
567 | b0000000000000000000000000000000000000001000100100000000000000000 p!
568 | b00100 ~!
569 | b10001 !"
570 | b00100 ""
571 | b0000000000000000000000000000000000000000000000000000000000010000 )"
572 | #18
573 | b0000000000000000000000000000000000000000000000000000000000010001 #
574 | b0000000000000000000000000000000000000000000000000000000000000100 +
575 | b0000000000000000000000000000000000000000000000100000100000010000 -
576 | b0000000000000000000000000000000000000000000000000000000000000100 /
577 | b0000000000000000000000000000000000000000000000000000000000000000 ;
578 | b0000000000000000000000000000000000000000000000000000000000000000 =
579 | b0000000000000000000000000000000000000000000000000000000000010001 ?
580 | b0000000000000000000000000000000000000000000000000000000000010001 A
581 | b0000000000000000000000000000000000000000000000000000000000010001 E
582 | b1111111111111111111111111111111111111111111111111111111111101111 G
583 | b0000000000000000000000000000000000000000000000000000000000000001 I
584 | b0000000000000000000000000000000000000000000000000000000000000001 K
585 | b0000000000000000000000000000000000000000000000000000000000000000 M
586 | b0000000000000000000000000000000000000000000000000000000000000000 S
587 | b0000000000000000000000000000000000000000000000000000000000000001 U
588 | b0000000000000000000000000000000000000000000000000000000000000000 W
589 | b0000000000000000000000000000000000000000000000000000000000000000 Y
590 | b0000000000000000000000000000000000000000000000000000000000010001 [
591 | b1111111111111111111111111111111111111111111111111111111111101111 ]
592 | b0000000000000000000000000000000000000000000000000000000000000000 _
593 | b010001 e
594 | 0J!
595 | b0000000000000000000000000000000000000000000000000000000000010001 [!
596 | b0000000000000000000000000000000000000000000000000000000000000100 h!
597 | b0000000000000000000000000000000000000000000000100000100000010000 l!
598 | b0000000000000000000000000000000000000000000000000000000000000100 n!
599 | #19
600 | b0000000000000000000000000000000010000000000000000000000000010100 9
601 | b0000000000000000000000000000000000000000000000000000000000010001 ;
602 | b0000000000000000000000000000000000000000000000000000000000010001 =
603 | b0000000000000000000000000000000000000000000000000000000000100010 A
604 | b0000000000000000000000000000000000000000000000000000000000100010 E
605 | b0000000000000000000000000000000000000000000000000000000000000000 G
606 | b0000000000000000000000000000000000000000000000000000000000000000 I
607 | b0000000000000000000000000000000000000000000000000000000000000000 K
608 | b0000000000000000000000000000000000000000001000100000000000000000 M
609 | b0000000000000000000000000000000000000000000000000000000000000001 S
610 | b0000000000000000000000000000000000000000000000000000000000000000 U
611 | b0000000000000000000000000000000000000000000000000000000000000001 W
612 | b0000000000000000000000000000000000000000000000000000000000000001 Y
613 | b0000000000000000000000000000000000000000000000000000000000100010 [
614 | b0000000000000000000000000000000000000000000000000000000000000000 ]
615 | b0000000000000000000000000000000000000000001000100000000000000000 _
616 | b0000000000000000000000000000000010000000000000000000000000010000 f
617 | b0000000000000000000000000000000000000000000000000000000000010001 p
618 | 1J!
619 | b00000001111100101000001010010011 L!
620 | b0000000000000000000000000000000010000000000000000000000000010000 Q!
621 | b0000000000000000000000000000000000000000000000000000000000100010 [!
622 | b0000000000000000000000000000000000000000000000000000000000011111 d!
623 | b0000000000000000000000000000000000000001111100101000000000000000 f!
624 | b0000000000000000000000000000000000000000000000000000000000011111 j!
625 | b0000000000000000000000000000000000000001111100101000000000000000 p!
626 | b00101 ~!
627 | b11111 !"
628 | b00101 ""
629 | b0000000000000000000000000000000000000000000000000000000000010001 +"
630 | #20
631 | b0000000000000000000000000000000000000000000000000000000000011111 #
632 | b0000000000000000000000000000000000000000000000000000100000000100 +
633 | b0000000000000000000000000000000000000000000000101000100000011110 -
634 | b0000000000000000000000000000000000000000000000000000000000000101 /
635 | b0000000000000000000000000000000000000000000000000000000000000000 ;
636 | b0000000000000000000000000000000000000000000000000000000000000000 =
637 | b0000000000000000000000000000000000000000000000000000000000011111 ?
638 | b0000000000000000000000000000000000000000000000000000000000011111 A
639 | b0000000000000000000000000000000000000000000000000000000000011111 E
640 | b1111111111111111111111111111111111111111111111111111111111100001 G
641 | b0000000000000000000000000000000000000000000000000000000000000001 I
642 | b0000000000000000000000000000000000000000000000000000000000000001 K
643 | b0000000000000000000000000000000000000000000000000000000000000000 M
644 | b0000000000000000000000000000000000000000000000000000000000000000 S
645 | b0000000000000000000000000000000000000000000000000000000000000001 U
646 | b0000000000000000000000000000000000000000000000000000000000000000 W
647 | b0000000000000000000000000000000000000000000000000000000000000000 Y
648 | b0000000000000000000000000000000000000000000000000000000000011111 [
649 | b1111111111111111111111111111111111111111111111111111111111100001 ]
650 | b0000000000000000000000000000000000000000000000000000000000000000 _
651 | b011111 e
652 | 0J!
653 | b0000000000000000000000000000000000000000000000000000000000011111 [!
654 | b0000000000000000000000000000000000000000000000000000100000000100 h!
655 | b0000000000000000000000000000000000000000000000101000100000011110 l!
656 | b0000000000000000000000000000000000000000000000000000000000000101 n!
657 | #21
658 | b0000000000000000000000000000000010000000000000000000000000011000 9
659 | b0000000000000000000000000000000000000000000000000000000000011111 ;
660 | b0000000000000000000000000000000000000000000000000000000000011111 =
661 | b0000000000000000000000000000000000000000000000000000000000111110 A
662 | b0000000000000000000000000000000000000000000000000000000000111110 E
663 | b0000000000000000000000000000000000000000000000000000000000000000 G
664 | b0000000000000000000000000000000000000000000000000000000000000000 I
665 | b0000000000000000000000000000000000000000000000000000000000000000 K
666 | b0000000000000000000000000000111110000000000000000000000000000000 M
667 | b0000000000000000000000000000000000000000000000000000000000000001 S
668 | b0000000000000000000000000000000000000000000000000000000000000000 U
669 | b0000000000000000000000000000000000000000000000000000000000000001 W
670 | b0000000000000000000000000000000000000000000000000000000000000001 Y
671 | b0000000000000000000000000000000000000000000000000000000000111110 [
672 | b0000000000000000000000000000000000000000000000000000000000000000 ]
673 | b0000000000000000000000000000111110000000000000000000000000000000 _
674 | b0000000000000000000000000000000010000000000000000000000000010100 f
675 | b0000000000000000000000000000000000000000000000000000000000011111 r
676 | 1J!
677 | b00000000011000001000001100010011 L!
678 | b0000000000000000000000000000000010000000000000000000000000010100 Q!
679 | b0000000000000000000000000000000000000000000000000000000000111110 [!
680 | b0000000000000000000000000000000000000000000000000000000000000110 d!
681 | b0000000000000000000000000000000000000000011000001000000000000000 f!
682 | b0000000000000000000000000000000000000000000000000000000000000110 j!
683 | b0000000000000000000000000000000000000000011000001000000000000000 p!
684 | b00001 ~!
685 | b00110 !"
686 | b00110 ""
687 | b0000000000000000000000000000000000000000000000000000000000011111 -"
688 | #22
689 | b0000000000000000000000000000000000000000000000000000000000000110 #
690 | b0000000000000000000000000000000000000000000000000000000000000110 +
691 | b0000000000000000000000000000000000000000000000001000000000000110 -
692 | b0000000000000000000000000000000000000000000000000000000000000110 /
693 | b0000000000000000000000000000000000000000000000000000000000000100 ;
694 | b0000000000000000000000000000000000000000000000000000000000000100 =
695 | b0000000000000000000000000000000000000000000000000000000000000110 ?
696 | b0000000000000000000000000000000000000000000000000000000000001010 A
697 | b0000000000000000000000000000000000000000000000000000000000001010 E
698 | b1111111111111111111111111111111111111111111111111111111111111110 G
699 | b0000000000000000000000000000000000000000000000000000000000000001 I
700 | b0000000000000000000000000000000000000000000000000000000000000001 K
701 | b0000000000000000000000000000000000000000000000000000000100000000 M
702 | b0000000000000000000000000000000000000000000000000000000000000000 S
703 | b0000000000000000000000000000000000000000000000000000000000000001 U
704 | b0000000000000000000000000000000000000000000000000000000000000000 W
705 | b0000000000000000000000000000000000000000000000000000000000000000 Y
706 | b0000000000000000000000000000000000000000000000000000000000001010 [
707 | b1111111111111111111111111111111111111111111111111111111111111110 ]
708 | b0000000000000000000000000000000000000000000000000000000100000000 _
709 | b000110 e
710 | 0J!
711 | b0000000000000000000000000000000000000000000000000000000000001010 [!
712 | b0000000000000000000000000000000000000000000000000000000000000110 h!
713 | b0000000000000000000000000000000000000000000000001000000000000110 l!
714 | b0000000000000000000000000000000000000000000000000000000000000110 n!
715 | #23
716 | b0000000000000000000000000000000000000000000000000000000000001010 7
717 | b0000000000000000000000000000000010000000000000000000000000011100 9
718 | b0000000000000000000000000000000010000000000000000000000000011000 f
719 | b0000000000000000000000000000000000000000000000000000000000001010 t
720 | 1J!
721 | b11111111111100111000001110010011 L!
722 | b0000000000000000000000000000000010000000000000000000000000011000 Q!
723 | b0000000000000000000000000000000000000000000000000000000000001010 U!
724 | b1111111 a!
725 | b111111 b!
726 | 1c!
727 | b0000000000000000000000000000000000000000000000000000111111111111 d!
728 | b0000000000000000000000000000000011111111111100111000000000000000 f!
729 | b1111111111111111111111111111111111111111111111111110000000000110 h!
730 | b1111111111111111111111111111111111111111111111111111111111111111 j!
731 | b1111111111111111111111111111111111111111111000001000000000000110 l!
732 | b1111111111111111111111111111111111111111111111111111000000000110 n!
733 | b1111111111111111111111111111111111111111111100111000000000000000 p!
734 | b00111 ~!
735 | b11111 !"
736 | b00111 ""
737 | b0000000000000000000000000000000000000000000000000000000000001010 /"
738 | #24
739 | b1111111111111111111111111111111111111111111111111111111111111111 #
740 | b0000000000000000000000000000000000000000000000000001111111100110 +
741 | b0000000000000000000000000000000000000000000100111000111111111110 -
742 | b0000000000000000000000000000000000000000000000000000111111100111 /
743 | b0000000000000000000000000000000000000000000000000000000000000000 7
744 | b0000000000000000000000000000000000000000000000000000000000000000 ;
745 | b0000000000000000000000000000000000000000000000000000000000000000 =
746 | b1111111111111111111111111111111111111111111111111111111111111111 ?
747 | b1111111111111111111111111111111111111111111111111111111111111111 A
748 | b1111111111111111111111111111111111111111111111111111111111111111 E
749 | b0000000000000000000000000000000000000000000000000000000000000001 G
750 | b0000000000000000000000000000000000000000000000000000000000000000 K
751 | b0000000000000000000000000000000000000000000000000000000000000000 M
752 | b0000000000000000000000000000000000000000000000000000000000000001 W
753 | b1111111111111111111111111111111111111111111111111111111111111111 [
754 | b0000000000000000000000000000000000000000000000000000000000000001 ]
755 | b0000000000000000000000000000000000000000000000000000000000000000 _
756 | b111111 e
757 | 0J!
758 | b0000000000000000000000000000000000000000000000000000000000000000 U!
759 | b1111111111111111111111111111111111111111111111111111111111111111 [!
760 | b1111111111111111111111111111111111111111111111111111111111100110 h!
761 | b1111111111111111111111111111111111111111111100111000111111111110 l!
762 | b1111111111111111111111111111111111111111111111111111111111100111 n!
763 | #25
764 | b0000000000000000000000000000000010000000000000000000000000100000 9
765 | b1111111111111111111111111111111111111111111111111111111111111111 ;
766 | b1111111111111111111111111111111111111111111111111111111111111111 =
767 | b1111111111111111111111111111111111111111111111111111111111111110 A
768 | b1111111111111111111111111111111111111111111111111111111111111110 C
769 | b1111111111111111111111111111111111111111111111111111111111111110 E
770 | b0000000000000000000000000000000000000000000000000000000000000000 G
771 | b0000000000000000000000000000000000000000000000000000000000000000 I
772 | b1000000000000000000000000000000000000000000000000000000000000000 M
773 | b1111111111111111111111111111111111111111111111111111111111111111 O
774 | b0000000000000000000000000000000000000000000000000000000000000001 Q
775 | b0000000000000000000000000000000000000000000000000000000000000001 S
776 | b0000000000000000000000000000000000000000000000000000000000000000 U
777 | b0000000000000000000000000000000000000000000000000000000000000001 Y
778 | b1111111111111111111111111111111111111111111111111111111111111110 [
779 | b0000000000000000000000000000000000000000000000000000000000000000 ]
780 | b1000000000000000000000000000000000000000000000000000000000000000 _
781 | b1111111111111111111111111111111111111111111111111111111111111111 a
782 | b0000000000000000000000000000000000000000000000000000000000000001 c
783 | b0000000000000000000000000000000010000000000000000000000000011100 f
784 | b1111111111111111111111111111111111111111111111111111111111111111 v
785 | 1J!
786 | b00000000100000100000010000010011 L!
787 | b0000000000000000000000000000000010000000000000000000000000011100 Q!
788 | b1111111111111111111111111111111111111111111111111111111111111110 [!
789 | b0000000 a!
790 | b000000 b!
791 | 0c!
792 | b0000000000000000000000000000000000000000000000000000000000001000 d!
793 | b0000000000000000000000000000000000000000100000100000000000000000 f!
794 | b0000000000000000000000000000000000000000000000000001111111100110 h!
795 | b0000000000000000000000000000000000000000000000000000000000001000 j!
796 | b0000000000000000000000000000000000000000000100111000111111111110 l!
797 | b0000000000000000000000000000000000000000000000000000111111100111 n!
798 | b0000000000000000000000000000000000000000100000100000000000000000 p!
799 | b00100 ~!
800 | b01000 !"
801 | b01000 ""
802 | b1111111111111111111111111111111111111111111111111111111111111111 1"
803 | #26
804 | b0000000000000000000000000000000000000000000000000000000000001000 #
805 | b0000000000000000000000000000000000000000000000000000000000001000 +
806 | b0000000000000000000000000000000000000000000000100000000000001000 -
807 | b0000000000000000000000000000000000000000000000000000000000001000 /
808 | b0000000000000000000000000000000000000000000000000000000000010001 ;
809 | b0000000000000000000000000000000000000000000000000000000000010001 =
810 | b0000000000000000000000000000000000000000000000000000000000001000 ?
811 | b0000000000000000000000000000000000000000000000000000000000011001 A
812 | b0000000000000000000000000000000000000000000000000000000000000000 C
813 | b0000000000000000000000000000000000000000000000000000000000011001 E
814 | b0000000000000000000000000000000000000000000000000000000000001001 G
815 | b0000000000000000000000000000000000000000000000000001000100000000 M
816 | b0000000000000000000000000000000000000000000000000000000000000000 O
817 | b0000000000000000000000000000000000000000000000000000000000000000 Q
818 | b0000000000000000000000000000000000000000000000000000000000000000 S
819 | b0000000000000000000000000000000000000000000000000000000000000001 U
820 | b0000000000000000000000000000000000000000000000000000000000011001 [
821 | b0000000000000000000000000000000000000000000000000000000000001001 ]
822 | b0000000000000000000000000000000000000000000000000001000100000000 _
823 | b0000000000000000000000000000000000000000000000000000000000000000 a
824 | b0000000000000000000000000000000000000000000000000000000000000000 c
825 | b001000 e
826 | 0J!
827 | b0000000000000000000000000000000000000000000000000000000000011001 [!
828 | b0000000000000000000000000000000000000000000000000000000000001000 h!
829 | b0000000000000000000000000000000000000000000000100000000000001000 l!
830 | b0000000000000000000000000000000000000000000000000000000000001000 n!
831 | #27
832 | b0000000000000000000000000000000000000000000000000000000000011001 7
833 | b0000000000000000000000000000000010000000000000000000000000100100 9
834 | b0000000000000000000000000000000010000000000000000000000000100000 f
835 | b0000000000000000000000000000000000000000000000000000000000011001 x
836 | 1J!
837 | b00000000100100101000010010010011 L!
838 | b0000000000000000000000000000000010000000000000000000000000100000 Q!
839 | b0000000000000000000000000000000000000000000000000000000000011001 U!
840 | b0000000000000000000000000000000000000000000000000000000000001001 d!
841 | b0000000000000000000000000000000000000000100100101000000000000000 f!
842 | b0000000000000000000000000000000000000000000000000000000000001001 j!
843 | b0000000000000000000000000000000000000000100100101000000000000000 p!
844 | b00101 ~!
845 | b01001 !"
846 | b01001 ""
847 | b0000000000000000000000000000000000000000000000000000000000011001 3"
848 | #28
849 | b0000000000000000000000000000000000000000000000000000000000001001 #
850 | b0000000000000000000000000000000000000000000000000000100000001000 +
851 | b0000000000000000000000000000000000000000000000101000100000001000 -
852 | b0000000000000000000000000000000000000000000000000000000000001001 /
853 | b0000000000000000000000000000000000000000000000000000000000000000 7
854 | b0000000000000000000000000000000000000000000000000000000000011111 ;
855 | b0000000000000000000000000000000000000000000000000000000000011111 =
856 | b0000000000000000000000000000000000000000000000000000000000001001 ?
857 | b0000000000000000000000000000000000000000000000000000000000101000 A
858 | b0000000000000000000000000000000000000000000000000000000000101000 E
859 | b0000000000000000000000000000000000000000000000000000000000010110 G
860 | b0000000000000000000000000000000000000000000000000011111000000000 M
861 | b0000000000000000000000000000000000000000000000000000000000101000 [
862 | b0000000000000000000000000000000000000000000000000000000000010110 ]
863 | b0000000000000000000000000000000000000000000000000011111000000000 _
864 | b001001 e
865 | 0J!
866 | b0000000000000000000000000000000000000000000000000000000000000000 U!
867 | b0000000000000000000000000000000000000000000000000000000000101000 [!
868 | b0000000000000000000000000000000000000000000000000000100000001000 h!
869 | b0000000000000000000000000000000000000000000000101000100000001000 l!
870 | b0000000000000000000000000000000000000000000000000000000000001001 n!
871 | #29
872 | b0000000000000000000000000000000000000000000000000000000000101000 7
873 | b0000000000000000000000000000000010000000000000000000000000101000 9
874 | b0000000000000000000000000000000010000000000000000000000000100100 f
875 | b0000000000000000000000000000000000000000000000000000000000101000 z
876 | 1J!
877 | b00000000011100110000010100010011 L!
878 | b0000000000000000000000000000000010000000000000000000000000100100 Q!
879 | b0000000000000000000000000000000000000000000000000000000000101000 U!
880 | b0000000000000000000000000000000000000000000000000000000000000111 d!
881 | b0000000000000000000000000000000000000000011100110000000000000000 f!
882 | b0000000000000000000000000000000000000000000000000000000000000111 j!
883 | b0000000000000000000000000000000000000000011100110000000000000000 p!
884 | b00110 ~!
885 | b00111 !"
886 | b01010 ""
887 | b0000000000000000000000000000000000000000000000000000000000101000 5"
888 | #30
889 | b0000000000000000000000000000000000000000000000000000000000000111 #
890 | b0000000000000000000000000000000000000000000000000000000000001010 +
891 | b0000000000000000000000000000000000000000000000110000100000000110 -
892 | b0000000000000000000000000000000000000000000000000000000000001010 /
893 | b1111111111111111111111111111111111111111111111111111111111111111 7
894 | b0000000000000000000000000000000000000000000000000000000000001010 ;
895 | b0000000000000000000000000000000000000000000000000000000000001010 =
896 | b0000000000000000000000000000000000000000000000000000000000000111 ?
897 | b0000000000000000000000000000000000000000000000000000000000010001 A
898 | b0000000000000000000000000000000000000000000000000000000000010001 E
899 | b0000000000000000000000000000000000000000000000000000000000000011 G
900 | b0000000000000000000000000000000000000000000000000000010100000000 M
901 | b0000000000000000000000000000000000000000000000000000000000010001 [
902 | b0000000000000000000000000000000000000000000000000000000000000011 ]
903 | b0000000000000000000000000000000000000000000000000000010100000000 _
904 | b000111 e
905 | 0J!
906 | b1111111111111111111111111111111111111111111111111111111111111111 U!
907 | b0000000000000000000000000000000000000000000000000000000000010001 [!
908 | b0000000000000000000000000000000000000000000000000000000000001010 h!
909 | b0000000000000000000000000000000000000000000000110000100000000110 l!
910 | b0000000000000000000000000000000000000000000000000000000000001010 n!
911 | #31
912 | b0000000000000000000000000000000010000000000000000000000000101100 9
913 | b0000000000000000000000000000000010000000000000000000000000101000 f
914 | b0000000000000000000000000000000000000000000000000000000000010001 |
915 | 1J!
916 | b00000000011000111000010110010011 L!
917 | b0000000000000000000000000000000010000000000000000000000000101000 Q!
918 | b0000000000000000000000000000000000000000000000000000000000000110 d!
919 | b0000000000000000000000000000000000000000011000111000000000000000 f!
920 | b0000000000000000000000000000000000000000000000000000000000000110 j!
921 | b0000000000000000000000000000000000000000011000111000000000000000 p!
922 | b00111 ~!
923 | b00110 !"
924 | b01011 ""
925 | b0000000000000000000000000000000000000000000000000000000000010001 7"
926 | #32
927 | b0000000000000000000000000000000000000000000000000000000000000110 #
928 | b0000000000000000000000000000000000000000000000000000100000001010 +
929 | b0000000000000000000000000000000000000000000000111000000000000110 -
930 | b0000000000000000000000000000000000000000000000000000000000001011 /
931 | b0000000000000000000000000000000000000000000000000000000000001010 7
932 | b1111111111111111111111111111111111111111111111111111111111111111 ;
933 | b1111111111111111111111111111111111111111111111111111111111111111 =
934 | b0000000000000000000000000000000000000000000000000000000000000110 ?
935 | b0000000000000000000000000000000000000000000000000000000000000101 A
936 | b1111110000000000000000000000000000000000000000000000000000000000 C
937 | b0000000000000000000000000000000000000000000000000000000000000101 E
938 | b1111111111111111111111111111111111111111111111111111111111111001 G
939 | b0000000000000000000000000000000000000000000000000000000000000001 K
940 | b1111111111111111111111111111111111111111111111111111111111000000 M
941 | b1111111111111111111111111111111111111111111111111111111111111111 O
942 | b0000001111111111111111111111111111111111111111111111111111111111 Q
943 | b0000000000000000000000000000000000000000000000000000000000000000 W
944 | b0000000000000000000000000000000000000000000000000000000000000101 [
945 | b1111111111111111111111111111111111111111111111111111111111111001 ]
946 | b1111111111111111111111111111111111111111111111111111111111000000 _
947 | b1111111111111111111111111111111111111111111111111111111111111111 a
948 | b0000001111111111111111111111111111111111111111111111111111111111 c
949 | b000110 e
950 | 0J!
951 | b0000000000000000000000000000000000000000000000000000000000001010 U!
952 | b0000000000000000000000000000000000000000000000000000000000000101 [!
953 | b0000000000000000000000000000000000000000000000000000100000001010 h!
954 | b0000000000000000000000000000000000000000000000111000000000000110 l!
955 | b0000000000000000000000000000000000000000000000000000000000001011 n!
956 | #33
957 | b0000000000000000000000000000000010000000000000000000000000110000 9
958 | b0000000000000000000000000000000010000000000000000000000000101100 f
959 | b0000000000000000000000000000000000000000000000000000000000000101 ~
960 | 1J!
961 | b00000000011100001000011000010011 L!
962 | b0000000000000000000000000000000010000000000000000000000000101100 Q!
963 | b0000000000000000000000000000000000000000000000000000000000000111 d!
964 | b0000000000000000000000000000000000000000011100001000000000000000 f!
965 | b0000000000000000000000000000000000000000000000000000000000000111 j!
966 | b0000000000000000000000000000000000000000011100001000000000000000 p!
967 | b00001 ~!
968 | b00111 !"
969 | b01100 ""
970 | b0000000000000000000000000000000000000000000000000000000000000101 9"
971 | #34
972 | b0000000000000000000000000000000000000000000000000000000000000111 #
973 |
--------------------------------------------------------------------------------
/vsh.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | # ====================================================================================================
4 | # VSH: SHell for Visualizing vcd file ||
5 | # Copyleft (C) Clayden University ||
6 | # License GPLv3: GNU GPL version 3 ||
7 | # Author: Fu-yao ||
8 | # Bug report & maintainer: fuyao-cu@outlook.com ||
9 | # VSH is open source and freely distributable ||
10 | # ====================================================================================================
11 |
12 | import os
13 | import sys
14 | import struct
15 | import bisect
16 | import random
17 | import datetime
18 | from enum import Enum
19 | from pyDigitalWaveTools.vcd.parser import VcdParser
20 | from pyDigitalWaveTools.vcd.common import VcdVarScope
21 | from pyDigitalWaveTools.vcd.parser import VcdVarParsingInfo
22 |
23 | import cmd2
24 | from cmd2 import Cmd2ArgumentParser, with_argparser
25 |
26 | from cmd2 import (
27 | Bg,
28 | Fg,
29 | style,
30 | )
31 |
32 | from capstone import *
33 |
34 | search_var_list = [] # the global list of signal name (while using search cmd)
35 |
36 | # -------------------------------- expression evaluation -------------------------------- #
37 | operator_precedence = {
38 | # "-" : 2,
39 | # "!" : 2,
40 | # "~" : 2,
41 | "/" : 3,
42 | "*" : 3,
43 | "%" : 3,
44 | "+" : 4,
45 | "-" : 4,
46 | "<<": 5,
47 | ">>": 5,
48 | ">=": 6,
49 | ">" : 6,
50 | "<=": 6,
51 | "<" : 6,
52 | "==": 7,
53 | "!=": 7,
54 | "^" : 9,
55 | "||": 12,
56 | "|" : 10,
57 | "&&": 11,
58 | "&" : 8,
59 | }
60 |
61 |
62 | class expr_eval:
63 | def __init__(self):
64 | self.op = None # ?: signal name (var)
65 | self.val1 = None
66 | self.val2 = None
67 | self.var_val_dict = None
68 |
69 | return
70 |
71 |
72 | def set_var_val_dict(self, vvd):
73 | self.var_val_dict = vvd
74 |
75 | return
76 |
77 |
78 | def parse(self, expr):
79 | expr = expr.lstrip().rstrip()
80 | nest_bracket = []
81 | nest_level = 0
82 |
83 | for i in expr:
84 | if i == '(':
85 | nest_level += 1
86 | nest_bracket.append(nest_level)
87 |
88 | elif i == ')':
89 | nest_bracket.append(nest_level)
90 | nest_level -= 1
91 | else:
92 | nest_bracket.append(nest_level)
93 |
94 | if nest_level != 0:
95 | print("Invalid expression:", expr)
96 |
97 | return
98 |
99 | flag = False
100 |
101 | for i in nest_bracket:
102 | if i == 0:
103 | flag = True
104 | break
105 |
106 | if flag == False: # eg: "(1+2)"
107 | self.parse(expr[1:-1])
108 |
109 | return
110 |
111 | min_op_index = 0
112 | min_op_precedence = 0
113 | i = 1 # skip the first item (not binary operator)
114 | cur_expr_op = ""
115 |
116 | while i < (len(nest_bracket) - 1): # cannot find op at the end of a valid expression, eg: 1+2-
117 | if nest_bracket[i] == 0:
118 | for (k, v) in operator_precedence.items():
119 | if k == expr[i:i + 2]: # match "==" ">=" etc
120 | if min_op_precedence <= v:
121 | min_op_index = i
122 | min_op_precedence = v
123 | self.op = k
124 | cur_expr_op = k
125 |
126 | i += 1
127 |
128 | break
129 | elif k == expr[i]: # match "-" "+" etc
130 | if min_op_precedence <= v:
131 | min_op_index = i
132 | min_op_precedence = v
133 | self.op = k
134 | cur_expr_op = k
135 |
136 | break
137 |
138 | i += 1
139 |
140 | if min_op_precedence == 0:
141 | if expr[0:2] == "0x":
142 | if expr[2] == 'x' or expr[2] == 'z':
143 | self.val2 = expr[2]
144 | else:
145 | self.val2 = int(expr, 16) # need assert when fail
146 | elif expr[0:2] == "0b":
147 | if expr[2] == 'x' or expr[2] == 'z':
148 | self.val2 = expr[2]
149 | else:
150 | self.val2 = int(expr, 2) # need assert when fail
151 | elif expr[0:2] == "0o":
152 | if expr[2] == 'x' or expr[2] == 'z':
153 | self.val2 = expr[2]
154 | else:
155 | self.val2 = int(expr, 8) # need assert when fail
156 | elif expr[0] >= '0' and expr[0] <= '9': # number
157 | for i in expr:
158 | if i >= '0' and i <= '9':
159 | continue
160 | else:
161 | print("Invalid expression:", expr)
162 | return
163 |
164 | self.val2 = int(expr)
165 | elif expr[0] == "-" or expr[0] == "!" or expr[0] == "~":
166 | self.op = expr[0]
167 | child = expr_eval()
168 | child.parse(expr[1:])
169 | self.val2 = child
170 |
171 | return
172 | else: # signal name
173 | self.op = "?"
174 | self.val2 = expr
175 | global search_var_list
176 | search_var_list.append(expr)
177 |
178 | return
179 |
180 | child1 = expr_eval()
181 | child1.parse(expr[0:min_op_index])
182 | self.val1 = child1
183 |
184 | child2 = expr_eval()
185 | child2.parse(expr[min_op_index + len(cur_expr_op):])
186 | self.val2 = child2
187 |
188 | return
189 |
190 |
191 | def eval(self):
192 | if self.op == None and self.val2 == None:
193 | print("Invalid expression!")
194 | return
195 |
196 | if self.op == None:
197 | return self.val2
198 |
199 | if self.op == "?":
200 | return self.var_val_dict[self.val2]
201 |
202 | self.val2.set_var_val_dict(self.var_val_dict)
203 | opr = self.val2.eval()
204 |
205 | if opr == None:
206 | print("Invalid expression!")
207 | return
208 |
209 | if self.val1 == None: # unary
210 | if self.op == '-':
211 | return -opr
212 | elif self.op == '~':
213 | return ~opr
214 | elif self.op == '!':
215 | return not opr
216 |
217 | self.val1.set_var_val_dict(self.var_val_dict)
218 | opl = self.val1.eval()
219 |
220 | if opl == None:
221 | print("Invalid expression!")
222 | return
223 |
224 | res = 0
225 |
226 | if self.op == '/':
227 | res = int(opl / opr)
228 | elif self.op == '*':
229 | res = opl * opr
230 | elif self.op == '%':
231 | res = opl % opr
232 | elif self.op == '+':
233 | res = opl + opr
234 | elif self.op == '-':
235 | res = opl - opr
236 | elif self.op == '<<':
237 | res = opl << opr
238 | elif self.op == '>>':
239 | res = opl >> opr
240 | elif self.op == '<':
241 | res = opl < opr
242 | elif self.op == '<=':
243 | res = opl <= opr
244 | elif self.op == '>':
245 | res = opl > opr
246 | elif self.op == '>=':
247 | res = opl >= opr
248 | elif self.op == '==':
249 | res = opl == opr
250 | elif self.op == '!=':
251 | res = opl != opr
252 | elif self.op == '&':
253 | res = opl & opr
254 | elif self.op == '^':
255 | res = opl ^ opr
256 | elif self.op == '|':
257 | res = opl | opr
258 | elif self.op == '&&':
259 | res = opl and opr
260 | elif self.op == '||':
261 | res = opl or opr
262 |
263 | return res
264 |
265 | # ======================================================================================= #
266 |
267 | # -------------------------------------- vsh class -------------------------------------- #
268 | list_argparser = Cmd2ArgumentParser()
269 | list_argparser.add_argument('-s', '--signal_list', action='store_true', help='list current signals under spying')
270 | list_argparser.add_argument('-m', '--marker_list', action='store_true', help='list markers')
271 | list_argparser.add_argument('-M', '--Macro_list', action='store_true', help='list Macros')
272 | list_argparser.add_argument('word', nargs='?', help='path of submodule')
273 |
274 | show_argparser = Cmd2ArgumentParser()
275 | show_argparser.add_argument('-n', '--next', type=str, help='set the increment of t')
276 | show_argparser.add_argument('word', nargs='?', help='signal name')
277 |
278 | add_argparser = Cmd2ArgumentParser()
279 | add_argparser.add_argument('-f', '--format', type=str, help='set display format of signal value')
280 | add_argparser.add_argument('-fg', '--foreground', type=str, help='set foreground color')
281 | add_argparser.add_argument('-fgr', '--foreground_random', action='store_true', help='set foreground to a random color')
282 | add_argparser.add_argument('-bg', '--background', type=str, help='set background color')
283 | add_argparser.add_argument('-bgr', '--background_random', action='store_true', help='set background to a random color')
284 | add_argparser.add_argument('-m', '--mode', type=str, help='set display mode')
285 | add_argparser.add_argument('word', nargs='?', help='signal name')
286 |
287 | mg_argparser = Cmd2ArgumentParser()
288 | mg_argparser.add_argument('-m', '--macro', type=str, help='macro set')
289 | mg_argparser.add_argument('-v', '--value', type=str, help='macro value set')
290 | mg_argparser.add_argument('-n', '--name', type=str, help='name of macro group')
291 |
292 | bm_argparser = Cmd2ArgumentParser()
293 | bm_argparser.add_argument('-n', '--name', type=str, help='name of macro group')
294 | bm_argparser.add_argument('-s', '--signal_name', type=str, help='signal to bond')
295 |
296 | bd_argparser = Cmd2ArgumentParser()
297 | bd_argparser.add_argument('-s', '--signal_name', type=str, help='signal to bond')
298 | bd_argparser.add_argument('-a', '--architecture', type=str, help='bond signal to disassembler with certain architecture')
299 |
300 | disasm_argparser = Cmd2ArgumentParser()
301 | disasm_argparser.add_argument('-a', '--architecture', type=str, help='set architecture')
302 | disasm_argparser.add_argument('word', nargs='?', help='data')
303 |
304 | color_argparser = Cmd2ArgumentParser()
305 | color_argparser.add_argument('-fg', '--foreground', type=str, help='set foreground color')
306 | color_argparser.add_argument('-fgr', '--foreground_random', action='store_true', help='set foreground to a random color')
307 | color_argparser.add_argument('-bg', '--background', type=str, help='set background color')
308 | color_argparser.add_argument('-bgr', '--background_random', action='store_true', help='set background to a random color')
309 | color_argparser.add_argument('-m', '--mode', type=str, help='set display mode')
310 | color_argparser.add_argument('-i', '--index', type=str, help='the index of the signal')
311 | color_argparser.add_argument('word', nargs='?', help='signal name')
312 |
313 | marker_argparser = Cmd2ArgumentParser()
314 | marker_argparser.add_argument('-d', '--delete', action='store_true', help='delete the marker')
315 | marker_argparser.add_argument('-l', '--list', action='store_true', help='list the markers')
316 | marker_argparser.add_argument('-i', '--index', type=str, help='index of the marker')
317 | marker_argparser.add_argument('-t', '--time', type=str, help='time of the marker')
318 | marker_argparser.add_argument('-fg', '--foreground', type=str, help='set foreground color of the marker')
319 | marker_argparser.add_argument('-fgr', '--foreground_random', action='store_true', help='set marker\'s foreground to a random color')
320 | marker_argparser.add_argument('-bg', '--background', type=str, help='set background color of the marker')
321 | marker_argparser.add_argument('-bgr', '--background_random', action='store_true', help='set marker\'s background to a random color')
322 | marker_argparser.add_argument('-m', '--mode', type=str, help='set display mode of the marker')
323 | marker_argparser.add_argument('word', nargs='?', help='marker name')
324 |
325 | t_argparser = Cmd2ArgumentParser()
326 | t_argparser.add_argument('-a', '--absolute', action='store_true', help='set value of the time point')
327 | t_argparser.add_argument('word', nargs='?', help='marker name')
328 |
329 | randc_argparser = Cmd2ArgumentParser()
330 | randc_argparser.add_argument('-n', '--number', type=str, help='number of random color')
331 |
332 | precision_argparser = Cmd2ArgumentParser()
333 | precision_argparser.add_argument('word', nargs='?', help='precision')
334 |
335 | save_argparser = Cmd2ArgumentParser()
336 | save_argparser.add_argument('word', nargs='?', help='path')
337 |
338 | icon = r"""======================================================================================================
339 | || ...@@@@@@@@@ @ ||
340 | || ......@@@@@@@@@@@@@ @@@ ||
341 | || ........./ \@@@@@@@@@@ @@@@ ||
342 | || ........| O |@@@@@@@@@@@@ @@@@@ ||
343 | || .......\ /...@@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@@ ||
344 | || .......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ ||
345 | || .......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ||
346 | || .......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ||
347 | || ......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ||
348 | || ......@@@@@@@@.......@@@@@@@@@@@@@@@@@@@@@ ||
349 | || @@@@@@@.... ||
350 | || @@@@@ ||
351 | || @@@@ ||
352 | || @@ ||
353 | ======================================================================================================
354 | """
355 |
356 | info = """|| SHell for Visualizing vcd file ||
357 | || Copyright (C) %-4d Clayden University ||
358 | || License GPLv3: GNU GPL version 3 ||
359 | || Bug report & maintainer: fuyao-cu@outlook.com ||
360 | || VSH is open source and freely distributable ||
361 | ======================================================================================================""" % datetime.datetime.today().year
362 |
363 |
364 |
365 | class DISP_FORMAT(Enum):
366 | b = 0
367 | o = 1
368 | d = 2
369 | h = 3
370 | f = 4 # float / double
371 | s = 5 # signed
372 | a = 6 # ascii
373 | m = 7 # machine code (disassemble result) / macro name
374 |
375 |
376 | def render(strVal, *, fg = (255, 255, 255), bg = (0, 0, 0), mode = 0):
377 | if bg == None:
378 | res_str = f"\x1b[{mode}m\x1b[38;2;{fg[0]};{fg[1]};{fg[2]}m{strVal}\x1b[0m"
379 | else:
380 | res_str = f"\x1b[{mode}m\x1b[38;2;{fg[0]};{fg[1]};{fg[2]}m\x1b[48;2;{bg[0]};{bg[1]};{bg[2]}m{strVal}\x1b[0m"
381 |
382 | return res_str
383 |
384 |
385 | def str2num(numStr):
386 | val = None
387 |
388 | try:
389 | if numStr[0:2] == '0x':
390 | val = int(numStr[2:], 16)
391 | elif numStr[0:2] == '0b':
392 | val = int(numStr[2:], 2)
393 | elif numStr[0:2] == '0o':
394 | val = int(numStr[2:], 8)
395 | else:
396 | val = int(numStr)
397 |
398 | return val
399 | except Exception as e:
400 | print("Invalid number:", numStr)
401 | return None
402 |
403 | return val
404 |
405 |
406 | class vsh(cmd2.Cmd):
407 | CUSTOM_CATEGORY = 'Custom Commands'
408 | def __init__(self):
409 | super().__init__(
410 | multiline_commands=['echo'],
411 | persistent_history_file='.vsh_history',
412 | startup_script='.vsh_start',
413 | include_ipy=True,
414 | )
415 |
416 | # self.intro = style(icon, fg=Fg.BLUE, bg=None, bold=True) + info
417 |
418 | if 'VSH_INTRO' in os.environ and os.environ['VSH_INTRO'].lower().startswith('off'):
419 | self.intro = None
420 | else:
421 | self.intro = icon.replace('@', "\033[34m@\033[0m") + info
422 |
423 | self.prompt = 'vsh> '
424 | self.continuation_prompt = '... '
425 | self.self_in_py = True
426 | self.default_category = 'cmd2 Built-in Commands'
427 | self.foreground_color = Fg.CYAN.name.lower()
428 | self.vcd = VcdParser()
429 | self.cur_mod = None
430 | self.t = 0
431 | self.spy_sig_list = [] # [(VcdVarParsingInfo, time_val, format, color)]
432 | self.shadow_for_logic = False # do not show the signal value when wire length == 1
433 |
434 | self.CS_ARCH = CS_ARCH_RISCV
435 | self.CS_MODE = CS_MODE_RISCV64
436 |
437 | self.macro_map = {}
438 | self.marker_list = []
439 |
440 | self.max_t = None
441 |
442 | self.precision = 4
443 |
444 | fg_colors = [c.name.lower() for c in Fg]
445 |
446 | self.history.clear()
447 | self.aliases['n'] = 'show -n 1'
448 | self.aliases['p'] = 'show -n -1'
449 | self.aliases['l'] = 'list'
450 | self.aliases['s'] = 'search'
451 | self.aliases['m'] = 'marker'
452 | self.aliases['d'] = 'del'
453 | self.aliases['e'] = 'exit'
454 | self.aliases['q'] = 'exit'
455 | self.aliases['quit'] = 'exit'
456 |
457 | self.add_settable(
458 | cmd2.Settable('foreground_color', str, 'Foreground color to use with echo command', self, choices=fg_colors)
459 | )
460 |
461 |
462 | @cmd2.with_category(CUSTOM_CATEGORY)
463 | def do_intro(self, _):
464 | """Display the intro banner"""
465 | self.intro = icon.replace('@', "\033[34m@\033[0m") + info
466 | print(self.intro)
467 |
468 |
469 | @cmd2.with_category(CUSTOM_CATEGORY)
470 | def do_sfl(self, opts):
471 | """Display color bar for signal (wire length == 1)"""
472 | if opts == "0":
473 | self.shadow_for_logic = False
474 | else:
475 | self.shadow_for_logic = True
476 |
477 | return
478 |
479 |
480 | complete_load = cmd2.Cmd.path_complete
481 |
482 | @cmd2.with_category(CUSTOM_CATEGORY)
483 | def do_load(self, opts):
484 | if os.path.exists(opts) == False:
485 | print("No such vcd file:", opts)
486 | return
487 |
488 | with open(opts) as vcd_file:
489 | self.vcd = VcdParser()
490 | self.vcd.parse(vcd_file)
491 |
492 | self.prompt = "/ > "
493 | self.cur_mod = self.vcd.scope
494 | max_time_point = -1
495 |
496 | for sig in self.vcd.idcode2series.items():
497 | for i in sig[1]:
498 | if i[0] > max_time_point:
499 | max_time_point = i[0]
500 |
501 | self.max_t = max_time_point
502 |
503 | ## reset values
504 | self.spy_sig_list = [] # [(VcdVarParsingInfo, time_val, format, color)]
505 |
506 |
507 | @cmd2.with_category(CUSTOM_CATEGORY)
508 | @with_argparser(list_argparser)
509 | def do_list(self, opts):
510 | if opts.signal_list:
511 | index_num = 0
512 |
513 | for i in self.spy_sig_list:
514 | mod = i[0].parent
515 | mod_hier = ""
516 |
517 | if mod.parent == None:
518 | mod_hier = "/" + mod_hier
519 |
520 | while mod.parent != None:
521 | mod_hier = "/" + mod.name + mod_hier
522 | mod = mod.parent
523 |
524 | print((render(("%-4d %s %d %s" % (index_num, i[0].name, i[0].width, mod_hier)), fg = i[1][0], bg = i[1][1], mode = i[1][2])))
525 | index_num += 1
526 |
527 | return
528 |
529 | if opts.marker_list:
530 | j = 0
531 |
532 | for i in self.marker_list:
533 | print("[%5d] %-20d: " % (j, i[1]) + render(i[0], fg = i[2][0], bg = i[2][1], mode = i[2][2]))
534 | j += 1
535 |
536 | return
537 |
538 | if opts.Macro_list:
539 | for i in self.macro_map:
540 | print(i, ":", self.macro_map[i])
541 |
542 | return
543 |
544 | if self.cur_mod == None:
545 | return
546 |
547 | mod = self.cur_mod.children
548 |
549 | for k, v in mod.items():
550 | if isinstance(v, VcdVarParsingInfo):
551 | print("\033[32m%s\033[0m %d" % (v.name, v.width))
552 | elif isinstance(v, VcdVarScope):
553 | print("\033[34m%s\033[0m" % (v.name))
554 |
555 |
556 | @cmd2.with_category(CUSTOM_CATEGORY)
557 | def do_pwm(self, opts):
558 | mod = self.cur_mod
559 |
560 | if mod == None:
561 | print("Please load vcd file.")
562 | return
563 |
564 | pwm = ""
565 |
566 | if mod.parent == None:
567 | pwm = "/" + pwm
568 |
569 | while mod.parent != None:
570 | pwm = "/" + mod.name + pwm
571 | mod = mod.parent
572 |
573 | print(pwm)
574 |
575 | def adjust_prompt(self):
576 | mod = self.cur_mod
577 | self.prompt = " > "
578 |
579 | if mod.parent == None:
580 | self.prompt = "/" + self.prompt
581 |
582 | while mod.parent != None:
583 | self.prompt = "/" + mod.name + self.prompt
584 | mod = mod.parent
585 |
586 | return
587 |
588 | @cmd2.with_category(CUSTOM_CATEGORY)
589 | def do_cm(self, opts):
590 | if self.cur_mod == None:
591 | print("Please load vcd file.")
592 | return
593 |
594 | if opts == ".":
595 | return
596 | elif opts == "..":
597 | mod = self.cur_mod
598 |
599 | if mod.parent != None:
600 | self.cur_mod = mod.parent
601 | self.adjust_prompt()
602 |
603 | return
604 | elif opts == "/":
605 | self.cur_mod = self.vcd.scope
606 | self.adjust_prompt()
607 |
608 | return
609 |
610 | if opts == None or opts == "":
611 | self.do_cm("/")
612 |
613 | return
614 |
615 | mod_children = self.cur_mod.children
616 | args = opts
617 |
618 | if opts[0] == '/': # absolute path
619 | mod_children = self.vcd.scope.children
620 | args = opts[1:]
621 |
622 | args_list = args.split('/')
623 | flag = True
624 | res_mod = self.cur_mod
625 |
626 | for i in args_list:
627 | for k, v in mod_children.items():
628 | flag = False
629 |
630 | if i == '.' or i == '':
631 | mod_children = res_mod.children
632 | flag = True
633 | break
634 | elif i == '..':
635 | if res_mod.parent != None:
636 | res_mod = res_mod.parent
637 |
638 | mod_children = res_mod.children
639 | flag = True
640 | break
641 | elif v.name == i and isinstance(v, VcdVarScope):
642 | mod_children = v.children
643 | res_mod = v
644 | flag = True
645 | break
646 |
647 | if flag == False:
648 | break
649 |
650 | if flag == False:
651 | print("No such submodule:", opts)
652 | else:
653 | self.cur_mod = res_mod
654 | self.adjust_prompt()
655 |
656 | return
657 |
658 |
659 | def complete_cm(self, text, line, begidx, endidx):
660 | complete_cm_list = []
661 |
662 | if self.cur_mod != None:
663 | for k, v in self.cur_mod.children.items():
664 |
665 | if isinstance(v, VcdVarScope):
666 | complete_cm_list += [v.name]
667 |
668 | return self.basic_complete(text, line, begidx, endidx, complete_cm_list)
669 |
670 |
671 | @cmd2.with_category(CUSTOM_CATEGORY)
672 | @with_argparser(t_argparser)
673 | def do_t(self, opts):
674 | if (opts.word == "") or (opts.word == None):
675 | print("CURRENT_TIME / MAX_TIME:", self.t, "/", self.max_t)
676 | return
677 |
678 | res = 0
679 |
680 | try:
681 | res = int(opts.word)
682 | except Exception as e:
683 | print (e, ": Wrong parameter")
684 | return
685 |
686 | if opts.absolute:
687 | self.t = res
688 | else:
689 | self.t += res
690 |
691 | if self.t < 0:
692 | self.t = 0
693 |
694 | if self.t > self.max_t:
695 | self.t = self.max_t
696 |
697 | print("CURRENT_TIME / MAX_TIME:", self.t, "/", self.max_t)
698 |
699 | return
700 |
701 | def align_sig(self, side_w, max_sig_w, str_list, sig_width=None, fg = (255, 255, 255), bg = None, mode = 0):
702 | res = str_list[0].ljust(side_w, ' ')
703 | val_str_list = [(str_list[1], 1)]
704 |
705 | if self.shadow_for_logic and sig_width == 1:
706 | if bg == None:
707 | bg = (135, 170, 104) # WoW
708 |
709 | for i in str_list[1:]:
710 | if i == '1':
711 | res += render(" " * max_sig_w, fg = fg, bg = bg, mode = mode)
712 | else:
713 | res += render("_" * max_sig_w, fg = fg, bg = None, mode = mode)
714 |
715 | return res
716 |
717 | for i in range(2, len(str_list)):
718 | if str_list[i] == val_str_list[-1][0]:
719 | val_str_list[-1] = (val_str_list[-1][0], val_str_list[-1][1] + 1)
720 | else:
721 | val_str_list += [(str_list[i], 1)]
722 |
723 | for i in val_str_list:
724 | val_str = i[0].center(max_sig_w * i[1], ' ')
725 | res += "\\" + val_str[1:-1] + "/"
726 |
727 | # if sig_width == 1:
728 | # for i in val_str_list:
729 | # if i[0] == '1':
730 | # res += "\e[44m \e[0m" * i[1]
731 | # else:
732 | # res += "\e[4m \e[0m" * i[1]
733 | # else:
734 | # for i in val_str_list:
735 | # val_str = i[0].center(max_sig_w * i[1], ' ')
736 | # res += "\\" + val_str[1:-1] + "/"
737 |
738 | # for i in range(1, len(str_list)):
739 | # val_str = str_list[i].center(max_sig_w, ' ')
740 | # res += "\\" + val_str[1:-1] + "/"
741 |
742 | return res
743 |
744 | def search_val(self, tmax, time_val_list):
745 | index = bisect.bisect_right(time_val_list, self.t, hi = len(time_val_list), key = lambda X : X[0])
746 |
747 | if index == len(time_val_list):
748 | return [time_val_list[-1][1]] * tmax
749 |
750 | if time_val_list[index][0] > self.t:
751 | index -= 1
752 |
753 | res = []
754 | i = 0
755 |
756 | while i < tmax:
757 | if index == (len(time_val_list) - 1):
758 | res += [time_val_list[-1][1]] * (tmax - i)
759 | break
760 |
761 | if ((self.t + i) >= time_val_list[index][0]) and ((self.t + i) < time_val_list[index + 1][0]):
762 | res += [time_val_list[index][1]]
763 | i += 1
764 | elif self.t + i >= time_val_list[index + 1][0]:
765 | index += 1
766 |
767 | return res
768 |
769 |
770 | def bin2float(self, bstr):
771 | val = 0.0
772 |
773 | if len(bstr) == 32:
774 | val = struct.unpack('>f', struct.pack('>I', int(bstr, 2)))[0]
775 | elif len(bstr) == 64:
776 | val = struct.unpack('>d', struct.pack('>Q', int(bstr, 2)))[0]
777 |
778 | return val
779 |
780 |
781 | def bin2signed(self, bstr):
782 | val = -(2 ** (len(bstr) - 1))
783 |
784 | if bstr[0] == '0':
785 | val = 0
786 |
787 |
788 | val += int(bstr[1:], 2)
789 |
790 | return val
791 |
792 |
793 | def get_ascii_name(self, code):
794 | control_char = {
795 | 0: "NUL",
796 | 9: "HT",
797 | 10: "LF",
798 | 13: "CR",
799 | 27: "ESC",
800 | 32: "SPACE"
801 | }
802 |
803 | if 0 <= code <= 31:
804 | res = control_char.get(code)
805 |
806 | if res == None:
807 | res = f"\\0x{code:02X}"
808 |
809 | return res
810 | elif 33 <= code <= 126:
811 | return f"{chr(code)}"
812 | elif 127 <= code <= 255:
813 | return f"\\0x{code:02X}"
814 | else:
815 | return f"\\0x{code:02X}"
816 |
817 | return ""
818 |
819 |
820 | def digit_conv(self, val_list, fmt):
821 | res = []
822 |
823 | for i in val_list:
824 | bin_str = i
825 | val_str = ""
826 |
827 | if bin_str[0] == 'z' or bin_str[0] == 'x':
828 | res += [bin_str]
829 | continue
830 |
831 | if i[0] == 'b':
832 | bin_str = i[1:]
833 |
834 | if bin_str[0] == 'z' or bin_str[0] == 'x':
835 | res += [bin_str]
836 | continue
837 |
838 | if fmt == DISP_FORMAT.a:
839 | val_str = self.get_ascii_name(int(bin_str, 2))
840 | elif fmt == DISP_FORMAT.b:
841 | val_str = bin_str
842 | elif fmt == DISP_FORMAT.o:
843 | val_str = oct(int(bin_str, 2))[2:]
844 | elif fmt == DISP_FORMAT.d:
845 | val_str = "%d" % int(bin_str, 2)
846 | elif fmt == DISP_FORMAT.f:
847 | fval = self.bin2float(bin_str)
848 | val_str = f"{fval:.{self.precision}E}"
849 | elif fmt == DISP_FORMAT.s:
850 | sval = self.bin2signed(bin_str)
851 | val_str = "%d" % (sval)
852 | else:
853 | val_str = hex(int(bin_str, 2))[2:]
854 |
855 | res += [val_str]
856 |
857 | return res
858 |
859 |
860 | def digit_to_instr(self, val_list, arch_mode):
861 | res = []
862 |
863 | for i in val_list:
864 | bin_str = i
865 | val_str = ""
866 |
867 | if bin_str[0] == 'z' or bin_str[0] == 'x':
868 | res += [bin_str]
869 | continue
870 |
871 | if i[0] == 'b':
872 | bin_str = i[1:]
873 |
874 | if bin_str[0] == 'z' or bin_str[0] == 'x':
875 | res += [bin_str]
876 | continue
877 |
878 | val_str = self.disasm_data(int(bin_str, 2), arch_mode)
879 |
880 | if (len(val_str) == 0): # invalid instruction
881 | res += [hex(int(bin_str, 2))[2:]]
882 | else:
883 | res += [val_str]
884 |
885 | return res
886 |
887 |
888 | def digital_to_macro(self, val_list, macro_map):
889 | res = []
890 |
891 | for i in val_list:
892 | bin_str = i
893 | val_str = ""
894 |
895 | if bin_str[0] == 'z' or bin_str[0] == 'x':
896 | res += [bin_str]
897 | continue
898 |
899 | if i[0] == 'b':
900 | bin_str = i[1:]
901 |
902 | if bin_str[0] == 'z' or bin_str[0] == 'x':
903 | res += [bin_str]
904 | continue
905 |
906 | val_str = macro_map.get(int(bin_str, 2))
907 |
908 | if (val_str == None):
909 | res += [hex(int(bin_str, 2))[2:]]
910 | else:
911 | res += [val_str]
912 |
913 | return res
914 |
915 |
916 | def disasm_data(self, value, arch_mode = None):
917 | value_bytes = value.to_bytes(length = 4, byteorder = 'little', signed = False)
918 | md = Cs(self.CS_ARCH, self.CS_MODE)
919 |
920 | if arch_mode:
921 | md = Cs(arch_mode[0], arch_mode[1])
922 |
923 | disasm_res = md.disasm(value_bytes, 0)
924 | res = ""
925 |
926 | for i in disasm_res: # the first instruction
927 | res = "%s %s" % (i.mnemonic, i.op_str)
928 |
929 | return res
930 |
931 | return res
932 |
933 | def show_sig(self):
934 | width = os.get_terminal_size().columns
935 | height = os.get_terminal_size().lines
936 | side_w = len("T=%d" % self.t)
937 |
938 |
939 | for i in self.spy_sig_list:
940 | name_w = len(i[0].name)
941 |
942 | if name_w > side_w:
943 | side_w = name_w
944 |
945 |
946 | for j in self.marker_list:
947 | marker_w = len(j[0])
948 |
949 | if marker_w > side_w:
950 | side_w = marker_w
951 |
952 |
953 | max_sig_w = 4
954 |
955 | for i in self.spy_sig_list:
956 | sig_w = 0
957 |
958 | if isinstance (i[3], tuple): # need disasm
959 | sig_w = 24
960 | elif isinstance (i[3], dict): # macro dict
961 | sig_w = max([len(p) for p in i[3].values()])
962 | elif i[2] == DISP_FORMAT.a:
963 | sig_w = i[0].width + 2
964 | elif i[2] == DISP_FORMAT.b:
965 | sig_w = i[0].width + 2
966 | elif i[2] == DISP_FORMAT.o or i[2] == DISP_FORMAT.d:
967 | sig_w = int((i[0].width + 2) / 3) + 2
968 | else: # signed / float / others
969 | sig_w = ((i[0].width + 3) >> 2) + 2
970 |
971 | if sig_w > max_sig_w:
972 | max_sig_w = sig_w
973 |
974 | side_w += 3
975 |
976 | if (side_w + max_sig_w) > width:
977 | print("The terminal is too small: %d X %d, width >= %d is required." % (width, height, side_w + max_sig_w))
978 |
979 | return
980 |
981 | tmax = int((width - side_w) / max_sig_w)
982 | t_list = ["T=%d" % self.t]
983 |
984 | for i in range(tmax):
985 | t_list += ["%d" % i]
986 |
987 | # display the title (T)
988 | t_str = self.align_sig(side_w, max_sig_w, t_list, (255, 255, 255), None, 0)
989 | print("-" * len(t_str))
990 | print(t_str)
991 | print("-" * len(t_str))
992 |
993 | # display the signal
994 | for i in self.spy_sig_list:
995 | v = i[0]
996 | sig_time_val_list = None
997 | sfl_tmp = self.shadow_for_logic
998 |
999 | if isinstance(v.vcdId, list):
1000 | sig_time_val_list = v.vcdId
1001 | elif isinstance(v.vcdId, str):
1002 | sig_time_val_list = self.vcd.idcode2series[v.vcdId]
1003 |
1004 | val_list = self.search_val(tmax, sig_time_val_list)
1005 | fmt = i[2]
1006 |
1007 | if isinstance (i[3], tuple): # need disasm
1008 | val_list = self.digit_to_instr(val_list, i[3])
1009 | elif isinstance (i[3], dict): # macro dict
1010 | self.shadow_for_logic = False
1011 | val_list = self.digital_to_macro(val_list, i[3])
1012 | else:
1013 | val_list = self.digit_conv(val_list, fmt)
1014 |
1015 | suffix = '[H]'
1016 |
1017 | if fmt == DISP_FORMAT.a:
1018 | suffix = '[A]'
1019 | elif fmt == DISP_FORMAT.b:
1020 | suffix = '[B]'
1021 | elif fmt == DISP_FORMAT.o:
1022 | suffix = '[O]'
1023 | elif fmt == DISP_FORMAT.d:
1024 | suffix = '[D]'
1025 | elif fmt == DISP_FORMAT.f:
1026 | suffix = '[F]'
1027 | elif fmt == DISP_FORMAT.s:
1028 | suffix = '[S]'
1029 | elif fmt == DISP_FORMAT.m:
1030 | suffix = '[M]'
1031 |
1032 | sig_str = self.align_sig(side_w, max_sig_w, [v.name + suffix] + val_list, v.width, i[1][0], i[1][1], i[1][2])
1033 | self.shadow_for_logic = sfl_tmp
1034 | # print(style(sig_str, fg=i[1][0], bg=i[1][1], bold=i[1][2]))
1035 | print(render(sig_str, fg = i[1][0], bg = i[1][1], mode = i[1][2]))
1036 |
1037 | print("=" * len(t_str))
1038 |
1039 | # display the marker
1040 | marker_display_list = []
1041 |
1042 | for i in range((len(t_list))):
1043 | for j in self.marker_list:
1044 | if j[1] == i + self.t:
1045 | marker_display_list += [(i, j)]
1046 |
1047 | marker_output_str_list = [] # [(string0, current_layer0), ..., (stringN, current_layerN)]
1048 |
1049 | for i in marker_display_list:
1050 | if i[0] == 0:
1051 | marker_output_str_list += [(" " * side_w + render("\\", fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), 0)]
1052 | marker_output_str_list += [(" " * side_w + render("|", fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), 0)]
1053 | marker_output_str_list += [(render(i[1][0], fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]) + " " + render("-" * (side_w - len(i[1][0])), fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), 0)]
1054 | elif i[0] == (len(t_list) - 1):
1055 | for k in range(len(marker_output_str_list)):
1056 | append_str = "/"
1057 |
1058 | if k != 0:
1059 | append_str = "|"
1060 |
1061 | marker_output_str_list[k] = (marker_output_str_list[k][0] + " " * ((max_sig_w * (i[0] - marker_output_str_list[k][1]) - 2)) + render(append_str, fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), i[0])
1062 |
1063 | marker_output_str_list += [(render(i[1][0], fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]) + " " + render("-" * (side_w + max_sig_w * i[0] - len(i[1][0]) - 1), fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), i[0])]
1064 | else:
1065 | for k in range(len(marker_output_str_list)):
1066 | append_str = "/\\"
1067 |
1068 | if k != 0:
1069 | append_str = "||"
1070 |
1071 | marker_output_str_list[k] = (marker_output_str_list[k][0] + " " * ((max_sig_w * (i[0] - marker_output_str_list[k][1]) - 2)) + render(append_str, fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), i[0])
1072 |
1073 | marker_output_str_list += [(render(i[1][0], fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]) + " " + render("-" * (side_w + max_sig_w * i[0] - len(i[1][0])), fg = i[1][2][0], bg = i[1][2][1], mode = i[1][2][2]), i[0])]
1074 |
1075 | for i in marker_output_str_list:
1076 | print(i[0])
1077 |
1078 | return
1079 |
1080 | @cmd2.with_category(CUSTOM_CATEGORY)
1081 | @with_argparser(show_argparser)
1082 | def do_show(self, opts):
1083 | if len(self.spy_sig_list) == 0:
1084 | print("Please adding signal to display (T=%d)." % self.t)
1085 | return
1086 |
1087 | if opts.next:
1088 | val = 0
1089 | try:
1090 | val = int(opts.next)
1091 | except Exception as e:
1092 | print (e, ": Wrong parameter")
1093 | return
1094 |
1095 | self.t += val
1096 |
1097 | if self.t < 0:
1098 | self.t = 0
1099 |
1100 | if self.t > self.max_t:
1101 | self.t = self.max_t
1102 |
1103 | self.show_sig()
1104 |
1105 | return
1106 |
1107 |
1108 | @cmd2.with_category(CUSTOM_CATEGORY)
1109 | @with_argparser(add_argparser)
1110 | def do_add(self, opts):
1111 | if opts.word == "":
1112 | return
1113 |
1114 | mod = self.cur_mod.children
1115 |
1116 | fmt = DISP_FORMAT.h
1117 | foreground = (255, 255, 255)
1118 | background = None
1119 | mode = 0
1120 |
1121 | if opts.format == "a" or opts.format == "A" or opts.format == "ascii" or opts.format == "ASCII":
1122 | fmt = DISP_FORMAT.a
1123 | elif opts.format == "b" or opts.format == "B" or opts.format == "bin" or opts.format == "BIN":
1124 | fmt = DISP_FORMAT.b
1125 | elif opts.format == "o" or opts.format == "O" or opts.format == "oct" or opts.format == "OCT":
1126 | fmt = DISP_FORMAT.o
1127 | elif opts.format == "d" or opts.format == "D" or opts.format == "dec" or opts.format == "DEC":
1128 | fmt = DISP_FORMAT.d
1129 | elif opts.format == "h" or opts.format == "H" or opts.format == "hex" or opts.format == "HEX":
1130 | fmt = DISP_FORMAT.h
1131 | elif opts.format == "f" or opts.format == "F" or opts.format == "float" or opts.format == "FLOAT":
1132 | fmt = DISP_FORMAT.f
1133 | elif opts.format == "s" or opts.format == "S" or opts.format == "signed" or opts.format == "SIGNED":
1134 | fmt = DISP_FORMAT.s
1135 | elif opts.format == "" or opts.format == None:
1136 | fmt = DISP_FORMAT.h
1137 | else:
1138 | print("Error format:", opts.format)
1139 | return
1140 |
1141 | if opts.foreground:
1142 | fgVal = str2num(opts.foreground)
1143 |
1144 | if fgVal == None:
1145 | return
1146 |
1147 | foreground = ((fgVal >> 16) & 255, (fgVal >> 8) & 255, (fgVal >> 0) & 255)
1148 |
1149 | if opts.background:
1150 | bgVal = str2num(opts.background)
1151 |
1152 | if bgVal == None:
1153 | return
1154 |
1155 | background = ((bgVal >> 16) & 255, (bgVal >> 8) & 255, (bgVal >> 0) & 255)
1156 |
1157 | # random option overwrite the color setting value
1158 | if opts.foreground_random:
1159 | foreground = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1160 |
1161 | if opts.background_random:
1162 | background = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1163 |
1164 | if opts.mode:
1165 | modeVal = str2num(opts.mode)
1166 |
1167 | if modeVal == None:
1168 | return
1169 |
1170 | mode = modeVal
1171 |
1172 |
1173 | if opts.word == "*":
1174 | for k, v in mod.items():
1175 | if isinstance(v, VcdVarParsingInfo):
1176 | # (signal_object, (foreground_color, background_color, mode), macro_dictionary)
1177 | self.spy_sig_list += [(v, (foreground, background, mode), fmt, None)]
1178 |
1179 | return
1180 |
1181 | for k, v in mod.items():
1182 | if v.name == opts.word and isinstance(v, VcdVarParsingInfo):
1183 | self.spy_sig_list += [(v, (foreground, background, mode), fmt, None)]
1184 |
1185 | return
1186 |
1187 |
1188 | def complete_add(self, text, line, begidx, endidx):
1189 | complete_add_list = []
1190 |
1191 | if self.cur_mod != None:
1192 | for k, v in self.cur_mod.children.items():
1193 |
1194 | if isinstance(v, VcdVarParsingInfo):
1195 | complete_add_list += [v.name]
1196 |
1197 | return self.basic_complete(text, line, begidx, endidx, complete_add_list)
1198 |
1199 |
1200 | @cmd2.with_category(CUSTOM_CATEGORY)
1201 | @with_argparser(randc_argparser)
1202 | def do_randc(self, opts):
1203 | color_number = 1
1204 |
1205 | if opts.number != None:
1206 | color_number = str2num(opts.number)
1207 |
1208 | if color_number == None:
1209 | color_number = 1
1210 |
1211 | if color_number < 0:
1212 | color_number = 1
1213 |
1214 | if color_number > 100:
1215 | color_number = 99
1216 | print("[Warning] Exceed the limit of number (<= 100), set number as 100.")
1217 |
1218 | for i in range(color_number):
1219 | colorVal = random.randint(0, 256 * 256 * 256 - 1)
1220 | print("%2d. " % (i) + render(" ", bg = (((colorVal >> 16) & 255, (colorVal >> 8) & 255, (colorVal >> 0) & 255))) + " 0x%06x" % colorVal)
1221 |
1222 | return
1223 |
1224 |
1225 | @cmd2.with_category(CUSTOM_CATEGORY)
1226 | @with_argparser(precision_argparser)
1227 | def do_precision(self, opts):
1228 | self.precision = str2num(opts.word)
1229 |
1230 | return
1231 |
1232 | @cmd2.with_category(CUSTOM_CATEGORY)
1233 | @with_argparser(color_argparser)
1234 | def do_color(self, opts):
1235 | foreground = None
1236 | background = None
1237 | mode = None
1238 | index_list = []
1239 | index = None
1240 |
1241 | if opts.index:
1242 | index = str2num(opts.index)
1243 |
1244 | if index == None:
1245 | return
1246 |
1247 | foreground = self.spy_sig_list[index][1][0]
1248 | background = self.spy_sig_list[index][1][1]
1249 | mode = self.spy_sig_list[index][1][2]
1250 | elif opts.word:
1251 | j = 0
1252 |
1253 | for i in self.spy_sig_list:
1254 | if i[0].name == opts.word:
1255 | index_list += [j]
1256 |
1257 | j = j + 1
1258 |
1259 | if len(index_list) == 0:
1260 | print("Need the correct name of signal!")
1261 | return
1262 | else:
1263 | print("Need index of the signal to change its color!")
1264 | return
1265 |
1266 | if opts.foreground_random:
1267 | foreground = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1268 | elif opts.foreground:
1269 | fgVal = str2num(opts.foreground)
1270 |
1271 | if fgVal == None:
1272 | return
1273 |
1274 | foreground = ((fgVal >> 16) & 255, (fgVal >> 8) & 255, (fgVal >> 0) & 255)
1275 |
1276 | if opts.background_random:
1277 | background = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1278 | elif opts.background:
1279 | bgVal = str2num(opts.background)
1280 |
1281 | if bgVal == None:
1282 | return
1283 |
1284 | background = ((bgVal >> 16) & 255, (bgVal >> 8) & 255, (bgVal >> 0) & 255)
1285 |
1286 | if opts.mode:
1287 | modeVal = str2num(opts.mode)
1288 |
1289 | if modeVal == None:
1290 | return
1291 |
1292 | mode = modeVal
1293 |
1294 | if index != None:
1295 | self.spy_sig_list[index] = (self.spy_sig_list[index][0], (foreground, background, mode), self.spy_sig_list[index][2], self.spy_sig_list[index][3])
1296 |
1297 | for index in index_list:
1298 | if foreground == None:
1299 | foreground = self.spy_sig_list[index][1][0]
1300 |
1301 | if background == None:
1302 | background = self.spy_sig_list[index][1][1]
1303 |
1304 | if mode == None:
1305 | mode = self.spy_sig_list[index][1][2]
1306 |
1307 | self.spy_sig_list[index] = (self.spy_sig_list[index][0], (foreground, background, mode), self.spy_sig_list[index][2], self.spy_sig_list[index][3])
1308 |
1309 | return
1310 |
1311 |
1312 | @cmd2.with_category(CUSTOM_CATEGORY)
1313 | @with_argparser(marker_argparser)
1314 | def do_marker(self, opts):
1315 | index = None
1316 | time = None
1317 | index_list = []
1318 |
1319 | if opts.index:
1320 | index = str2num(opts.index)
1321 |
1322 | if index == None:
1323 | return
1324 |
1325 | if opts.time:
1326 | time = str2num(opts.time)
1327 |
1328 | j = 0
1329 |
1330 | for i in self.marker_list:
1331 | if i[0] == opts.word:
1332 | index_list += [j]
1333 |
1334 | j = j + 1
1335 |
1336 | if index != None:
1337 | index_list += [index]
1338 |
1339 | index_list.sort(reverse = True)
1340 |
1341 | if opts.delete:
1342 | for index in index_list:
1343 | if 0 <= index < len(self.marker_list):
1344 | del self.marker_list[index]
1345 |
1346 | return
1347 |
1348 | if opts.time:
1349 | ## !!! copy & paste
1350 | foreground = (255, 255, 0)
1351 | background = None
1352 | mode = 0
1353 |
1354 | if opts.foreground_random:
1355 | foreground = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1356 | elif opts.foreground:
1357 | fgVal = str2num(opts.foreground)
1358 |
1359 | if fgVal == None:
1360 | return
1361 |
1362 | foreground = ((fgVal >> 16) & 255, (fgVal >> 8) & 255, (fgVal >> 0) & 255)
1363 |
1364 | if opts.background_random:
1365 | background = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
1366 | elif opts.background:
1367 | bgVal = str2num(opts.background)
1368 |
1369 | if bgVal == None:
1370 | return
1371 |
1372 | background = ((bgVal >> 16) & 255, (bgVal >> 8) & 255, (bgVal >> 0) & 255)
1373 |
1374 | if opts.mode:
1375 | modeVal = str2num(opts.mode)
1376 |
1377 | if modeVal == None:
1378 | return
1379 | ## !!! copy & paste
1380 |
1381 | mid = 0
1382 | flag = False
1383 |
1384 | for mk in self.marker_list:
1385 | if (mk[0] == opts.word) or (mk[1] == time):
1386 | flag = True
1387 | break
1388 |
1389 | mid = mid + 1
1390 |
1391 | if flag:
1392 | self.marker_list[mid] = (opts.word, time, (foreground, background, mode)) # (name, time, (fg, bg, mode))
1393 | else:
1394 | self.marker_list += [(opts.word, time, (foreground, background, mode))] # (name, time, (fg, bg, mode))
1395 |
1396 | if opts.list or ((opts.index == None) and ((opts.word == None) or (opts.word == ""))):
1397 | j = 0
1398 |
1399 | for i in self.marker_list:
1400 | print("[%5d] %-20d: " % (j, i[1]) + render(i[0], fg = i[2][0], bg = i[2][1], mode = i[2][2]))
1401 | j += 1
1402 |
1403 |
1404 | @cmd2.with_category(CUSTOM_CATEGORY)
1405 | def do_del(self, opts):
1406 | if opts == "":
1407 | return
1408 |
1409 | mod = self.cur_mod.children
1410 |
1411 | if opts == "*":
1412 | self.spy_sig_list = []
1413 |
1414 | return
1415 |
1416 | new_list = []
1417 |
1418 | for i in self.spy_sig_list:
1419 | if i[0].name != opts:
1420 | new_list += [i]
1421 |
1422 | self.spy_sig_list = new_list
1423 |
1424 | return
1425 |
1426 |
1427 | def complete_del(self, text, line, begidx, endidx):
1428 | complete_del_list = []
1429 |
1430 | for i in self.spy_sig_list:
1431 | complete_del_list += [i[0].name]
1432 |
1433 | return self.basic_complete(text, line, begidx, endidx, complete_del_list)
1434 |
1435 |
1436 | @cmd2.with_category(CUSTOM_CATEGORY)
1437 | def do_conv(self, opts): # convert number
1438 | val = 0
1439 |
1440 | if opts.isdigit() == False:
1441 | if len(opts) <= 2:
1442 | print("Invalid number:", opts)
1443 | return
1444 |
1445 | try:
1446 | if opts[0:2] == '0x':
1447 | val = int(opts[2:], 16)
1448 | elif opts[0:2] == '0b':
1449 | val = int(opts[2:], 2)
1450 | elif opts[0:2] == '0o':
1451 | val = int(opts[2:], 8)
1452 | else:
1453 | print("Invalid number:", opts)
1454 | return
1455 | except Exception as e:
1456 | print("Invalid number:", opts)
1457 | return
1458 | else:
1459 | val = int(opts)
1460 |
1461 | print("BIN:", bin(val)[2:])
1462 | print("OCT:", oct(val)[2:])
1463 | print("DEC:", val)
1464 | print("HEX:", hex(val)[2:])
1465 |
1466 | return
1467 |
1468 | @cmd2.with_category(CUSTOM_CATEGORY)
1469 | def do_search(self, opts): # search condition
1470 | if opts[0] == "\"":
1471 | opts = opts[1:]
1472 |
1473 | if len(opts) < 1:
1474 | print ("Invalid expression:", "\"")
1475 |
1476 | if opts[-1] == "\"":
1477 | opts = opts[:-1]
1478 |
1479 | ex_ev = expr_eval()
1480 | global search_var_list
1481 | search_var_list = [] # clear the list
1482 | ex_ev.parse(opts)
1483 |
1484 | if len(search_var_list) == 0: # no signal name in expression
1485 | res = 0
1486 |
1487 | try:
1488 | res = ex_ev.eval()
1489 | except Exception as e:
1490 | print ("Invalid expression:", opts)
1491 | return
1492 |
1493 | if res != 0:
1494 | print("[0, +inf)")
1495 |
1496 | return
1497 |
1498 | flag = False
1499 | time_point_for_search = set()
1500 | var_val_list_dict = dict()
1501 |
1502 | for i in search_var_list:
1503 | flag = False
1504 |
1505 | for j in self.spy_sig_list:
1506 | if j[0].name == i:
1507 | flag = True
1508 | sig_time_val_list = None
1509 |
1510 | if isinstance(j[0].vcdId, list):
1511 | sig_time_val_list = j[0].vcdId
1512 | elif isinstance(j[0].vcdId, str):
1513 | sig_time_val_list = self.vcd.idcode2series[j[0].vcdId]
1514 |
1515 | for k in sig_time_val_list:
1516 | time_point_for_search.add(k[0])
1517 |
1518 | var_val_list_dict[i] = sig_time_val_list
1519 | break
1520 |
1521 | if i == "@t" or i == "@T":
1522 | continue
1523 |
1524 | if flag == False:
1525 | print("Please add signal \"%s\" first." % (i))
1526 | return
1527 |
1528 | begin_point = 0
1529 | eval_nonzero = False
1530 | res_field = []
1531 | time_point_for_search = sorted(time_point_for_search)
1532 |
1533 | for i in time_point_for_search:
1534 | var_val_dict = {} # var value in a certain time point
1535 | var_val_dict["@t"] = i # @t == time point
1536 | var_val_dict["@T"] = i
1537 |
1538 | for (k, v) in var_val_list_dict.items():
1539 | index = bisect.bisect(v, i, hi = len(v), key = lambda X : X[0])
1540 |
1541 | if index == 0:
1542 | var_val_dict[k] = 0
1543 | else:
1544 | bin_str = v[index - 1][1]
1545 |
1546 | if bin_str[0] == 'b':
1547 | bin_str = bin_str[1:]
1548 |
1549 | if bin_str[0] == 'z' or bin_str[0] == 'x':
1550 | # print("Need to handle x and z in search, value name: %s!" % k)
1551 | var_val_dict[k] = bin_str[0]
1552 | continue
1553 |
1554 | var_val_dict[k] = int(bin_str, 2)
1555 |
1556 | ex_ev.set_var_val_dict(var_val_dict)
1557 | eval_res = ex_ev.eval()
1558 |
1559 | if eval_res != 0: # satisfy
1560 | if eval_nonzero == False:
1561 | eval_nonzero = True
1562 | begin_point = i
1563 | else: # eval_res == 0
1564 | if eval_nonzero == True:
1565 | res_field.append((begin_point, i))
1566 | eval_nonzero = False
1567 |
1568 | if eval_nonzero == True:
1569 | res_field.append((begin_point, -1)) # begin_point, +inf
1570 |
1571 | print_str = ""
1572 |
1573 | for i in res_field:
1574 | bp = i[0]
1575 | ep = i[1]
1576 |
1577 | if ep != -1:
1578 | print_str += "[%d, %d) " % (bp, ep)
1579 | else:
1580 | print_str += "[%d, +inf)" % (bp)
1581 |
1582 | print(print_str)
1583 |
1584 | return
1585 |
1586 |
1587 | @cmd2.with_category(CUSTOM_CATEGORY)
1588 | def do_reorder(self, opts):
1589 | new_order_str = opts.split(" ")
1590 | spy_list_len = len(self.spy_sig_list)
1591 | new_order_num = []
1592 | ori_order_num = [i for i in range(spy_list_len)]
1593 |
1594 | for i in new_order_str:
1595 | try:
1596 | val = int(i)
1597 |
1598 | if val < -spy_list_len or val >= spy_list_len:
1599 | print("Argument out of index:", i)
1600 |
1601 | return
1602 |
1603 | new_order_num.append(val)
1604 | ori_order_num[val] = spy_list_len
1605 | except Exception as e:
1606 | print(e, ": Wrong parameter")
1607 |
1608 | return
1609 |
1610 |
1611 | for i in ori_order_num:
1612 | if i != spy_list_len:
1613 | new_order_num.append(i)
1614 |
1615 | new_spy_sig_list = []
1616 |
1617 | for i in new_order_num:
1618 | new_spy_sig_list.append(self.spy_sig_list[i])
1619 |
1620 | self.spy_sig_list = new_spy_sig_list
1621 | return
1622 |
1623 |
1624 | def str_to_int(self, val_str):
1625 | val = 0
1626 |
1627 | if val_str.isdigit() == False:
1628 | if len(val_str) <= 2:
1629 | print("Invalid number:", val_str)
1630 | return
1631 |
1632 | try:
1633 | if val_str[0:2] == '0x':
1634 | val = int(val_str[2:], 16)
1635 | elif val_str[0:2] == '0b':
1636 | val = int(val_str[2:], 2)
1637 | elif val_str[0:2] == '0o':
1638 | val = int(val_str[2:], 8)
1639 | else:
1640 | print("Invalid number:", val_str)
1641 | return
1642 | except Exception as e:
1643 | print("Invalid number:", val_str)
1644 | return
1645 | else:
1646 | val = int(val_str)
1647 |
1648 | return val
1649 |
1650 |
1651 | @cmd2.with_category(CUSTOM_CATEGORY)
1652 | @with_argparser(mg_argparser)
1653 | def do_mg(self, opts):
1654 | if opts.macro != None:
1655 | macro_list = opts.macro.split('&')
1656 | else:
1657 | macro_list = []
1658 |
1659 | if opts.value != None:
1660 | macro_value = opts.value.split('&')
1661 | else:
1662 | macro_value = []
1663 |
1664 | if len(macro_list) != len(macro_value):
1665 | print("Mismatch macro and value!")
1666 |
1667 | return
1668 | elif len(macro_list) == 0 and len(macro_value) == 0:
1669 | for i in self.macro_map:
1670 | print(i, ":", self.macro_map[i])
1671 |
1672 | return
1673 | elif len(macro_list) == 0:
1674 | print("No macro:", opts.macro)
1675 |
1676 | return
1677 | elif len(macro_value) == 0:
1678 | print("No value:", opts.value)
1679 |
1680 | return
1681 |
1682 | value_list = []
1683 |
1684 | for i in macro_value:
1685 | value_list += [self.str_to_int(i)]
1686 |
1687 | if len(macro_list) != len(value_list):
1688 | print("Mismatch macro and value!")
1689 |
1690 | return
1691 |
1692 | self.macro_map[opts.name] = {}
1693 |
1694 | for i, j in zip(macro_list, value_list):
1695 | self.macro_map[opts.name][j] = i
1696 |
1697 | print(opts.name, ":", self.macro_map[opts.name])
1698 |
1699 | return
1700 |
1701 | @cmd2.with_category(CUSTOM_CATEGORY)
1702 | @with_argparser(bm_argparser)
1703 | def do_bm(self, opts):
1704 | if self.macro_map.get(opts.name) == None:
1705 | print("No such macro group:", opts.name)
1706 |
1707 | return
1708 |
1709 | index = 0
1710 | bm_index_list = []
1711 |
1712 | for i in self.spy_sig_list:
1713 | if i[0].name == opts.signal_name:
1714 | bm_index_list += [index]
1715 |
1716 | index += 1
1717 |
1718 | for i in bm_index_list:
1719 | self.spy_sig_list[i] = self.spy_sig_list[i][:2] + (DISP_FORMAT.m, self.macro_map[opts.name], ) + self.spy_sig_list[i][4:]
1720 | print(i, ":", opts.signal_name, "<>", opts.name)
1721 |
1722 | if len(bm_index_list) == 0:
1723 | print("No such signal:", opts.signal_name)
1724 |
1725 | return
1726 |
1727 | @cmd2.with_category(CUSTOM_CATEGORY)
1728 | @with_argparser(bd_argparser)
1729 | def do_bd(self, opts):
1730 | cs_arch = 0
1731 | cs_mode = 0
1732 |
1733 | if opts.architecture == 'rv32' or opts.architecture == 'RV32':
1734 | cs_arch = CS_ARCH_RISCV
1735 | cs_mode = CS_MODE_RISCV32
1736 | elif opts.architecture == 'rv64' or opts.architecture == 'RV64':
1737 | cs_arch = CS_ARCH_RISCV
1738 | cs_mode = CS_MODE_RISCV64
1739 | else:
1740 | print("Not support such architecture:", opts.architecture)
1741 |
1742 | return
1743 |
1744 | index = 0
1745 | bm_index_list = []
1746 |
1747 | for i in self.spy_sig_list:
1748 | if i[0].name == opts.signal_name:
1749 | bm_index_list += [index]
1750 |
1751 | index += 1
1752 |
1753 | for i in bm_index_list:
1754 | self.spy_sig_list[i] = self.spy_sig_list[i][:2] + (DISP_FORMAT.m, (cs_arch, cs_mode), ) + self.spy_sig_list[i][4:]
1755 | print(i, ":", opts.signal_name, "<>", opts.architecture)
1756 |
1757 | if len(bm_index_list) == 0:
1758 | print("No such signal:", opts.signal_name)
1759 |
1760 | return
1761 |
1762 |
1763 | @cmd2.with_category(CUSTOM_CATEGORY)
1764 | @with_argparser(disasm_argparser)
1765 | def do_disasm(self, opts):
1766 | val = 0
1767 | cs_mode = self.CS_MODE
1768 | cs_arch = self.CS_ARCH
1769 |
1770 | if opts.word.isdigit() == False:
1771 | if len(opts.word) <= 2:
1772 | print("Invalid input:", opts.word)
1773 | return
1774 |
1775 | try:
1776 | if opts.word[0:2] == '0x':
1777 | val = int(opts.word[2:], 16)
1778 | elif opts.word[0:2] == '0b':
1779 | val = int(opts.word[2:], 2)
1780 | elif opts.word[0:2] == '0o':
1781 | val = int(opts.word[2:], 8)
1782 | else:
1783 | print("Invalid input:", opts.word)
1784 | return
1785 | except Exception as e:
1786 | print("Invalid input:", opts.word)
1787 | return
1788 | else:
1789 | val = int(opts.word)
1790 |
1791 | if opts.architecture == "rv32" or opts.architecture == "RV32":
1792 | self.CS_ARCH = CS_ARCH_RISCV
1793 | self.CS_MODE = CS_MODE_RISCV32
1794 | elif opts.architecture == "rv64" or opts.architecture == "RV64":
1795 | self.CS_ARCH = CS_ARCH_RISCV
1796 | self.CS_MODE = CS_MODE_RISCV64
1797 |
1798 | instr = self.disasm_data(val)
1799 | self.CS_MODE = cs_mode
1800 | self.CS_ARCH = cs_arch
1801 | print(instr)
1802 |
1803 | return
1804 |
1805 |
1806 | @cmd2.with_category(CUSTOM_CATEGORY)
1807 | @with_argparser(save_argparser)
1808 | def do_save(self, opts):
1809 | fp = ".vsh_start-" + datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
1810 |
1811 | if opts.word != None:
1812 | if os.path.exists(opts.word):
1813 | print("File already exists:", opts.word)
1814 | return
1815 | else:
1816 | fp = opts.word
1817 |
1818 | res_str = ''
1819 |
1820 | for i in self.history:
1821 | res_str += str(i) + '\n'
1822 |
1823 | with open(fp, 'w', encoding="utf-8") as f:
1824 | f.write(res_str)
1825 |
1826 | return
1827 |
1828 | #########################################################################
1829 | @cmd2.with_category(CUSTOM_CATEGORY)
1830 | def do_exit(self, opts):
1831 | sys.exit(0)
1832 |
1833 |
1834 | if __name__ == '__main__':
1835 | app = vsh()
1836 | # app.onecmd("alias create save history \"|\" sed \'s/^ *[0-9]*[ ]*//\' \">\" .vsh_start_$(date +\"%Y_%m_%d_%H_%M_%S\")")
1837 | # app.onecmd("alias create n show -n 1")
1838 | # app.onecmd("alias create p show -n -1")
1839 | app.cmdloop()
1840 |
--------------------------------------------------------------------------------