添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
喝醉的铁板烧  ·  Intro to JaCoCo | ...·  10 月前    · 
风流的芹菜  ·  源码编译安装httpd - ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to use an interface the following interface, which is declared in <Project Directory>/OtterMCU.srcs/sources_1/new/BranchPredictor.sv like so:

import Types::*;  // a package that provides the func3_t enum
interface BranchPredictor(
    input clk,
    input reset
    logic id_is_branch;
    func3_t id_branch_type;
    logic [31:0] id_pc;
    logic ex_branched;
    func3_t ex_branch_type;
    logic [31:0] ex_pc;
    logic should_branch;
    modport Predictor(
        input id_is_branch,
        input id_branch_type,
        input id_pc,
        input ex_branched,
        input ex_branch_type,
        input ex_pc,
        output should_branch
    modport ID(
        output id_is_branch,
        output id_branch_type,
        output id_pc,
        input should_branch
    modport EX(
        output ex_branched,
        output ex_branch_type,
        output ex_pc
endinterface 

When I use it in another module, Vivado gives an undeclared type error:

[Synth 8-3892] undeclared type 'BranchPredictor'  ["<redacted>/OtterMCU.srcs/sources_1/new/OTTER_MCU.sv":78]

Here's how it's used in a module (filename <Project Directory>/OtterMCU.srcs/sources_1/new/OTTER_MCU.sv):

module OTTER_MCU(/*...*/);
    // ...
    BranchPredictor ibpred();  // this is the offending line
    // ...
    IDStage id_stage(
        .predictor(ibpred.ID),  // this module uses one of the modports
        // ...
    // ...
endmodule

What am I doing wrong?

This is a Vivado specific problem. The order of compilation of modules and interfaces should not matter – dave_59 Mar 3, 2021 at 2:16

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.