Как я могу исправить присвоение более одной ошибки значения в Verilog? - PullRequest
1 голос
/ 21 марта 2019

Ниже приводится попытка изучения иерархического дизайна verilog.Это схема, которую я реализую: enter image description here

Модуль верхнего уровня для схемы:

 module D_Filiflop_Hierarchal_top_level (clock, reset, i_d, q);

    input clock;
    input reset;
    input i_d;
    output [1:0] q;


    D_Flipflop u0 (.clk(clock), .rst(reset), .q(q[0]), .d(i_d));
    D_Flipflop u1 (.clk(clock), .rst(reset), .q(q[1]), .d(q[0]));

endmodule


И далее определяется модуль D триггера:

module D_Flipflop(clk,rst, d, q);
input clk;
input rst;
output d;
output reg q;

always @ (posedge clk or posedge rst) begin

    if (rst) begin
    q <= 1'b0;
    end

    else begin
    q <= d;
    end

end 

endmodule

Но это консоль сообщений об ошибках, показывающая:

Error (12014): Net "q[0]", which fans out to "q[0]", cannot be assigned more than one value
    Error (12015): Net is fed by "D_Flipflop:u0|q"
    Error (12015): Net is fed by "D_Flipflop:u1|d"

enter image description here

Добрый совет, как я могу это исправитьошибка.

1 Ответ

4 голосов
/ 21 марта 2019

Изменить output на input для d:

module D_Flipflop(clk,rst, d, q);
input clk;
input rst;
input d;
output reg q;
...