In Quartus ii schematic diagram, i've generated an lpm_ff. Then i've converted the design to a .v file. when i want to use this flip-flop in a module, it compiles with no problems but when i want to simulate it with modelsim i receive this error for all defparams in the code in the :

Error: (vsim-10000) C:/.../lpm_ff_8.v(30): Unresolved defparam reference to 'LPM_WIDTH' in lpm_instance.LPM_WIDTH.

Here is the code of ff that Quartus generated:

module lpm_ff_8(clock,sload,data,q);
input clock;
input sload;
input [15:0] data;
output [15:0] q;

lpm_ff  lpm_instance(.clock(clock),.sload(sload),.data(data),.q(q));
    defparam    lpm_instance.LPM_AVALUE = 1;
    defparam    lpm_instance.LPM_FFTYPE = "DFF";
    defparam    lpm_instance.LPM_SVALUE = 0;
    defparam    lpmi_nstance.LPM_WIDTH = 16;


And the module i use this flip-flop in it:

module test(input [15:0] a, clk, output reg [15:0] q);
  lpm_ff_8 regg(.data(a), .clock(clk), .q(q));

module testTB();
  reg [15:0] a;
  reg clk;
  wire [15:0] q;
  test t(a, clk, q);
  initial begin
  #15 clk = 1;

I also add lpm_ver library when i want to simulate. So can you help me to find what's wrong with this code?

  • \$\begingroup\$ lpm_nstance and lpmi_nstance are different instance (second one has an i) \$\endgroup\$ – Greg May 29 '17 at 18:18
  • \$\begingroup\$ Also, check your compile log for warnings and try to resolve them. Certain run time errors can be resolved by fixing compile time warnings. \$\endgroup\$ – Greg May 30 '17 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.