microprobe.code.TraceSynthesizer
- class TraceSynthesizer(target: Target, wrapper: Wrapper, show_trace: bool = False, maxins: int = 10000, start_addr: Address | None = None, no_scratch: bool = False, extra_raw: Dict[str, str] = {}, value='random', threads: int = 1)[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 asSynthesizer
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:
wrapper.headers()
contentsDynamic execution trace from:
<benchmark initialization code>
<benchmark building blocks>
<benchmark finalization code>
- __init__(target: Target, wrapper: Wrapper, show_trace: bool = False, maxins: int = 10000, start_addr: Address | None = None, no_scratch: bool = False, extra_raw: Dict[str, str] = {}, value='random', threads: int = 1)[source]
Create a Synthesizer object.
- Parameters:
target (
Target
) – Benchmark targetwrapper (
Wrapper
) – Wrapper object defining the output formatvalue (
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 aname
and avalue
attributes (Default: [])) – List of extra raw strings to be embedded in the final output
- Returns:
A Synthesizer instance
- Return type:
Methods
__init__
(target, wrapper[, show_trace, ...])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 a benchmark.
Attributes
Target attribute (
Target
).Wrapper attribute (
Wrapper
).
- add_pass(synth_pass: Pass, thread_idx: int | None = None)
Add a pass to the benchmark synthesizer.
- Parameters:
synth_pass (
Pass
) – New pass to add.
- save(name: str, bench: Benchmark | None = None, pad: int | None = 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.
- 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: