摘 要: 給出了一個可用于SoC設計的SPI接口IP核的RTL設計與功能仿真。采用AMBA 2.0總線標準來實現SPI接口在外部設備和內部系統之間進行通信,在數據傳輸部分,摒棄傳統的需要一個專門的移位傳輸寄存器實現串/并轉換的設計方法,采用復用寄存器的方法,把移位傳輸寄存器和發送寄存器結合在一起,提高了傳輸速度,也節約了硬件資源。采用SoC驗證平臺進行SoC環境下對IP的驗證,在100 MHz時鐘頻率下的仿真和驗證結果表明,SPI接口實現了數據傳輸,且滿足時序設計要求。
關鍵詞: SPI協議; AMBA總線; SoC設計; 數據傳輸
中圖分類號: TN402?34 文獻標識碼: A 文章編號: 1004?373X(2013)24?0149?03
Design and verification of SPI applied to SoC
KUANG Chun?yu, MA Qi, CHEN Ke?ming
(Microelectronics CAD Center, Hangzhou Dianzi University, Hangzhou 310018, China)
Abstract: The RTL design and functional simulation of SPI IP core applied to SoC design is presented in this paper. The AMBA 2.0 bus standards is adopted to achieve the communication between the peripheral devices and the internal system through SPI. As fore data transmission section, the traditional design method was abandoned, which needs a specific shift register for serial/parallel transfer. The shifting transmission register and receive register are put together by the reuse registers to improve the speed and save the hardware resources. IP is verified with an SoC verification platform under SoC environment. The results of simulation at the clock frequency of 100 MHZ show that the design can achieve data transmission and meet the requirements of time?sequence design.
Keywords: SPI I ptotocol; AMBA bus; SoC design; data transmission
0 引 言
SPI(Serial Peripheral Interface)是一種同步串行總線接口,很多器件如E2PROM、FLASH、實時時鐘、A/D轉換器等都用到了SPI接口[1],它也是SoC中的一個常用外圍功能模塊。AMBA總線是由ARM公司開發的一種高性能、開放性SoC系統總線,它主要包括AHB,ASB和APB三種總線類型[2]。AHB總線主要用于連接高性能、高速度的系統模塊,如CPU,DSP,SRAM等;APB總線主要用于連接低速外圍模塊,如UART,I2C等,接口簡單,效率高,功耗低[3];ASB總線通過連接系統高速部件來實現高速通信,一般較少用到。
本文設計一個可作為IP核用于SoC設計的SPI接口,采用AMBA2.0總線標準來實現SPI接口在外部設備和內部系統之間進行通信,SPI接口作為低速外圍模塊掛載在APB總線上。
1 SPI接口的定義
1.1 接口信號
SPI的接口信號為同步串行時鐘SCLK、主機輸入/從機輸出MISO、主機輸出/從機輸入MOSI、從機選擇[SS](低電平有效)[4],由于只用到四根線工作,與其他接口相比具有結構簡單、速度快的優點。SPI有主/從兩種工作模式,SPI總線的串行時鐘SCLK用來同步數據傳輸,在主模式下由主機產生,從機選擇信號[SS]用來決定外部設備是否被選作SPI的從設備。……