SOC FPGA之HPS模型设计(一)

目录

一、建立HPS硬件系统模型

1.1 GHRD

1.2 从0开始搭建HPS

1.2.1 FPGA Interfaces

1.2.1.1 General

1.2.1.2 AXI Bridge

1.2.1.3 FPGA-to-HPS SDRAM Interface

1.2.1.4 DMA Peripheral Request

1.2.1.5 Interrupts

1.2.1.6 EMAC ptp interface

1.2.2 Peripheral Pin Multiplexing

1.2.3 HPS Clocks

1.2.3.1 Input Clocks

1.2.3.2 Output Clocks

1.2.4 SDRAM

1.2.4.1 PHY Settings

1.2.4.2 Memory Parameters

1.2.4.3 Memory Timing

1.2.4.4 Board Settings

1.3 添加其他组件

1.4 产生Qsys系统

1.5 编译Quartus工程

1.6 硬件系统外设的输入/输出测试

1.7 相关代码


一、建立HPS硬件系统模型

建立HPS硬件模型有两种方式,一种是在GHRD中添加或修改,另外一种是从0开始搭建HPS

1.1 GHRD

GSRD(Golden System Reference Design,  黄金系统参考设计)包含:

  • GHRD(Golden Hardware Reference Design,  黄金硬件参考设计)
  • 基于U-Boot的Bootloader参考
  • Linux BSP参考
  • Linux应用程序示例

其中GHRD包含 Cyclone V SoC / Arria V SoC Development Kit的完整HPS设计,如双核ARM Cortex-A9 MPCore HPS、用户按键输入(PIO Buttion)、用户拨码开关输入(PIO DIPSW)、LED输出(PIO LED)、64KB片上存储器、JTAG-to-Avalon主接口连接桥(JTAG Master)、JATG-UART调试模块、中断捕获器(Interrupt Capturer)及系统ID(SysID)等。使用时只需在其中添加或修改所需的内容即可。

1.2 从0开始搭建HPS

在Quartus中创建工程HPS_Qsys_Prj,进入Platform Designer,添加Hard Processor System组件

1.2.1 FPGA Interfaces

在FPGA Interfaces标签设置页有General、AXI Bridges、FPGA-to-HPS SDRAM Interface、Resets、DMA Peripheral Request、Interrupts、EMAC ptp Interface

1.2.1.1 General

当General中某些选项被选中,相应的接口会出现在HPS模块中

参数名描述
Enable MPU standby and event signals

通知FPGA接口微处理器单元(MPU)处于待机模式;

可以从等待事件(WFE)状态唤醒一个MPCore处理器

Enable general purpose signals在SOC器件的HPS部分,启用FPGA与FPGA管理器之间的一组32位的单向普通目的接口
Enable Debug APB interface启用对FPGA的调试接口,允许在HPS中访问调试组件
Enable System Trace Macrocell hardware events启用系统跟踪单元(STM)硬件事件,允许FPGA中的逻辑向跟踪过程插入信息
Enable FPGA Cross Trigger Interface启用交叉触发器接口(CTI),允许出发Source/Sink与出发的交叉触发(ECT)相连
Enable FPGA Trace Port Interface Unit启用跟踪端口接口单元(TPIU)与FPGA逻辑之间的一个接口。TPIU是片上跟踪源与某个跟踪端口之间的桥梁
Enable FPGA Trace Port Alternate FPGA Interface当启用跟踪端口时,会创建一个与Arria 10跟踪接口兼容的接口
Enable boot from fpga signals启用HPS的一个输入信号,表明是否片上RAM中的preloader可以使用
Enable HLGPI Interface启用HPS的GPIO

1.2.1.2 AXI Bridge

FPGA-to-HPS interface width和HPS-to-FPGA interface width可选Unused、32-bit、64-bit和128-bit,即FPGA2HPS接口位宽和HPS2FPGA接口位宽

 

Lightweight HPS-to-FPGA interface width可选32-bit、Unused,即轻量级LWHPS2FPGA接口位宽。

1.2.1.3 FPGA-to-HPS SDRAM Interface

可以通过添加一个或多个SDRAM从端口(最多6个)让FPGA来访问HPS SDRAM子系统,其数据宽度可选32、64、128或256位,接口类型可选AXI-3、双向Avalon-MM、只写Avalon-MM、只读Avalon-MM。

 1.2.1.4 Resets

参数名参数描述
Enable HPS-to-FPGA cold reset output启用HPS2FPGA接口得冷启动输出
Enable HPS warm reset handshake signals启用一组附加的复位握手信号,允许软件通知HPS在其安全时开启一个FPGA结构中的热复位信号
Enable FPGA-to-HPS debug reset request启用FPGA2HPS调试复位请求接口
Enable FPGA-to-HPS warm reset request启用FPGA2HPS热复位请求接口
Enable FPGA-to-HPS cold reset request启用FPGA2HPS冷复位请求接口

1.2.1.4 DMA Peripheral Request

单独启用每个DMA控制器外设请求ID(Peripheral Request ID),每个请求ID可以使能连接FPGA的8个逻辑DMA通道中对应的通道接口。外设请求ID[4-7]是与CAN控制器共用。

1.2.1.5 Interrupts

对不同中断使能,勾选Enable FPGA-to-HPS Interrupts则启用HPS中FPGA对MPU的中断信号,下方则是HPS中的每个外设提供给FPGA的中断信号

1.2.1.6 EMAC ptp interface

Enable EMAC Precision Time Protocol(PTP) FPGA Interface,启用EMACO精确时间协议 (PTP) FPGA接口,当EMAC通过Pinmux连接到HPS I/O时,可通过FPGA访问IEEE 1588精密时间协议(PTP)接口。当EMAC连接到FPGA时,PTP信号可用。

1.2.2 Peripheral Pin Multiplexing

Peripheral Pin Multiplexing标签页包含了HPS所有可用外设的参数设置,通过选择HPS I/O设置可用启用对应的外设。当启用某个外设时,还需要设置其相应的工作模式。将鼠标放到相应的外设模式(mode)设置选项位置几秒时间,即可出现一个下拉列表,下拉列表给出了外设工作模式下的引脚定义。引脚复用设置应该与所用SOC FPGA开发板上的实际外设连接相匹配。

 在最下方的Peripherals Mux Table中列出了HPS外设的引脚分配情况,包括没有分配给任何外设的引脚,可以将其作为普通目的I/O(GPIO)使用,点击相对应的后面的GPIO即可。

1.2.3 HPS Clocks

HPS Clocks包括Input Clocks和Output Clocks

注意:这里设置的时钟频率是指期望的最高频率,实际时钟频率可以通过MPU上的软件对寄存器的设置进行修改,这里设置的时钟频率将出现在Qsys产生的Synopsys设计约束文件(.sdc)中。

1.2.3.1 Input Clocks

External Clock Sources用于设置E0SC的时钟频率

FPGA-to-HPS PLL Reference Clocks用于启用HPS SDRAM PLL提供参考时钟的FPGA接口、启用HPS外设PLL提供参考时钟的FPGA接口

Peripheral FPGA Clocks用于设置HPS外设的时钟频率,但需要先设置HPS外设在FPGA可以(即相应外设的引脚复用选择FPGA)

1.2.3.2 Output Clocks

Clock Sources设置时钟源

Main PLL Output Clocks - Desired Frequencies主锁相环输出时钟-所需频率

Peripheral PLL Output Clocks - Desired frequencies外围锁相环输出时钟-所需频率

HPS-to-FPGA User Clocks,用户时钟

参数名称参数描述
Enable HPS-to-FPGA user 0 clock启用HPS到FPGA的主PLL
Enable HPS-to-FPGA user 1 clock启用HPS到FPGA的外设PLL
Enable HPS-to-FPGA user 2 clock启用HPS到FPGA的SDRAM PLL

1.2.4 SDRAM

HPS支持DDR2、DDR3、LPDDR2协议的存储器接口

1.2.4.1 PHY Settings

Memory clock frequency设置存储器芯片的时钟频率,依据DDR3芯片手册设置

Supply Voltage电源电压,依据DDR3芯片手册选择

1.2.4.2 Memory Parameters

根据DDR3芯片手册中的参数设置Memory Parameters

1.2.4.3 Memory Timing

根据DDR3芯片手册中的相关参数验证Memory Timing页面中的时序参数

1.2.4.4 Board Settings

Setup and Hold DeratingIntersymbol Interference可以选择Use Altera's default settings,也可以根据芯片手册中的相关参数进行设置

需要根据开发板参数设置Board Skews,SDRAM利用这些参数校准I/O延时以及FIFO设置来补偿板级、FPGA部分或存储器件的漂移时间

 所有设置完成后点击右下角finish,将h2f_reset引出,将三个clock连接clk

1.3 添加其他组件

添加On-chip Memory、两个JTAG to Avalon Master Bridge、System ID Peripheral、JTAG UART、LED PIO、拨码开关PIO、按键PIO、自定义中断捕获模块

 

 自定义中断捕获模块

module intr_capturer #(parameter NUM_INTR = 32// active high level interrupt is expected for the input of this capturer module
)(input                clk,input                rst_n,input [NUM_INTR-1:0] interrupt_in,//input [31:0]         wrdata,input                addr,input                read,output [31:0]        rddata
);reg  [NUM_INTR-1:0]  interrupt_reg;reg  [31:0]          readdata_with_waitstate;wire [31:0]          act_readdata;wire [31:0]          readdata_lower_intr;wire [31:0]          readdata_higher_intr;wire                 access_lower_32;wire                 access_higher_32;always @(posedge clk or negedge rst_n) beginif (!rst_n) interrupt_reg <= 'b0;else        interrupt_reg <= interrupt_in;endgenerateif (NUM_INTR>32) begin : two_intr_reg_neededassign access_higher_32     = read & (addr == 1);assign readdata_lower_intr  = interrupt_reg[31:0] & {(32){access_lower_32}};assign readdata_higher_intr = interrupt_reg[NUM_INTR-1:32] & {(NUM_INTR-32){access_higher_32}};endelse begin : only_1_regassign readdata_lower_intr  = interrupt_reg & {(NUM_INTR){access_lower_32}};assign readdata_higher_intr = {32{1'b0}};endendgenerateassign access_lower_32 = read & (addr == 0);assign act_readdata = readdata_lower_intr | readdata_higher_intr;assign rddata = readdata_with_waitstate;always @(posedge clk or negedge rst_n) beginif (!rst_n) readdata_with_waitstate <= 32'b0;else        readdata_with_waitstate <= act_readdata;endendmodule

1.4 产生Qsys系统

连线、设置中断、手动分配相应外设的基地址

产生Qsys系统

Qsys将产生指定格式的硬件描述语言(HDL)文件用于Quartus工程编译,同时产生一组与硬件系统定义相关的文件,包括定义了选定的HPS外设默认引脚分配的Tcl(Tool Command Language)文件,定义了HPS与FPGA中多端口存储器控制器的Tcl文件,定义了系统所用IP和用于TimeQuest时序约束的QIP文件,可以在synthesis目录找到。

1.5 编译Quartus工程

在Quartus的工程中添加soc_system.qip和soc_system.v文件

点击工具栏中的File->New->Block Diagram/Schematic File,新建一个原理图文件

再右键点击原理图空白处选择Insert->Symbol,将soc_system添加入原理图文件中,右键点击soc_system->Generate Pins for Symbol Ports,为元件添加输入/输出端口

将两处hps_0_h2f_reset的输出(命名为hps_fpga_reset_n)连接到系统的复位reset信号上,然后保存

 添加顶层文件

