作者:葛兴
cortex-M0是ARM公司的一款开源内核,以低功耗著称,本文提纲挈领的讲述了用FPGA实现SOPC的流程。
1、开源核心
从头开始,在ARM官网上注册,下载ARM cortex M0的源代码以及大量的参考学习文献。

2、接口表
明确了cmsdk_mcu的系统接口表及其意义,列出了接口表。

3、内核研究
一方面明确了mcu_system的每一个pin脚的含义和用处,一方面也深入mcu_system内部,探究其内部的连接关系和数据/控制流。右图为mcu_system的I/O图。

事实上,在mcu_system内部,仍然有decode、gpio、subsystem、sysctrl等其他模块,核心是module CORTEXM0INTEGRATION。

4、AMBA总线
研究学习AMBA总线协议的规范。包括APB和AHB各个信号的名称及内涵、总线互联关系、总线操作方法、基本传输、传输类型、突发操作、控制信号、地址译码、从机传输相应、数据总线、总裁、复位等内容。

5、编写Verilog代码
参考相关资料,根据AMBA总线协议规范写了AHBDCD.v、AHBMUX.v、AHB2MEM.v、AHB2LED.v、AHBLITE_SYS.v五个Verilog 接口,分别是解码器、多路选择器、存储器、LED以及顶层模块。

6、testbench&simulation
编写testbench,使用vivado集成仿真器进行仿真。仿真结果和预期相同。

7、Implementation
Cortex-M0 SOPC在FPGA内的主要布局布线区域。

8、编写应用程序
按照Thumb指令集编写汇编程序,使LED灯交替闪烁。

9、综合与下载
完成整个Cortex-M0 SOPC工程后,将工程下载到FPGA开发板(Artix-7)上去。进行实际FPGA实际验证。下载实物情况如下图所示。

10、SOPC
程序是个4个LED等循环赋值A(1010)和5(0101),因此会交替亮灭。
FPGA的复位键也需要注意,有的是高复位,有的是低复位。

11、数模混合SOC设计展望
