2016-11-16 26 views
-1

我是systemverilog的新手,我有這個錯誤,我似乎無法弄清楚。這是錯誤消息:不能隱式地連接實例錯誤的端口

錯誤(10897):在TopLevel.sv SystemVerilog的誤差(103):不能 隱含上 模塊的實例 「control_module」 連接端口 「ALU_SRC_B」 「對照」 - 沒有這樣的對象是在本範圍可見

這是真實失敗的一段代碼:

// Control module 
Control control_module (
    .Instruction(Instruction[8:5]), 
    .ALU_OP, 
    .ALU_SRC_B, 
    .REG_WRITE, 
    .BRANCH, 
    .MEM_WRITE, 
    .MEM_READ, 
    .REG_DST, 
    .MEM_TO_REG, 
    .HALT(HALT) 
); 

這是我的控制模塊:

module Control(
    input  [8:0] Instruction, 
    output logic [3:0] ALU_OP, 
    output logic [1:0] ALU_SRC_B, 
    output logic  REG_WRITE, 
    output logic  BRANCH, 
    output logic  MEM_WRITE, 
    output logic  MEM_READ, 
    output logic  REG_DST, 
    output logic  MEM_TO_REG, 
    output logic  HALT 
    ); 

    logic [3:0] OPCODE = Instruction[8:5]; 
    always_comb begin 
... 

控制模塊在正確的目錄中,爲什麼我會得到這個錯誤?

+2

你在哪裏實例Control control_module('你有一個wire calle d'ALU_SRC_B'?我們需要看到導線以及實例。 – Morgan

+2

請粘貼您的所有tb代碼 – noobuntu

回答

2

我試了一下你的代碼,你得到這個消息的原因是,對於你的未連接端口control_module,你需要顯示空的括號來表明它沒有連接。否則,你會看到如下所示的消息(這有點神祕)。

TESTBENCH:

module tb; 

    wire[8:0] Instruction; 
    wire  HALT; 
// Control module 
Control control_module (
    .Instruction(Instruction[8:5]), 
    .ALU_OP(), 
    .ALU_SRC_B(), 
    .REG_WRITE(), 
    .BRANCH(), 
    .MEM_WRITE(), 
    .MEM_READ(), 
    .REG_DST(), 
    .MEM_TO_REG(), 
    .HALT(HALT) 
); 

    initial begin 
    #100ns 
    $finish; 
    end 

endmodule 

設計:

// Code your design here 
module Control(
    input  [8:0] Instruction, 
    output logic [3:0] ALU_OP, 
    output logic [1:0] ALU_SRC_B, 
    output logic  REG_WRITE, 
    output logic  BRANCH, 
    output logic  MEM_WRITE, 
    output logic  MEM_READ, 
    output logic  REG_DST, 
    output logic  MEM_TO_REG, 
    output logic  HALT 
); 

endmodule 

您可以在這裏找到工作的例子:https://www.edaplayground.com/x/63Eq

嘗試取出空方括號中的一個,注意你得到同樣的錯誤消息..

-1

該錯誤意味着您沒有在實例化控制模塊的範圍內聲明ALU_SRC_B

相關問題