module HPS_Qsys_prj(
///HPS Interface			//		input  wire        reset_reset_n,                         //           reset.reset_n
//		input  wire        clk_clk,                               //             clk.clkoutput wire [14:0] memory_mem_a,                          //          memory.mem_aoutput wire [2:0]  memory_mem_ba,                         //                .mem_baoutput wire        memory_mem_ck,                         //                .mem_ckoutput wire        memory_mem_ck_n,                       //                .mem_ck_noutput wire        memory_mem_cke,                        //                .mem_ckeoutput wire        memory_mem_cs_n,                       //                .mem_cs_noutput wire        memory_mem_ras_n,                      //                .mem_ras_noutput wire        memory_mem_cas_n,                      //                .mem_cas_noutput wire        memory_mem_we_n,                       //                .mem_we_noutput wire        memory_mem_reset_n,                    //                .mem_reset_ninout  wire [31:0] memory_mem_dq,                         //                .mem_dqinout  wire [3:0]  memory_mem_dqs,                        //                .mem_dqsinout  wire [3:0]  memory_mem_dqs_n,                      //                .mem_dqs_noutput wire        memory_mem_odt,                        //                .mem_odtoutput wire [3:0]  memory_mem_dm,                         //                .mem_dminput  wire        memory_oct_rzqin,                      //                .oct_rzqinoutput wire        hps_0_hps_io_hps_io_emac1_inst_TX_CLK, //    hps_0_hps_io.hps_io_emac1_inst_TX_CLKoutput wire        hps_0_hps_io_hps_io_emac1_inst_TXD0,   //                .hps_io_emac1_inst_TXD0output wire        hps_0_hps_io_hps_io_emac1_inst_TXD1,   //                .hps_io_emac1_inst_TXD1output wire        hps_0_hps_io_hps_io_emac1_inst_TXD2,   //                .hps_io_emac1_inst_TXD2output wire        hps_0_hps_io_hps_io_emac1_inst_TXD3,   //                .hps_io_emac1_inst_TXD3input  wire        hps_0_hps_io_hps_io_emac1_inst_RXD0,   //                .hps_io_emac1_inst_RXD0inout  wire        hps_0_hps_io_hps_io_emac1_inst_MDIO,   //                .hps_io_emac1_inst_MDIOoutput wire        hps_0_hps_io_hps_io_emac1_inst_MDC,    //                .hps_io_emac1_inst_MDCinput  wire        hps_0_hps_io_hps_io_emac1_inst_RX_CTL, //                .hps_io_emac1_inst_RX_CTLoutput wire        hps_0_hps_io_hps_io_emac1_inst_TX_CTL, //                .hps_io_emac1_inst_TX_CTLinput  wire        hps_0_hps_io_hps_io_emac1_inst_RX_CLK, //                .hps_io_emac1_inst_RX_CLKinput  wire        hps_0_hps_io_hps_io_emac1_inst_RXD1,   //                .hps_io_emac1_inst_RXD1input  wire        hps_0_hps_io_hps_io_emac1_inst_RXD2,   //                .hps_io_emac1_inst_RXD2input  wire        hps_0_hps_io_hps_io_emac1_inst_RXD3,   //                .hps_io_emac1_inst_RXD3inout  wire        hps_0_hps_io_hps_io_qspi_inst_IO0,     //                .hps_io_qspi_inst_IO0inout  wire        hps_0_hps_io_hps_io_qspi_inst_IO1,     //                .hps_io_qspi_inst_IO1inout  wire        hps_0_hps_io_hps_io_qspi_inst_IO2,     //                .hps_io_qspi_inst_IO2inout  wire        hps_0_hps_io_hps_io_qspi_inst_IO3,     //                .hps_io_qspi_inst_IO3output wire        hps_0_hps_io_hps_io_qspi_inst_SS0,     //                .hps_io_qspi_inst_SS0output wire        hps_0_hps_io_hps_io_qspi_inst_CLK,     //                .hps_io_qspi_inst_CLKinout  wire        hps_0_hps_io_hps_io_sdio_inst_CMD,     //                .hps_io_sdio_inst_CMDinout  wire        hps_0_hps_io_hps_io_sdio_inst_D0,      //                .hps_io_sdio_inst_D0inout  wire        hps_0_hps_io_hps_io_sdio_inst_D1,      //                .hps_io_sdio_inst_D1output wire        hps_0_hps_io_hps_io_sdio_inst_CLK,     //                .hps_io_sdio_inst_CLKinout  wire        hps_0_hps_io_hps_io_sdio_inst_D2,      //                .hps_io_sdio_inst_D2inout  wire        hps_0_hps_io_hps_io_sdio_inst_D3,      //                .hps_io_sdio_inst_D3inout  wire        hps_0_hps_io_hps_io_usb1_inst_D0,      //                .hps_io_usb1_inst_D0inout  wire        hps_0_hps_io_hps_io_usb1_inst_D1,      //                .hps_io_usb1_inst_D1inout  wire        hps_0_hps_io_hps_io_usb1_inst_D2,      //                .hps_io_usb1_inst_D2inout  wire        hps_0_hps_io_hps_io_usb1_inst_D3,      //                .hps_io_usb1_inst_D3inout  wire        hps_0_hps_io_hps_io_usb1_inst_D4,      //                .hps_io_usb1_inst_D4inout  wire        hps_0_hps_io_hps_io_usb1_inst_D5,      //                .hps_io_usb1_inst_D5inout  wire        hps_0_hps_io_hps_io_usb1_inst_D6,      //                .hps_io_usb1_inst_D6inout  wire        hps_0_hps_io_hps_io_usb1_inst_D7,      //                .hps_io_usb1_inst_D7input  wire        hps_0_hps_io_hps_io_usb1_inst_CLK,     //                .hps_io_usb1_inst_CLKoutput wire        hps_0_hps_io_hps_io_usb1_inst_STP,     //                .hps_io_usb1_inst_STPinput  wire        hps_0_hps_io_hps_io_usb1_inst_DIR,     //                .hps_io_usb1_inst_DIRinput  wire        hps_0_hps_io_hps_io_usb1_inst_NXT,     //                .hps_io_usb1_inst_NXToutput wire        hps_0_hps_io_hps_io_spim0_inst_CLK,    //                .hps_io_spim0_inst_CLKoutput wire        hps_0_hps_io_hps_io_spim0_inst_MOSI,   //                .hps_io_spim0_inst_MOSIinput  wire        hps_0_hps_io_hps_io_spim0_inst_MISO,   //                .hps_io_spim0_inst_MISOoutput wire        hps_0_hps_io_hps_io_spim0_inst_SS0,    //                .hps_io_spim0_inst_SS0output wire        hps_0_hps_io_hps_io_spim1_inst_CLK,    //                .hps_io_spim1_inst_CLKoutput wire        hps_0_hps_io_hps_io_spim1_inst_MOSI,   //                .hps_io_spim1_inst_MOSIinput  wire        hps_0_hps_io_hps_io_spim1_inst_MISO,   //                .hps_io_spim1_inst_MISOoutput wire        hps_0_hps_io_hps_io_spim1_inst_SS0,    //                .hps_io_spim1_inst_SS0input  wire        hps_0_hps_io_hps_io_uart0_inst_RX,     //                .hps_io_uart0_inst_RXoutput wire        hps_0_hps_io_hps_io_uart0_inst_TX,     //                .hps_io_uart0_inst_TXinout  wire        hps_0_hps_io_hps_io_i2c1_inst_SDA,     //                .hps_io_i2c1_inst_SDAinout  wire        hps_0_hps_io_hps_io_i2c1_inst_SCL,     //                .hps_io_i2c1_inst_SCLinout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO0,  //                .hps_io_gpio_inst_GPIO0inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI1,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI2,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI3,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI4,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI5,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI6,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI7,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI8,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI9,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI10,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI11,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI12,inout  wire        hps_0_hps_io_hps_io_gpio_inst_HLGPI13,inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO09,  //                .hps_io_gpio_inst_GPIO09inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO35,  //                .hps_io_gpio_inst_GPIO35inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO48,  //                .hps_io_gpio_inst_GPIO48inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO53,  //                .hps_io_gpio_inst_GPIO53inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO54,  //                .hps_io_gpio_inst_GPIO54inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO55,  //                .hps_io_gpio_inst_GPIO55inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO56,  //                .hps_io_gpio_inst_GPIO56inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO61,  //                .hps_io_gpio_inst_GPIO61inout  wire        hps_0_hps_io_hps_io_gpio_inst_GPIO62,   //                .hps_io_gpio_inst_GPIO62FPGA Interface			//FPGA-GPLL-CLK------------------------//X pinsinput          clk_100m_fpga,       //2.5V    //100 MHz (2nd copy to max)input          clk_50m_fpga,        //2.5V    //50MHz (2nd copy to max) input          clk_top1,            //2.5V    //156.25 MHz adjustableinput          clk_bot1,            //1.5V    //100 MHz ajustableinput          fpga_resetn,          //2.5V    //FPGA Reset Pushbutton	SiLabs Clock Generator I/F 	///  	   	   	   	   	   	output   wire  clk_i2c_sclk,             // I2C Clock inout    wire  clk_i2c_sdat,             // I2C Data `ifdef user_peripheral//FPGA-User-IO-------------------------//14 pins //--------------------------input	 [3:0]   user_dipsw_fpga,     //output [3:0]   user_led_fpga,       //input	 [3:0]   user_pb_fpga,        //input  	wire  irda_rxd,				// IRDA Receive LED   output  	wire  fan_ctrl				// control for fan
`endif`ifdef ddr3
//FPGA-DDR3-400Mx32--------------------//74 pins //--------------------------output [14:0]  ddr3_fpga_a,         //SSTL15  //Addressoutput [2:0]   ddr3_fpga_ba,        //SSTL15  //Bank Addressoutput         ddr3_fpga_casn,      //SSTL15  //Column Address Strobeoutput         ddr3_fpga_cke,       //SSTL15  //Clock Enableoutput         ddr3_fpga_clk_n,     //SSTL15  //Diff Clock - Negoutput         ddr3_fpga_clk_p,     //SSTL15  //Diff Clock - Posoutput         ddr3_fpga_csn,       //SSTL15  //Chip Selectoutput [3:0]   ddr3_fpga_dm,        //SSTL15  //Data Write Maskinout  [31:0]  ddr3_fpga_dq,        //SSTL15  //Data Businout  [3:0]   ddr3_fpga_dqs_n,     //SSTL15  //Diff Data Strobe - Neginout  [3:0]   ddr3_fpga_dqs_p,     //SSTL15  //Diff Data Strobe - Posoutput         ddr3_fpga_odt,       //SSTL15  //On-Die Termination Enableoutput          ddr3_fpga_rasn,      //SSTL15  //Row Address Strobeoutput          ddr3_fpga_resetn,    //SSTL15  //Resetoutput          ddr3_fpga_wen,       //SSTL15  //Write Enableinput          ddr3_fpga_rzq,       //OCT_rzqin //On-die termination enable
//   input          oct_rdn,        		//SSTL15    //On-die termination enable
//   input          oct_rup,       		//SSTL15    //On-die termination enable
`endif`ifdef temp_senseTemp. Sensor I/F 	  	// 							SPI interface								//output   wire  temp_cs_n,				// Chip Selectoutput   wire  temp_sclk,       			// Slave Clock output   wire  temp_mosi,				// Data Out input    wire  temp_miso,				// Data In
`endif`ifdef vgaVIDEO 	 			output 	wire  vga_clk,					// Video Clockoutput 	wire  vga_hs,					// Horizontal Synchoutput 	wire  vga_vs,					// Vertical Synch   	   	output   wire  [7:0] vga_r,				// Red output   wire  [7:0] vga_g,				// Greenoutput   wire  [7:0] vga_b,				// Blue	output 	wire  vga_blank_n,			// Composite Blank Controloutput 	wire  vga_sync_n,				// Composite Synch Control  	  
`endif`ifdef audioAUDIO 	 			input 	wire  aud_adcdat,				// ADC Serial Data or I2C_SCLKinput 	wire  aud_adclrck, 			// FDDR3e clockinput 	wire  aud_bclk,				// Bit Clock output 	wire  aud_dacdat,				// DAC Serial Data inout 	wire  aud_daclrck,			// FDDR3e Clockoutput   wire  aud_i2c_sclk,                                       inout    wire  aud_i2c_sdat,                                          output   wire  aud_mute,                                      output   wire  aud_xck,    
`endif`ifdef hsma
//HSMC-Port-A----------------------------------------------------
//	input                         [2:1]        hsmc_clkin_n,        input                         [2:1]        hsmc_clkin_p,        
//	output                        [2:1]        hsmc_clkout_n,        output                        [2:1]        hsmc_clkout_p,       input                                      hsmc_clk_in0,     output                                      hsmc_clk_out0,        inout                         [3:0]        hsmc_d,      
`ifdef HSMC_XCVR	
//	input                         [7:0]        hsmc_gxb_rx_n,        input                         [7:0]        hsmc_gxb_rx_p,       
//	output                        [7:0]        hsmc_gxb_tx_n,        output                        [7:0]        hsmc_gxb_tx_p,        
//	input                                      hsmc_ref_clk_n,        input                                      hsmc_ref_clk_p,        
`endif
//	input                         [16:0]       hsmc_rx_n,       input                         [16:0]       hsmc_rx_p,         output                                     hsmc_scl,        inout                                      hsmc_sda,        
//	output                         [16:0]       hsmc_tx_n,      output                         [16:0]       hsmc_tx_p      `endifQSPI Flash I/F 	///  	   	   	   	   	   	inout   wire  [3:0] fpga_epqc_data,     // Flash Data output  wire  fpga_epqc_dclk,           // Data Clock  output  wire  fpga_epqc_ncso           // Chip Select);// internal wires and registers declarationwire [3:0] fpga_led_internal;wire       hps_fpga_reset_n;// connection of internal logics
//  assign user_led_fpga = ~fpga_led_internal;assign user_led_fpga = fpga_led_internal;soc_system u0 (.clk_clk                         (clk_bot1),                         //             clk.clk.fpga_button_pio_export          (user_pb_fpga),          // fpga_button_pio.export.fpga_dipsw_pio_export           (user_dipsw_fpga),           //  fpga_dipsw_pio.export.fpga_led_pio_export             (fpga_led_internal),             //    fpga_led_pio.export.hps_0_h2f_reset_reset_n         (hps_fpga_reset_n),         // hps_0_h2f_reset.reset_n.hps_io_hps_io_emac1_inst_TX_CLK (hps_0_hps_io_hps_io_emac1_inst_TX_CLK), //          hps_io.hps_io_emac1_inst_TX_CLK.hps_io_hps_io_emac1_inst_TXD0   (hps_0_hps_io_hps_io_emac1_inst_TXD0),   //                .hps_io_emac1_inst_TXD0.hps_io_hps_io_emac1_inst_TXD1   (hps_0_hps_io_hps_io_emac1_inst_TXD1),   //                .hps_io_emac1_inst_TXD1.hps_io_hps_io_emac1_inst_TXD2   (hps_0_hps_io_hps_io_emac1_inst_TXD2),   //                .hps_io_emac1_inst_TXD2.hps_io_hps_io_emac1_inst_TXD3   (hps_0_hps_io_hps_io_emac1_inst_TXD3),   //                .hps_io_emac1_inst_TXD3.hps_io_hps_io_emac1_inst_RXD0   (hps_0_hps_io_hps_io_emac1_inst_RXD0),   //                .hps_io_emac1_inst_RXD0.hps_io_hps_io_emac1_inst_MDIO   (hps_0_hps_io_hps_io_emac1_inst_MDIO),   //                .hps_io_emac1_inst_MDIO.hps_io_hps_io_emac1_inst_MDC    (hps_0_hps_io_hps_io_emac1_inst_MDC),    //                .hps_io_emac1_inst_MDC.hps_io_hps_io_emac1_inst_RX_CTL (hps_0_hps_io_hps_io_emac1_inst_RX_CTL), //                .hps_io_emac1_inst_RX_CTL.hps_io_hps_io_emac1_inst_TX_CTL (hps_0_hps_io_hps_io_emac1_inst_TX_CTL), //                .hps_io_emac1_inst_TX_CTL.hps_io_hps_io_emac1_inst_RX_CLK (hps_0_hps_io_hps_io_emac1_inst_RX_CLK), //                .hps_io_emac1_inst_RX_CLK.hps_io_hps_io_emac1_inst_RXD1   (hps_0_hps_io_hps_io_emac1_inst_RXD1),   //                .hps_io_emac1_inst_RXD1.hps_io_hps_io_emac1_inst_RXD2   (hps_0_hps_io_hps_io_emac1_inst_RXD2),   //                .hps_io_emac1_inst_RXD2.hps_io_hps_io_emac1_inst_RXD3   (hps_0_hps_io_hps_io_emac1_inst_RXD3),   //                .hps_io_emac1_inst_RXD3.hps_io_hps_io_qspi_inst_IO0     (hps_0_hps_io_hps_io_qspi_inst_IO0),     //                .hps_io_qspi_inst_IO0.hps_io_hps_io_qspi_inst_IO1     (hps_0_hps_io_hps_io_qspi_inst_IO1),     //                .hps_io_qspi_inst_IO1.hps_io_hps_io_qspi_inst_IO2     (hps_0_hps_io_hps_io_qspi_inst_IO2),     //                .hps_io_qspi_inst_IO2.hps_io_hps_io_qspi_inst_IO3     (hps_0_hps_io_hps_io_qspi_inst_IO3),     //                .hps_io_qspi_inst_IO3.hps_io_hps_io_qspi_inst_SS0     (hps_0_hps_io_hps_io_qspi_inst_SS0),     //                .hps_io_qspi_inst_SS0.hps_io_hps_io_qspi_inst_CLK     (hps_0_hps_io_hps_io_qspi_inst_CLK),     //                .hps_io_qspi_inst_CLK.hps_io_hps_io_sdio_inst_CMD     (hps_0_hps_io_hps_io_sdio_inst_CMD),     //                .hps_io_sdio_inst_CMD.hps_io_hps_io_sdio_inst_D0      (hps_0_hps_io_hps_io_sdio_inst_D0),      //                .hps_io_sdio_inst_D0.hps_io_hps_io_sdio_inst_D1      (hps_0_hps_io_hps_io_sdio_inst_D1),      //                .hps_io_sdio_inst_D1.hps_io_hps_io_sdio_inst_CLK     (hps_0_hps_io_hps_io_sdio_inst_CLK),     //                .hps_io_sdio_inst_CLK.hps_io_hps_io_sdio_inst_D2      (hps_0_hps_io_hps_io_sdio_inst_D2),      //                .hps_io_sdio_inst_D2.hps_io_hps_io_sdio_inst_D3      (hps_0_hps_io_hps_io_sdio_inst_D3),      //                .hps_io_sdio_inst_D3.hps_io_hps_io_usb1_inst_D0      (hps_0_hps_io_hps_io_usb1_inst_D0),      //                .hps_io_usb1_inst_D0.hps_io_hps_io_usb1_inst_D1      (hps_0_hps_io_hps_io_usb1_inst_D1),      //                .hps_io_usb1_inst_D1.hps_io_hps_io_usb1_inst_D2      (hps_0_hps_io_hps_io_usb1_inst_D2),      //                .hps_io_usb1_inst_D2.hps_io_hps_io_usb1_inst_D3      (hps_0_hps_io_hps_io_usb1_inst_D3),      //                .hps_io_usb1_inst_D3.hps_io_hps_io_usb1_inst_D4      (hps_0_hps_io_hps_io_usb1_inst_D4),      //                .hps_io_usb1_inst_D4.hps_io_hps_io_usb1_inst_D5      (hps_0_hps_io_hps_io_usb1_inst_D5),      //                .hps_io_usb1_inst_D5.hps_io_hps_io_usb1_inst_D6      (hps_0_hps_io_hps_io_usb1_inst_D6),      //                .hps_io_usb1_inst_D6.hps_io_hps_io_usb1_inst_D7      (hps_0_hps_io_hps_io_usb1_inst_D7),      //                .hps_io_usb1_inst_D7.hps_io_hps_io_usb1_inst_STP     (hps_0_hps_io_hps_io_usb1_inst_STP),     //                .hps_io_usb1_inst_STP.hps_io_hps_io_usb1_inst_DIR     (hps_0_hps_io_hps_io_usb1_inst_DIR),     //                .hps_io_usb1_inst_DIR.hps_io_hps_io_usb1_inst_NXT     (hps_0_hps_io_hps_io_usb1_inst_NXT),     //                .hps_io_usb1_inst_NXT.hps_io_hps_io_spim0_inst_CLK    (hps_0_hps_io_hps_io_spim0_inst_CLK),    //                .hps_io_spim0_inst_CLK.hps_io_hps_io_spim0_inst_MOSI   (hps_0_hps_io_hps_io_spim0_inst_MOSI),   //                .hps_io_spim0_inst_MOSI.hps_io_hps_io_spim0_inst_MISO   (hps_0_hps_io_hps_io_spim0_inst_MISO),   //                .hps_io_spim0_inst_MISO.hps_io_hps_io_spim0_inst_SS0    (hps_0_hps_io_hps_io_spim0_inst_SS0),    //                .hps_io_spim0_inst_SS0.hps_io_hps_io_spim1_inst_CLK    (hps_0_hps_io_hps_io_spim1_inst_CLK),    //                .hps_io_spim1_inst_CLK.hps_io_hps_io_spim1_inst_MOSI   (hps_0_hps_io_hps_io_spim1_inst_MOSI),   //                .hps_io_spim1_inst_MOSI.hps_io_hps_io_spim1_inst_MISO   (hps_0_hps_io_hps_io_spim1_inst_MISO),   //                .hps_io_spim1_inst_MISO.hps_io_hps_io_spim1_inst_SS0    (hps_0_hps_io_hps_io_spim1_inst_SS0),    //                .hps_io_spim1_inst_SS0.hps_io_hps_io_uart0_inst_RX     (hps_0_hps_io_hps_io_uart0_inst_RX),     //                .hps_io_uart0_inst_RX.hps_io_hps_io_uart0_inst_TX     (hps_0_hps_io_hps_io_uart0_inst_TX),     //                .hps_io_uart0_inst_TX.hps_io_hps_io_i2c1_inst_SDA     (hps_0_hps_io_hps_io_i2c1_inst_SDA),     //                .hps_io_i2c1_inst_SDA.hps_io_hps_io_i2c1_inst_SCL     (hps_0_hps_io_hps_io_i2c1_inst_SCL),     //                .hps_io_i2c1_inst_SCL.hps_io_hps_io_gpio_inst_HLGPI0  (hps_0_hps_io_hps_io_gpio_inst_GPIO0),  //                .hps_io_gpio_inst_HLGPI0.hps_io_hps_io_gpio_inst_HLGPI1  (hps_0_hps_io_hps_io_gpio_inst_HLGPI1),  //                .hps_io_gpio_inst_HLGPI1.hps_io_hps_io_gpio_inst_HLGPI2  (hps_0_hps_io_hps_io_gpio_inst_HLGPI2),  //                .hps_io_gpio_inst_HLGPI2.hps_io_hps_io_gpio_inst_HLGPI3  (hps_0_hps_io_hps_io_gpio_inst_HLGPI3),  //                .hps_io_gpio_inst_HLGPI3.hps_io_hps_io_gpio_inst_HLGPI4  (hps_0_hps_io_hps_io_gpio_inst_HLGPI4),  //                .hps_io_gpio_inst_HLGPI4.hps_io_hps_io_gpio_inst_HLGPI5  (hps_0_hps_io_hps_io_gpio_inst_HLGPI5),  //                .hps_io_gpio_inst_HLGPI5.hps_io_hps_io_gpio_inst_HLGPI6  (hps_0_hps_io_hps_io_gpio_inst_HLGPI6),  //                .hps_io_gpio_inst_HLGPI6.hps_io_hps_io_gpio_inst_HLGPI7  (hps_0_hps_io_hps_io_gpio_inst_HLGPI7),  //                .hps_io_gpio_inst_HLGPI7.hps_io_hps_io_gpio_inst_HLGPI8  (hps_0_hps_io_hps_io_gpio_inst_HLGPI8),  //                .hps_io_gpio_inst_HLGPI8.hps_io_hps_io_gpio_inst_HLGPI9  (hps_0_hps_io_hps_io_gpio_inst_HLGPI9),  //                .hps_io_gpio_inst_HLGPI9.hps_io_hps_io_gpio_inst_HLGPI10 (hps_0_hps_io_hps_io_gpio_inst_HLGPI10), //                .hps_io_gpio_inst_HLGPI10.hps_io_hps_io_gpio_inst_HLGPI11 (hps_0_hps_io_hps_io_gpio_inst_HLGPI11), //                .hps_io_gpio_inst_HLGPI11.hps_io_hps_io_gpio_inst_HLGPI12 (hps_0_hps_io_hps_io_gpio_inst_HLGPI12), //                .hps_io_gpio_inst_HLGPI12.hps_io_hps_io_gpio_inst_HLGPI13 (hps_0_hps_io_hps_io_gpio_inst_HLGPI13), //                .hps_io_gpio_inst_HLGPI13.hps_io_hps_io_gpio_inst_GPIO09  (hps_0_hps_io_hps_io_gpio_inst_GPIO09),  //                .hps_io_gpio_inst_GPIO09.memory_mem_a                    (memory_mem_a),                    //          memory.mem_a.memory_mem_ba                   (memory_mem_ba),                   //                .mem_ba.memory_mem_ck                   (memory_mem_ck),                   //                .mem_ck.memory_mem_ck_n                 (memory_mem_ck_n),                 //                .mem_ck_n.memory_mem_cke                  (memory_mem_cke),                  //                .mem_cke.memory_mem_cs_n                 (memory_mem_cs_n),                 //                .mem_cs_n.memory_mem_ras_n                (memory_mem_ras_n),                 //                .mem_ras_n.memory_mem_cas_n                (memory_mem_cas_n),                 //                .mem_cas_n.memory_mem_we_n                 (memory_mem_we_n),                  //                .mem_we_n.memory_mem_reset_n              (memory_mem_reset_n),              //                .mem_reset_n.memory_mem_dq                   (memory_mem_dq),                   //                .mem_dq.memory_mem_dqs                  (memory_mem_dqs),                  //                .mem_dqs.memory_mem_dqs_n                (memory_mem_dqs_n),                //                .mem_dqs_n.memory_mem_odt                  (memory_mem_odt),                  //                .mem_odt.memory_mem_dm                   (memory_mem_dm),                   //                .mem_dm.memory_oct_rzqin                (memory_oct_rzqin),                //                .oct_rzqin.reset_reset_n                   (hps_fpga_reset_n)                    //           reset.reset_n);endmodule

对工程文件进行分析综合

由于系统中的HPS是在Qsys集成工具中例化得到,因此除了所使用的外部存储器引脚以外,其他的专用引脚不需要再Quartus中进行分配,而是在HSP例化过程中由Qsys自动完成HPS的引脚分配,并把相关信息保存在XML格式的文件中提供给软件开发工具使用。但是HPS的外部存储器引脚需要在Quartus中进行引脚分配,该引脚分配信息同样保存在Tcl脚本文件中,只需要执行该脚本文件即可。

Tool->Tcl Scripts->hps_sdram_p0_pin_assignments.tcl->run

 执行完后可以在Tcl Console总查看执行结果

最后进行外设引脚分配、工程编译产生.sof文件、下载到FPGA开发板上,整个硬件平台建立完毕

1.6 硬件系统外设的输入/输出测试

系统控制台(Syetem Console)是一种硬件调试工具,通过Tcl脚本命令可以对Qsys中定制的FPGA部分的外设进行测试。在Syetem Console中通过执行Tcl命令可以读取输入PIO寄存器的状态,也可以向输出PIO寄存器写入需要输出的结果

1.7 相关代码

基于Qsys的HPS模型设计资源-CSDN文库

参考文献:

基于FPGA的嵌入式系统设计—Altera Soc FPGA
Cyclone V SoC FPGA和 Arria V SoC FPGA设计指南概述 (intel.cn)
Cyclone V SoC GSRD | Documentation | RocketBoards.org

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/14602.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

seata组件使用期间,获取全局事务状态

GlobalStatus枚举类展示全局事务状态 官网链接&#xff1a;http://seata.io/zh-cn/docs/user/appendix/global-transaction-status.html 获得全局事务状态 // 开启全局事务地方获取全局事务xid String xid RootContext.getXID(); // 通过全局事务xid获得GlobalStatus枚举类 …

Unity游戏源码分享-2.5D塔防类游戏

Unity游戏源码分享-2.5D塔防类游戏 项目地址&#xff1a; https://download.csdn.net/download/Highning0007/88118947

操作系统_进程与线程(二)

目录 2. 处理机调度 2.1 调度的基本概念 2.2 调度的层次 2.3 三级调度的联系 2.4 调度的目标 2.5 调度的实现 2.5.1 调度程序&#xff08;调度器&#xff09; 2.5.2 调度的时机、切换与过程 2.5.3 进程调度方式 2.5.4 闲逛进程 2.5.5 两种线程的调度 2.6 典型的调度…

多旋翼物流无人机节能轨迹规划(Python代码实现)

目录 &#x1f4a5;1 概述 &#x1f4da;2 运行结果 &#x1f308;3 Python代码实现 &#x1f389;4 参考文献 &#x1f4a5;1 概述 多旋翼物流无人机的节能轨迹规划是一项重要的技术&#xff0c;可以有效减少无人机的能量消耗&#xff0c;延长飞行时间&#xff0c;提高物流效率…

了解Unity编辑器之组件篇Layout(八)

Layout&#xff1a;用于管理和控制UI元素的排列和自动调整一、Aspect Ratio Fitter&#xff1a;用于根据宽高比自动调整UI元素的大小 Aspect Mode&#xff1a;用于定义纵横比适配的行为方式。Aspect Mode属性有以下几种选项&#xff1a; &#xff08;1&#xff09;None&#xf…

基于ARM+FPGA (STM32+ Cyclone 4)的滚动轴承状态监测系统

状态监测系统能够在故障早期及时发现机械设备的异常状态&#xff0c;避免故障的 进一步恶化造成不必要的损失&#xff0c;滚动轴承是机械设备的易损部件&#xff0c;本文对以滚动 轴承为研究对象的状态监测系统展开研究。现有的监测技术多采用定时上传监 测数据&#xff0c;…

Spring MVC学习笔记,包含mvc架构使用,过滤器、拦截器、执行流程等等

&#x1f600;&#x1f600;&#x1f600;创作不易&#xff0c;各位看官点赞收藏. 文章目录 Spring MVC 习笔记1、Spring MVC demo2、Spring MVC 中常见注解3、数据处理3.1、请求参数处理3.2、响应数据处理 4、RESTFul 风格5、静态资源处理6、HttpMessageConverter 转换器7、过…

Open3D(C++) 根据索引提取点云

目录 一、功能概述1、主要函数2、源码二、代码实现三、结果展示本文由CSDN点云侠原创,原文链接。爬虫网站自重,把自己当个人 一、功能概述 1、主要函数 std::shared_ptr<PointCloud> SelectByIn

spring boot 2 配置上传文件大小限制

一、起因&#xff1a;系统页面上传一个文件超过日志提示的文件最大100M的限制&#xff0c;需要更改配置文件 二、经过&#xff1a; 1、在本地代码中找到配置文件&#xff0c;修改相应数值后交给运维更新生产环境配置&#xff0c;但是运维说生产环境没有这行配置&#xff0c;遂…

MODBUS-TCP转Ethernet IP 网关连接空压机 配置案例

本案例是工业现场应用捷米特JM-EIP-TCP的Ethernet/IP转Modbus-TCP网关连接欧姆龙PLC与空压机的配置案例。使用设备&#xff1a;欧姆龙PLC&#xff0c;捷米特JM-EIP-TCP网关&#xff0c; ETHERNET/IP 的电气连接 ETHERNET/IP 采用标准的 T568B 接法&#xff0c;支持直连和交叉接…

【etcd】docker 启动单点 etcd

etcd: v3.5.9 etcd-browser: rustyx/etcdv3-browser:latest 本文档主要描述用 docker 部署单点的 etcd&#xff0c; 用 etcd-browser 来查看注册到 etcd 的 key 默认配置启动 docker run -d --name ai-etcd --networkhost --restart always \-v $PWD/etcd.conf.yml:/opt/bitn…

生命在于学习——指纹混淆技术学习

一、前言 本篇文章仅为学习笔记记录&#xff0c;不得用于违规用途。 本篇文章为安全社公众号的Poker安全所发&#xff0c;本文仅为学习复现。 二、介绍 指纹混淆技术&#xff0c;顾名思义&#xff0c;就是迷惑指纹扫描识别技术。 三、思路 作者的思路&#xff1a; 1、伪…

常见网关对比

常见网关对比 目前常见的开源网关大致上按照语言分类有如下几类&#xff1a; Nginxlua &#xff1a;OpenResty、Kong、Orange、Abtesting gateway 等 Java &#xff1a;Zuul/Zuul2、Spring Cloud Gateway、Kaazing KWG、gravitee、Dromara soul 等 Go &#xff1a;Janus、fa…

如何⾃定义⼀个SpringBoot Srarter

⾃定义⼀个SpringBoot Srarter 1、创建⼀个项⽬&#xff0c;命名为 demo-springboot-starter&#xff0c;引⼊SpringBoot相关依赖 2、编写配置⽂件 定义属性配置的前缀 3、⾃动装配 创建⾃动配置类HelloPropertiesConfigure 4、配置⾃动类 在 /resources/META-INF/spri…

Qt : day3

1.完成简易闹钟 #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QTextToSpeech> //播报类 #include <QTimer> //定时器类 #include <QTime> //时间类QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACEcla…

windows C++多线程同步<3>-互斥量

windows C多线程同步&#xff1c;3&#xff1e;-互斥量 概念&#xff0c;如下图&#xff1a; 另外就是互斥对象谁拥有&#xff0c;谁释放 那么一个线程允许多次获取互斥对象吗&#xff1f; 答案是允许&#xff0c;但是申请多次就要释放多次&#xff0c;否则其他线程获取不到互…

【Git】Git GitHub

1. Git1.1 Git基本操作1.2 Git版本回退1.3 Git分支操作 2. Git 配合GitHub2.1 生成密钥2.2 GitHub添加公钥2.3 Git连接GitHub2.4 本地仓库关联远程仓库2.5 本地代码push远程仓库2.6 本地clone远程仓库2.7 本地fetch和pull 1. Git 1.1 Git基本操作 touch test.py 工作区创建文…

android首页申请android.permission.READ_PHONE_STATE权限合规处理办法?

1、像闲鱼一样&#xff0c;申请的时候在顶部弹个解释说明对话框&#xff1f;

求解方程x^2=a的根,不使用库函数直接求解(不动点迭代法)

首先可以将方程两边同时加上x&#xff0c;&#xff0c;这时候两边同时再除以1x&#xff0c;就得到了&#xff0c;变形为。&#xff08;变性后的迭代式不唯一&#xff0c;这里随便选取一个&#xff09; 当x是准确值的时候&#xff0c;两边应该是相等的&#xff0c;如果x是近似值…

STM32 中断优先级管理(一)

STM32 NVIC 中断优先级管理 CM3内核支持256个中断&#xff0c;其中包含了16个内核中断和240个外部中断&#xff0c;并且有256级的可编程中断设置。 但STM32并没有使用CM3内核的全部东西&#xff0c;只用了一部分。 STM32有84个中断&#xff0c;包括16个内核中断和68个可屏蔽…