繁体   English   中英

如何在一个FPGA上实现多个独立的器件?

[英]How to implement several independent devices on one FPGA?

我需要在 FPGA (Altera Cyclone III) 上实现 2 个或更多独立设备。 例如:两个计数器一一二。 我怎么做这个? 以及如何并行使用此设备? 谢谢大家!

一切都在 FPGA 上并行发生。 这是 verilog 中的示例解决方案

计数器模块

module counter #(
    parameter pCntNum =1
    ) (
    input iClk,
    input iRst,

    output reg [7:0] oCnt
);
always @ (posedge iClk)
    if (iRst) begin
        oCnt <=0;
    end else begin
        oCnt <= oCnt +pCntNum;
    end    
endmodule

顶部模块

module top (
    input iClk,
    input iRst,

    output [7:0] oCntBy1,
    output [7:0] oCntBy2
);

    //Instantiate count by 1 module
    counter #(
        .pCntNum(1)
    )counter_by_1_inst(
        .iClk(iClk),
        .iRst(iRst),
        .oCnt(oCntBy1)
    );

    //Instantiate count by 2 module
    counter #(
        .pCntNum(2)
    )counter_by_2_inst(
        .iClk(iClk),
        .iRst(iRst),
        .oCnt(oCntBy2)
    );
endmodule

有很多方法可以做到这一点,但是我给出了一个解决方案,我认为它最能说明您的要求。

编辑:我刚刚看到了 VHDL 而不是 Verilog 的标签。 相同的方法和机制适用于 VHDL 解决方案,但 Quartus 接受 Verilog 和 VHDL 源文件(您甚至可以拥有包含两者的代码库)。 如果需要,通过一个简单的 VHDL 教程,您将能够创建一个与我编写的 Verilog 等效的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM