dzx-dzx / UDP

Apache License 2.0
2 stars 0 forks source link

Notice on Vivado simulation #5

Open dzx-dzx opened 2 years ago

dzx-dzx commented 2 years ago

SpinalHDL can neither add macro definition to Verilog source nor add flags when invoking Xsim.

dzx-dzx commented 2 years ago

When simulating with iverilog, dumpWave enables waveform output. But the very same function will cause Vivado to fail:

Exception in thread "main" java.lang.Exception: basic_string::_M_construct null not valid
dzx-dzx commented 2 years ago

Errr...The auto-generated project cannot be simluted or synthesized in Vivado IDE. One workaround is to update the IP.

dzx-dzx commented 2 years ago

DO NOT forget to add the macro SIM_SPEED_UP! It's not fun waiting hours after hours as the rx data waveform was in the state of stasis...

dzx-dzx commented 2 years ago

Errr...The auto-generated project cannot be simluted or synthesized in Vivado IDE. One workaround is to update the IP.

Can we update it prior to the simulation? At least files extracted from./TopLevel_xsim.srcs/sources_1/ip doesn't work.

dzx-dzx commented 2 years ago

clk in udp_40G_TOP should be redundant, but without it there would be an error message saying key not found.

dzx-dzx commented 2 years ago

When simulating with iverilog, dumpWave enables waveform output. But the very same function will cause Vivado to fail:

Exception in thread "main" java.lang.Exception: basic_string::_M_construct null not valid

Trying to replace loop driven clock logic by reconfiguring SpinalConfig's defaultFrequency and adding

ClockDomain(dut.io.gt_ref_clk_p_40MAC_0).forkStimulus(19200000) 
      // 156.25 MHz on base frequency 3e3 GHz
      ClockDomain(dut.io.sys_clk_p).forkStimulus(1000000) 
      // 600 MHz

Results in the very same error message... What a surprise, verilator can accept that.

dzx-dzx commented 2 years ago

The frequency configuration for gt_ref_clk and sys_clk borrowed from the original Verilog testbench(rewritten as:

fork {
        while (true) {
          dut.clockDomain.waitRisingEdge(48)
          dut.io.gt_ref_clk_p_40MAC_0 #= !dut.io.gt_ref_clk_p_40MAC_0.toBoolean
        }
      }
      fork {
        while (true) {
          dut.clockDomain.waitRisingEdge(25)
          dut.io.sys_clk_p #= !dut.io.sys_clk_p.toBoolean
        }
      }

) will render the module inoperative. No signs of data exchange on any port.(Always assert f)

dzx-dzx commented 2 years ago

Can't see signals from submodules in wdb, like EthernetTx.

dzx-dzx commented 2 years ago

The simulation takes forever...no less that half an hour, it must.

dzx-dzx commented 2 years ago
for (_ <- 0 until 1000000) {
    dut.packetClockDomain.waitRisingEdge()
    ...
}

One would expect the code after the waitRisingEdge to be executed right after the rising edge? No, it also waits for clk's edges. The signals don't align. There might be something to do with its non-integer frequency.

dzx-dzx commented 2 years ago

ClockDomain(dut.io.gt_ref_clk_p_40MAC_0).forkStimulus(19200000) // 156.25 MHz on base frequency 3e3 GHz ClockDomain(dut.io.sys_clk_p).forkStimulus(1000000) // 600 MHz

Oh the number is too large. Now implemented in cfddf82943564e7930f185a99761ecda1f040cb7.

dzx-dzx commented 2 years ago

My…I've upgrade the xci.

  1. Start the simulation, and then open the generated project.
  2. Correct the part version and upgrade IP.
  3. Disable core containers.
  4. Find xci in srcs, and source code in gen.
  5. Overwrite. (Don't add l_ethernet_0_gt)
dzx-dzx commented 2 years ago

You only need .xci files to boot up the simulation, but ALL of them. Some could be inside another IP's folder.

dzx-dzx commented 2 years ago

Hmm...

dzx-dzx commented 2 years ago

.addSimulatorFlag("-d SIM_SPEED_UP") doesn't do its job. Only .withSimScript.

dzx-dzx commented 2 years ago

You only need .xci files to boot up the simulation, but ALL of them. Some could be inside another IP's folder.

No that's not the problem...

The following IPs are either missing output products or output products are not up-to-date for Simulation target. Since these IPs are locked, no update to the output products can be done.

Maybe?