原创 【原创】SOPC中自定义元件的端口设置解析

2008-12-8 21:28 9600 9 12 分类: FPGA/CPLD

Nios II 嵌入式系统驱动设计(一)


       最近一直在做SOPC自定义元件的设计及其驱动的编写,今天先分享一些关于自定义元件端口设置的内容。


       在版本8.0中,SOPC Builder已经集成了七十多个IP,用户可以非常方便的应用这些元件,不过在实际应用的时候,有些元件并没有包含在SOPC中,需要用户自己编写元件代码,并集成进SOPC Builder里面,自定义元件的集成过程其实就是将元件通过Avalon总线兼容的端口挂载到Avalon总线上,因此最重要的一步就是设置元件的端口,使其能挂载到Avalon总线上。







       在7.2版本之后,Quartus II在自定义元件端口设置方面做了很大的修改,下面是变更的内容。



Table 1. Current Avalon Interfaces Supported by the Component Editor
Interface TypeDefault NameDescriptionNew Interface in v7.2
Masteravalon_master or m0Defines an Avalon master port interface.-
Slaveavalon_slave or s0Defines an Avalon slave port interface.-
Tri-State Slaveavalon_tristate_slaveDefines an Avalon tri-state port interface.-
Clock Inputclock or clock_sinkDefines a clock and reset input interface for a component.Y
Clock Outputclock_sourceDefines a clock and reset output interface for components that generate clocks for SOPC Builder systems.Y
Conduit Output or Inputconduit_start or conduit_endUsed for exporting signals to the top level of SOPC Builder systems. Conduit output and input interfaces are identical and imply no signal direction for the conduit interface. Conduits can contain input, output, and bidirectional signals.Y

Interrupt Sender

interrupt_senderDefines an interrupt output signal and the Avalon slave interface that is associated with generating the interrupt signal.Y
Interrupt Receiverinterrupt_receiverDefines an interrupt input signal and the Avalon master interface that is associated with receiving interrupt signals.Y
Streaming Sourceavalon_streaming_sourceDefines an Avalon streaming source port interface.Y
Streaming Sinkavalon_streaming_sinkDefines an Avalon streaming sink port interface.Y

       我们可以发现除了已有的Master,slave以及tri-state slave以外,还新增了流处理端口,中断收发端口,时钟及输出端口。因为在7.2版本以后,除了Avalom-MM总线外,SOPC又新增了Avalon-ST总线,因此端口也相应的增加了。







       下面列出在7.2版本后主端口和从端口所需的端口信号,表中还列出了和以前版本的端口比较。



Table 1. Avalon-MM Slave with Global Clock, Reset, Interrupt Output, and Export Signals
Signal TypeDirectionv7.1 and Earlier Interfacev7.2 and Later Interface
clkInputGlobalClock Input (1)
resetInputGlobalClock Input (1)
addressInputAvalon SlaveAvalon Slave
readInputAvalon SlaveAvalon Slave
readdataOutputAvalon SlaveAvalon Slave
writeInputAvalon SlaveAvalon Slave
writedataInputAvalon SlaveAvalon Slave
waitrequestOutputAvalon SlaveAvalon Slave
irqOutputAvalon SlaveInterrupt Sender
my_export_signalsInput, Output, or BidirGlobalConduit


Table 2. Avalon-MM Multi-Port Slave with Global Clock, Reset, and Export Signals
Signal TypeDirectionv7.1 and Earlier Interfacev7.2 and Later Interface

clk

InputGlobalClock Input (1)
resetInputGlobalClock Input (1)
s1_addressInputAvalon S1 SlaveAvalon S1 Slave

s1_read

InputAvalon S1 SlaveAvalon S1 Slave
s1_readdataOutputAvalon S1 SlaveAvalon S1 Slave
s1_writeInputAvalon S1 SlaveAvalon S1 Slave
s1_writedataInputAvalon S1 SlaveAvalon S1 Slave
s1_waitrequestOutputAvalon S1 SlaveAvalon S1 Slave
s1_export_signalsInput, Output, or BidirAvalon S1 SlaveS1 Conduit
s2_addressInputAvalon S2 SlaveAvalon S2 Slave
s2_readInputAvalon S2 SlaveAvalon S2 Slave
s2_readdataOutputAvalon S2 SlaveAvalon S2 Slave

