码迷,mamicode.com
首页 > 其他好文 > 详细

Rocket - debug - Example: Write Memory

时间:2019-11-17 23:41:24      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:res   图片   ram   ati   表示   执行   bst   example   ack   

https://mp.weixin.qq.com/s/on1LugO9fTFJstMes3T2Xg

 

介绍riscv-debug的使用实例:使用三种方法写内存。

 

1. Using System Bus Access

 

1) Write a word to memory

 

技术图片

A. 写sbaddress0寄存器:写入目标内存地址;

B. 写sbdata0寄存器:写入要写入目标内存地址处的值;触发写内存动作:

技术图片

 

2) Write a block of memory

 

技术图片

A. 写sbcs寄存器:

a. sbaccess=2:访问大小是32bit;

b. sbautoincrement=1:sbaddress is incremented by the access size (in bytes) selected in sbaccess after every system bus access;

 

B. 写sbaddress0寄存器:写入目标内存地址;

C. 写sbdata0寄存器:写入要写入目标内存地址处的值;触发写内存动作;

D. 写sbdata0寄存器:写入要写入目标内存地址处的值;触发写内存动作;

E. 如此即可逐个把数据写入内存;

 

2. Using Program Buffer

 

1) Write a word to memory

 

技术图片

A. 准备好Program Buffer:把寄存器s1中的数据写入寄存器s0中的内存地址中;

B. 写data0寄存器:写入目标内存地址;

C. 写command寄存器:写入要执行的抽象命令:把data0寄存器的值拷贝到寄存器s0中;

D. 写data0寄存器:写入待存数据;

E. 写command寄存器:写入要执行的抽象命令:

a. 把data0中的值拷贝到s1中;

b. postexec=1:执行完抽象命令之后,触发Program Buffer的执行;

 

2) Write a block of memory

 

技术图片

A. 准备好Program Buffer:把寄存器s1中的数据写入寄存器s0中的内存地址中,然后把s0中的地址加4;

B. 写data0寄存器:写入目标内存地址;

C. 写command寄存器:写入要执行的抽象命令:把data0寄存器的值拷贝到寄存器s0中;

D. 写data0寄存器:写入待写数据;

E. 写command寄存器:写入要执行的抽象命令:

a. 把data0中的值拷贝到s1中;

b. postexec=1:执行完抽象命令之后,触发Program Buffer的执行;

 

F. 写abstractauto寄存器:读data0寄存器触发抽象命令的执行;

a. autoexecdata=1: When a bit in this field is 1, read or write accesses to the corresponding data word cause the command in command to be executed again.

 

G. 写data0寄存器:写入待写数据;触发抽象命令的执行;进而触发Program Buffer的执行;如此循环即可写入全部数据;

 

H. 最后清除abstractauto寄存器中的autoexecdata位;

 

3. Using Abstract Memory Access

 

1) Write a word to memory

 

技术图片

A. 写data1寄存器:存入目标内存地址;

B. 写data0寄存器:写入待存数据;

C. 写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=1:Copy data from arg0 portion of data into the memory location specified in arg1.

 

这条命令的效果是:把data0寄存器中的数据,写入data1中的地址中;

 

2) Write a block of memory

 

技术图片

这里只介绍一下要点:

a. aampostincrement=1:每次访问完内存之后,都把data1寄存器中的地址加4;

b. abstractauto.autoexecdata=1:读写data0寄存器会触发抽象命令的执行;

Rocket - debug - Example: Write Memory

标签:res   图片   ram   ati   表示   执行   bst   example   ack   

原文地址:https://www.cnblogs.com/wjcdx/p/11878997.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!