0

I'm using the VLAB MPC5xxx Toolbox.

I have a run script that is controlling my simulation, which loads the platform in the usual way, then runs it:

import vlab
import os
import sysc

image_path = os.path.join('o5e',
                          'firmware.open5xxxecu-e6009bbcfcd1',
                          'bin', 'o5e_dbg.elf')

vlab.load('mpc.mpc5674f.sim', args=['--testbench=o5e_testbench', 
                                    "--image=%s" % image_path,
                                    "--debugger-config=GHS_MULTI",
                                    "--trace=+src:sc_report",
                                    ])
vcd_sink = vlab.trace.sink.vcd("mpc.mpc5674f.sim.vcd")
vlab.add_trace("mpc5674f.PBRIDGE.EDMA_B", sink=vcd_sink)

for i in range(32):
        vlab.add_trace("mpc5674f.PBRIDGE.ETPU.CH_OUT_A[%d]" % i, sink=vlab.trace.sink.console)

vlab.run(11, "ms", blocking=True)
vlab.exit()

I want to give this run script an argument to turn on tracing in the core, which I know you do by setting the tracing attribute on the core. And I know I can read the options of the script using python's optparse.

The problem I have is that you have to set the attribute before the end of elaboration, but the only place I can access the simulation before elaboration is in the testbench... but there seems to be no way to pass parameters (for example script arguments) to the testbench.

How should I pass the argument from my script into the testbench, so it conditionally turns on or not the core tracing?

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98

1 Answers1

1

So, I think the answer is:

1) Don't use try to use the testbench for things that aren't to do with ... a testbench

2) Use "phase breakpoints" to do things that need to happen at... specific phases in the simulation

eg:

from optparse import OptionParser

parser = OptionParser()

parser.add_option("--core-instrumentation", dest="core_instrumentation",
                  action = "store_true",
                  help="turn on core instrumentation")

(options, args) = parser.parse_args()

if options.core_instrumentation:
    vlab.add_phase_breakpoint("before_end_of_elaboration", 
                              action = lambda bp: vlab.write_attribute("mpc5467f.Core0.log_filter","+instr"))

image_path = os.path.join('o5e',
                      'firmware.open5xxxecu-e6009bbcfcd1',
                      'bin', 'o5e_dbg.elf')

vlab.load('mpc.mpc5674f.sim', args=['--testbench=o5e_testbench', 
                                    "--image=%s" % image_path,
                                    "--debugger-config=GHS_MULTI",
                                    ])
vcd_sink = vlab.trace.sink.vcd("mpc.mpc5674f.sim.vcd")
vlab.add_trace("mpc5674f.PBRIDGE.EDMA_B", sink=vcd_sink)

for i in range(32):
        vlab.add_trace("mpc5674f.PBRIDGE.ETPU.CH_OUT_A[%d]" % i, sink=vlab.trace.sink.console)

vlab.run(11, "ms", blocking=True)
vlab.exit()
GreenAsJade
  • 14,459
  • 11
  • 63
  • 98
  • Note that this run script has taken responsibility for all the command line arguments, and does not pass them on to to the MPC toolbox. – GreenAsJade Aug 07 '14 at 04:37