microprobe.code.TraceSynthesizer

class TraceSynthesizer(target, wrapper, **kwargs)[source]

Bases: Synthesizer

Trace synthesizer.

The Trace Synthesizer objects are in charge of creating Benchmark objects based on a set of passes that have been previously defined. They operate in a similar fashion as Synthesizer objects but differ on how the benchmark object is dumped. In this case a dynamic execution trace is dumped (i.e. an execution trace). Required dynamic information should be provided by the registered passes.

The default structure of the benchmarks being synthesized is as follows:

  1. wrapper.headers() contents

  2. Dynamic execution trace from:

  • <benchmark initialization code>

  • <benchmark building blocks>

  • <benchmark finalization code>

__init__(target, wrapper, **kwargs)[source]

Create a Synthesizer object.

Parameters
  • target (Target) – Benchmark target

  • wrapper (Wrapper) – Wrapper object defining the output format

  • value (int) – Default immediate value used for non-initialized immediates (Default: random)

  • no_scratch (bool) – Disable automatic declaration of scratch variables required for code generation support (Default: False)

  • extra_raw (list of elements containing a name and a value attributes (Default: [])) – List of extra raw strings to be embedded in the final output

Returns

A Synthesizer instance

Return type

Synthesizer

Methods

__init__(target, wrapper, **kwargs)

Create a Synthesizer object.

add_pass(synth_pass[, thread_idx])

Add a pass to the benchmark synthesizer.

save(name[, bench, pad])

Save a benchmark to disk.

set_current_thread(idx)

synthesize()

Synthesize a benchmark.

Attributes

target

Target attribute (Target).

wrapper

Wrapper attribute (Wrapper).




add_pass(synth_pass, thread_idx=None)

Add a pass to the benchmark synthesizer.

Parameters

synth_pass (Pass) – New pass to add.

save(name, bench=None, pad=None)

Save a benchmark to disk.

Save a synthesized benchmark to disk. If bench is not specified a benchmark is automatically synthesized using the synthesize() method.

Parameters
  • name (str) – Filename to save

  • bench (Benchmark) – Benchmark to save (Default value = None)

set_current_thread(idx)
synthesize()

Synthesize a benchmark.

Synthesize a benchmark based on the set of passes that have been added using the add_pass() method.

Returns

A new synthesized benchmark

Return type

Benchmark

property target

Target attribute (Target).

property wrapper

Wrapper attribute (Wrapper).