【问题标题】:Verilog output value X in Gate Level门级中的 Verilog 输出值 X
【发布时间】:2014-08-27 13:49:09
【问题描述】:

我正在尝试制作一个最多计数为 18 的计数器,从那里它需要回到 0。我使用 D 触发器设计了它,我使用 K-Map 计算了函数并尝试实现它在 ISE 设计套件的门级进行设计。

但是当我尝试在 Simulation 中对其进行测试时,除时钟之外的所有值始终为 X。我不知道这意味着什么以及如何克服它。

这是我的代码:

module denemeff(A, B, C, D, E, C_CLK);

output A, B, C, D, E;
input C_CLK; // C_CLK stands for Common Clock.
wire C_CLK;
wire A, B, C, D, E;
wire A_BAR, B_BAR, C_BAR, D_BAR, E_BAR;
wire Da, Db, Dc, Dd, De;
wire Da_1, Da_2, Db_1, Db_2, Db_3, Dc_1, Dc_2, Dc_3, Dd_1, Dd_2, Dd_3, De_1, De_2;
not notA(A_BAR, A);
not notB(B_BAR, B);
not notC(C_BAR, C);
not notD(D_BAR, D);
not notE(E_BAR, E);


//Operations for Da
and Da_and_1(Da_1, A_BAR, B, C, D, E);
and Da_and_2(Da_2, A, B_BAR, C_BAR, D_BAR);
or Da_final(Da, Da_1, Da_2);

//Operations for Db
and Db_and_1(Db_1, A_BAR, B, E_BAR);
and Db_and_2(Db_2, A_BAR, B, D_BAR);
and Db_and_3(Db_3, A_BAR, B, C_BAR);
or Db_final(Db, Db_1, Db_2, Db_3);

//Operations for Dc
and Dc_and_1(Dc_1, A_BAR, C_BAR, D, E);
and Dc_and_2(Dc_2, A_BAR, C, D_BAR);
and Dc_and_3(Dc_3, A_BAR, C, E_BAR);
or Dc_final(Dc, Dc_1, Dc_2, Dc_3);

//Operations for Dd
and Dd_and_1(Dd_1, B_BAR, C_BAR, D_BAR, E);
and Dd_and_2(Dd_2, A_BAR, D_BAR, E);
and Dd_and_3(Dd_3, A_BAR, D, E_BAR);
or Dd_final(Dd, Dd_1, Dd_2, Dd_3);

//Operations for De
and De_and_1(De_1, A_BAR, E_BAR);
and De_and_2(De_2, B_BAR, C_BAR, D_BAR, E_BAR);
or De_final(De, De_1, De_2);

dff d_ff_a(A, A_BAR, Da, C_CLK);
dff d_ff_b(B, B_BAR, Db, C_CLK);
dff d_ff_c(C, C_BAR, Dc, C_CLK);
dff d_ff_d(D, D_BAR, Dd, C_CLK);
dff d_ff_e(E, E_BAR, De, C_CLK);

endmodule

module dff(Q, Q_BAR, D, CLK);

input D, CLK;
output Q, Q_BAR;

wire D, CLK;
wire Q, Q_BAR;

not not1(D_BAR, D);

nand n1(X, D, CLK);
nand n2(Y, D_BAR, CLK);
nand n3(Q, Q_BAR, X);
nand n4(Q_BAR, Q, Y);

endmodule

【问题讨论】:

    标签: simulation verilog hdl


    【解决方案1】:

    您需要重置您的触发器。根据您当前的 DFF 描述,Q 的初始输出值是未知的,并且无法将其重置为已知值。因此,您会看到 x 值。

    请参阅此处了解一些具有异步复位的基于 NAND 的 DFF 设计:

    http://userpages.umbc.edu/~squire/cs313_l22.html

    或者只是从行为上定义它们:

    http://www.asic-world.com/examples/verilog/d_ff.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-10
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多