已经了解了,CortexM0只有一个AHB-lite master,没有bus matrix
接下来还需要弄清decoder和AHB-lite的关系
目录
AHB salve multiplexer:反馈给master
AHB协议
bus interconnection
CMSDK提供的IP
AHB emample slave
提供了ahb interface 以及slave reg
需要改动的地方
decoder:产生一个sel信号
AHB salve multiplexer:反馈给master
具体步骤
理解cmsdk example slave代码
添加到rtl目录中
vcs的filelist常用的选项
-y 选项:在该目录下查找模块
-y <directory_pathname>
Specifies a Verilog library directory to search for module definitions.也就是将模块的定义放在这个地方
举例:
-y ../../../logical/cmsdk_apb_timer/verilog
在这个目录下存放的就是cmsdk_apb_timer.v模块
+incdir+选项:在该目录下查找`inlcude *****包含的文件
+incdir+<directory>
Specifies the directories that contain the files you specified with
the `include compiler directive. You can specify more that one
directory, separating each path name with the + character.举例:
+incdir+../verilog
在这个目录下查找模块中`include 包含的文件
+libext+选项:指定搜索的扩展名,使用-y选项的时候使用
+libext+<extension>
Specifies that VCS only search the source files in a Verilog library
directory with the specified extension. You can specify more than one
extension, separating each extension with the + character.
For example, +libext++.v specifies searches library files with no
extension and library files with the .v extension.
Enter this option when you enter the -y option.举例:
+libext+.v+.vlib
-y选项搜索的文件扩展名为.v文件
添加到filelist
首先将该该IP复制然后修改名称
然后在filelist文件中添加(可以手动添加文件,此时需要将三个.v文件都手动添加)
-y ../../../logical/cmsdk_ahb_eg_slave_my/verilog
修改Decoder
Abstract : This module performs the address decode of the HADDR from the
CPU and generates the HSELs' for each of the target peripherals.
M0地址空间分配
这是M0推荐的地址空间分配
已经分配的地址空间为:
所以分配0xA000_0000~0xA000_0FFF(4K地址空间)
代码编写
在相应的位置添加如下代码
修改 slave mux
顶层模块修改
修改slave mux
参数
输入输出端口
修改decoder
参数定义
传参数
输入输出端口
例化example ahb slave
信号添加
哈哈,然后make compile进行编译,会发现有一些语法上面的错误,但是思路上是正确的~~~,把语法改变就可以了~~~
这样样例example slave就集成好了~~