s2_write

InputAvalon S2 SlaveAvalon S2 Slave

s2_writedata

InputAvalon S2 SlaveAvalon S2 Slave

s2_waitrequest

OutputAvalon S2 SlaveAvalon S2 Slave

s2_export_signals

Input, Output, or BidirAvalon S2 SlaveS2 Conduit


Table 3. Avalon-MM Master with Global Clock, Reset, Interrupt Input, and Export Signals
Signal TypeDirectionv7.1 and Earlier Interfacev7.2 and Later Interface

clk

InputGlobalClock Input (1)

reset

InputGlobalClock Input (1)

address

OutputAvalon MasterAvalon Master

read

OutputAvalon MasterAvalon Master

readdata

InputAvalon MasterAvalon Master

write

OutputAvalon MasterAvalon Master

writedata

OutputAvalon MasterAvalon Master

waitrequest

InputAvalon MasterAvalon Master

irq

InputAvalon MasterInterrupt Receiver

my_export_signals

Input, Output, or BidirGlobalConduit


Table 4. Avalon-MM Multi-Port Slave with Interface-Specific Clocks and Export Signals
Signal TypeDirectionv7.1 and Earlier Interfacev7.2 and Later Interface

s1_clk

InputAvalon S1 SlaveS1 Clock Input (1)

s1_reset

InputAvalon S1 SlaveS1 Clock Input (1)

s1_address

InputAvalon S1 SlaveAvalon S1 Slave

s1_read

InputAvalon S1 SlaveAvalon S1 Slave

s1_readdata

OutputAvalon S1 SlaveAvalon S1 Slave

s1_write

InputAvalon S1 SlaveAvalon S1 Slave

s1_writedata

InputAvalon S1 SlaveAvalon S1 Slave

s1_waitrequest

OutputAvalon S1 SlaveAvalon S1 Slave

s1_export_signals

Input, Output, or BidirAvalon S1 SlaveS1 Conduit

s2_clk

InputAvalon S2 SlaveS2 Clock Input (1)

s2_reset

InputAvalon S2 SlaveS2 Clock Input (1)

s2_address

InputAvalon S2 SlaveAvalon S2 Slave

s2_read

InputAvalon S2 SlaveAvalon S2 Slave

s2_readdata

OutputAvalon S2 SlaveAvalon S2 Slave

s2_write

InputAvalon S2 SlaveAvalon S2 Slave

s2_writedata

InputAvalon S2 SlaveAvalon S2 Slave

s2_waitrequest

OutputAvalon S2 SlaveAvalon S2 Slave

s2_export_signals

Input, Output, or BidirAvalon S2 SlaveS2 Conduit


Table 5. Avalon-MM Multi-Port Master and Slave with Interface-Specific Clocks
Signal TypeDirectionv7.1 and Earlier Interfacev7.2 and Later Interface

slave_clk

InputAvalon SlaveSlave Clock Input (1)

save_reset

InputAvalon SlaveSlave Clock Input (1)

slave_address

InputAvalon SlaveAvalon Slave

slave_read

InputAvalon SlaveAvalon Slave

slave_readdata

OutputAvalon SlaveAvalon Slave

slave_write

InputAvalon SlaveAvalon Slave

slave_writedata

InputAvalon SlaveAvalon Slave

slave_waitrequest

OutputAvalon SlaveAvalon Slave

master_clk

InputAvalon MasterMaster Clock Input (1)

master_reset

InputAvalon MasterMaster Clock Input (1)

master_address

OutputAvalon MasterAvalon Master

master_read

OutputAvalon MasterAvalon Master

master_readdata

InputAvalon MasterAvalon Master

master_write

OutputAvalon MasterAvalon Master

master_writedata

OutputAvalon MasterAvalon Master

