Rocket - debug - Example: Read Memory
https://mp.weixin.qq.com/s/ChXNTbx94WDC72GvmE9bGA
介绍riscv-debug的使用实例:使用三种方法读取内存。
1. Using System Bus Access
1) System Bus Access
除了抽象命令,Program Buffer之外,调试模块可以包含一个系统总线访问模块,以在不依赖核心的情况下,访问系统总线(使用物理地址):
访问大小可以是8/16/32/64/128位:
需要自己保证访问的缓存一致性:
2) sbcs/sbaddress/sbdata
a. sbcs
用于控制系统总线访问,以及获取访问状态:
b. sbaddress0..3
存储要访问的系统总线物理地址。
写sbaddress寄存器可能触发对该地址的读操作:
c. sbdata0..3
保存读取和要写入的数据。
读sbdata0寄存器可能触发系统总线的读操作:
写sbdata0寄存器可能触发系统总线的写操作:
3) 实例:Read a word from memory
A. 写sbcs寄存器:
a. sbaccess=2:访问大小为32bit;
b. sbreadonaddr=1:every write to sbaddress0 automatically triggers a system bus read at the new address.
B. 写sbaddress0寄存器:写入要访问的内存物理地址;由于A中把sbreadonaddr置位,所以这一步写sbaddress0寄存器会触发对刚写入的这个内存地址的读操作,读取的内容存放在sbdata0寄存器中;
C. 读sbdata0寄存器,获取目标内存地址处的内容;
4) 实例:Read block of memory
A. 写sbcs寄存器:
a. sbaccess=2:访问大小为32bit;
b. sbreadonaddr=1:every write to sbaddress0 automatically triggers a system bus read at the new address.
c. sbreadondata=1:every read from sbdata0 automatically triggers a system bus read at the (possibly auto-incremented) address.
d. sbautoincrement=1:sbaddress is incremented by the access size (in bytes) selected in sbaccess after every system bus access.
B. 写sbaddress0寄存器:写入要读取的内存的物理地址;这个写入动作会触发针对目标地址的读取操作,读取的内容存放在sbdata0寄存器;读取之后sbaddress0中的内存地址自动增加4个字节;
C. 读sbdata0寄存器:读取目标地址处的内容;这个读取动作会触发针对sbaddress0中地址的读取动作,读取的内容存放在sbdata0寄存器中,读取之后sbaddress0中的内存地址自动增加4个字节;
D. 连续读取sbdata0寄存器,以获取目标内存地址的内容;
E. 写sbcs寄存器:sbcs=0,亦即sbreadondata=0,下一次读取sbdata0时,不会再出发针对sbaddress0中地址的读取动作;
F. 读sbdata0寄存器:获取最后一个需要的内存数据;
2. Using Program Buffer
1) abstractauto
用于触发抽象命令自动执行的配置寄存器,两种触发方式及配置:
a. 修改Program Buffer;
b. 读取sbdata寄存器;
2) 实例:Read a word from memory
A. 准备Program Buffer:
a. 写progbuf0为指令:lw s0 0(s0),即读取s0中地址的内容,存入s0中;
b. 写progbuf1为指令:ebreak,即停止执行,返回调试环境;
B. 写data0寄存器:存入要读取的目标内存地址;
C. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. write=1:访问操作为写操作,即把sbdata0寄存器中的数据写入到寄存器s0中;
c. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
D. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. (补)transfer=1:Do the operation specied by write;
c. write=0:即访问操作为读操作;Copy data from the specified register into arg0 portion of data;
E. 读data0寄存器:读取从s0拷贝过来的数据,即目标内存地址处的内容;
3) 实例:Read block of memory
A. 准备Program Buffer:
a. 写progbuf0为指令:lw s1, 0(s0),即读取s0中地址的内容,存入s1中;
b. 写progbuf1为指令:addi s0, s0, 4,即地址增加4;
c. 写progbuf2为指令:ebreak,即停止执行,返回调试环境;
B. 写data0寄存器:写入目标内存起始地址;
C. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. write=1:访问操作为写操作,即把sbdata0寄存器中的数据写入到寄存器s0中;
c. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
该命令的效果如下:
a. 把data0中的目标内存地址,写入到s0寄存器;
b. 触发Program Buffer执行;
D. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1009:即访问的对象寄存器为s1;
b. (补)transfer=1:Do the operation specied by write;
c. write=0:即访问操作为读操作;Copy data from the specified register into arg0 portion of data;
d. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
该命令的效果如下:
a. 把s1的值读入data0寄存器;
b. 触发Program Buffer执行;
E. 写abstractauto寄存器:
a. autoexecdata=1:read or write accesses to the corresponding data word cause the command in command to be executed again.
效果是:每次读写data0寄存器都会触发D中命令的执行;
F. 读data0寄存器:
a. 获取目标内存地址处的值;
b. 触发抽象命令的执行:把s1的值读入data0寄存器;
c. 触发Program Buffer执行:读取s0中地址的内容并写入s1,s0中的地址加4;
G. 读data0寄存器:触发连续读取;
H. 写abstractauto寄存器:
a. autoexecdata=0:读取data0寄存器,不会触发抽象命令的执行;
I. 读data0寄存器:获取最后一个数据;
3. Using Abstract Memory Access
1) Access Memory
抽象命令的一种:
其格式如下:
其中:
aam前缀的意义是:Abstract command Access Memory;相较之下,
aar前缀的意义是:Abstract command Access Register;
2) 实例:Read a word from memory
A. 写data1寄存器:存入目标内存地址;
B. 写command寄存器:存入要执行的抽象命令:
a. cmdtype=2:表示命令的类型为Access Memory;
b. aamsize=2:Access the lowest 32 bits of the memory location.
c. aamvirtual=0:Addresses are physical (to the hart they are performed on).
d. write=0:Copy data from the memory location specified in arg1 into arg0 portion of data.
这条命令的效果是:读取data1中地址的内容,并存入data0寄存器;
C. 读data0寄存器:获取从内存地址中读到的内容;
3) 实例:Read block of memory
这里只介绍要点:
a. abstractauto=1:读取data0寄存器后,触发抽象命令执行;
b. aampostincrement=1:After a memory access has completed, if this bit is 1, increment arg1 (which contains the address used) by the number of bytes encoded in aamsize. 即每次读取内存之后,都把目标内存地址加4,即data1寄存器的值加4;
Rocket - debug - Example: Read Memory的更多相关文章
- Rocket - debug - Example: Write Memory
https://mp.weixin.qq.com/s/on1LugO9fTFJstMes3T2Xg 介绍riscv-debug的使用实例:使用三种方法写内存. 1. Using System Bus ...
- Xcode6 运行程序后,右侧Debug区域的Memory显示空白解决方法
http://chenyh-blog.com/%E8%9B%8B%E7%96%BC%E7%9A%84%E5%86%85%E5%AD%98-%E7%AC%AC%E4%B8%89%E7%AF%87-sdw ...
- Rocket - debug - TLDebugModuleInner - Hart Bus Access
https://mp.weixin.qq.com/s/deNMEyJ1idJDVoZwwo0A1A 简单介绍TLDebugModuleInner中核心总线访问(Hart Bus Access). 参考 ...
- Rocket - debug - Example: Triggers
https://mp.weixin.qq.com/s/zPNyrBOhsytkRrZTDTEvpw 介绍riscv-debug的使用实例:配置Triggers功能. 1. Trigger Trigge ...
- Rocket - debug - Periphery
https://mp.weixin.qq.com/s/uGxn-Xec0LkwdaSsCtQBvw 简单介绍Periphery的实现. 1. ExportDebugDMI/ExportDebugJTA ...
- Rocket - debug - DebugTransport
https://mp.weixin.qq.com/s/EcsuTjb4hFF9Ncig9Gfhew 简单介绍DebugTransport的实现. 1. JtagDTMConfig 1) JtagDTM ...
- Rocket - debug - TLDebugModule
https://mp.weixin.qq.com/s/EhUb1z5oiIw6dJ-90ifDJA 简单介绍TLDebugModule中的实现. 1. device device是一个设备描述符,包含 ...
- Rocket - debug - TLDebugModuleInner - ROM Generation
https://mp.weixin.qq.com/s/j_CgHU4PnY82NMwJzOqHYg 简单介绍Variable ROM Generation. 1. jalAbstract jalAbs ...
- Rocket - debug - Example: DMI
https://mp.weixin.qq.com/s/7suuJ7m2BKCpsHk1K2FzJQ 介绍riscv-debug的使用实例:如何使用DMI. 1. dm Debug Module实现了调 ...
随机推荐
- C. Two Arrays(思维DP或组合数学)
\(首先很容易想到一个O(n^4m)的DP\) \(设dp\ [i]\ [j]\ [q]\ 为长度i,a数组以j结尾,b数组以q结尾(q>=j)\) for(int i=1;i<=n;i+ ...
- 一次内核 crash 的排查记录
一次内核 crash 的排查记录 使用的发行版本是 CentOS,内核版本是 3.10.0,在正常运行的情况下内核发生了崩溃,还好有 vmcore 生成. 准备排查环境 crash 内核调试信息rpm ...
- Vue + Element-ui实现后台管理系统(2)---项目搭建 + ⾸⻚布局实现
项目搭建 + ⾸⻚布局实现 上篇对该项目做了个总述 :Vue + Element-ui实现后台管理系统(1) --- 总述 这篇主要讲解 项目搭建 + 后台⾸⻚布局实现 : 整体效果 后台首页按布局一 ...
- 【Linux基础总结】Linux基本环境
Linux基本环境 对Linux的基础认识 虚拟机进入终端: [root@hadoop-senior Desktop] # 用户名 主机名 所在目录名称 #:表示当前用户属于root用户,超级管理员用 ...
- JDBC12 ORM01 Object[]存放一条记录
ORM(Object Relationship Mapping)的基本思想 -表结构跟类对应:表中的字段和类的属性对应:表中记录和对象对应 让JavaBean的属性名和类型尽量和数据库保持一致 一条记 ...
- Android 组件间通信--事件驱动
在android中,组件间通信常用的方式: 1.使用广播机制:在主页面中监听特定的广播事件,进行业务逻辑的操作,其他页面只需要根据需求发送广播即可 例如:常用app结构中,左边通常为菜单栏,点击菜单栏 ...
- Vuser发生器
一.脚本开发过程: 1.计划:收集测试信息,整理业务逻辑,制定测试计划 2.录制脚本: 新建脚本---选择脚本协议(单协议脚本:多协议脚本:最近使用过协议)选择协议---开始录制脚本 脚本录制时,Vu ...
- 「雕爷学编程」Arduino动手做(11)——金属触摸模块
37款传感器和模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的.鉴于本人手头积累了一些传感器与模块,依照实践出真知(动手试试)的理念,以学习和交流为目的,这里准备 ...
- 使用react的一点提醒17/10/26
1.不直接操作dom 今天在和同学讨论的时候,发现了一些以前没注意的问题. 这段时间自己学习时一直都是用原生js写代码,但是以前在公司经常使用jq,也不知不觉间让我习惯了操作dom的倾向. 使用vue ...
- 在由N个元素构成的集合S中,找出最小元素C,满足C=A-B,其中A,B是都集合S中的元素,没找到则返回-1
package bianchengti; /* * 在由N个元素构成的集合S中,找出最小元素C,满足C=A-B, * 其中A,B是都集合S中的元素,没找到则返回-1 */ public class f ...