master_waitrequest

InputAvalon MasterAvalon Master






       确定了需要哪些端口后,需要编写元件代码(Verilog或VHDL),在端口命名中,Altera推荐用如下命名方式,以便在导入component editor之后能自动识别成相应的interface type。


<interface type>_<interface name>_<signal type>[_n]


interface type如下表所示:


点击看大图


比如下面的端口定义:


module my_slave_irq_component (
    // Signals for Avalon-MM slave port “s1” with irq
    csi_clockreset_clk; //clockreset clock interface
    csi_clockreset_reset_n;//clockreset clock interface
    avs_s1_address;//s1 slave interface
    avs_s1_read; //s1 slave interface
    avs_s1_write; //s1 slave interface
    avs_s1_writedata; //s1 slave interface
    avs_s1_readdata; //s1 slave interface
    ins_irq0_irq; //irq0 interrupt sender interface
);
    input csi_clockreset_clk;
    input csi_clockreset_reset_n;
    input [7:0]avs_s1_address;
    input avs_s1_read;
    input avs_s1_write;
    input [31:0]avs_s1_writedata;
    output [31:0]avs_s1_readdata;
    output ins_irq0_irq;
    /* Insert your logic here */
endmodule







       当元件设置好端口,并编写完相应的Verilog或VHDL代码之后,并可以通过SOPC Builder中的Component editor集成进SOPC Builder中,用户并可以非常方便的调用。关于这部分内容请参考SOPC自定义元件的添加及运行

PARTNER CONTENT

文章评论3条评论)

登录后参与讨论

用户174501 2009-5-5 21:03

我以前用7.0的时候,做了一个添加七段数码管的实验。但是用8.0后再练习添加七段数码管的时候,发现,生成后的组建居然没有了输出的引脚,不知道为什么?请博主帮忙看看

用户191384 2009-2-21 00:31

很详细,收藏了。向博主学习!!!

用户170960 2008-12-13 22:57

向博主学习了,这个AVALON总线我一直觉得很神秘莫测呢,决心以后多多学习下这方面的知识
相关推荐阅读
用户1332143 2009-08-16 21:47
时序电路亚稳态分析
这篇文章是我对电子设计中,亚稳态问题的一种分析和总结。文章通过对数字电路中器件的工作机制的介绍,引出亚稳态问题的发生机制。并通过对亚稳态问题发生机制的探讨,用以得到一种能够清楚地,有的放矢地解决亚稳态...
用户1332143 2009-08-16 10:52
【推荐】ADF4350配置软件下载
p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">  随着现代半导体工艺的不断发展, 几十纳米级的CMOS工艺给数字电路带来了很大的恩惠, 但对模拟...
用户1332143 2009-08-14 12:47
【原创】基于NiosII及FT245BM的USB接口设计
以前做的一个项目,FPGA接收AD采集数据后,通过串口发送回PC机,由于串口传输速率较低,对于实时性要求较高的场合不太适用,因此站长选用FT245BM芯片来实现USB接口传输,本文主要讲解FT245B...
用户1332143 2009-08-13 14:56
【原创】MAXII:UFM中晶振的使用
MAXII系列CPLD中带有UFM模块,本文主要讲解UFM中晶振的使用,具体内容请点击下面链接MAXII:UFM中晶振的使用...
用户1332143 2009-03-01 21:53
【原创】如何使用FPGA进行信号调制
       最近要做一个通信收发系统项目,以前对收发器的射频前段关注的比较多,而对基带部分的信号处理一直没有仔细研究。因此,正好借这个项目,熟悉整个基带部分的信号处理流程。       基带部分主要...
用户1332143 2009-02-27 21:56
寒假回来——FPGA市场评论
寒假在家里电脑不能上网,好久没来更新自己的博客了,首先感谢大家对我博客的支持。回来后马上开始了一个863项目,一直没有时间来写博客,今天总算有时间,上来看看。回来这段时间关注了下FPGA的相关新闻,发...
我要评论
3
9
关闭 站长推荐上一条 /3 下一条