Origen-SDK / o2

MIT License
4 stars 0 forks source link

Pattern generation #98

Closed coreyeng closed 4 years ago

coreyeng commented 4 years ago

Hello,

Contrary to my closing remarks on #83, I have another large PR, though, I think in terms of pure additions/subtractions, less than half the size of the last. This one contains some of the groundwork for pattern generation, including what I think is valid V93K output (I didn't run it through anything though).

For the high level view, you can now write patterns and have it generate some meaningful output. I've got a few example patterns here and here, which will actually generate output:

FORMAT clk portc
R100 simple 0 ZZ # <EoL Comment>;
R16 simple 1 10 # <EoL Comment>;
R1 simple 0 10 # <EoL Comment>;
R1 simple 1 10 # <EoL Comment>;
R1 simple 0 10 # <EoL Comment>;
R1 simple 1 10 # <EoL Comment>;
R1 simple 0 10 # <EoL Comment>;
R1 simple 1 10 # <EoL Comment>;
R1 simple 0 10 # <EoL Comment>;
R1 simple 1 10 # <EoL Comment>;
R1 simple 0 10 # <EoL Comment>;
R25 simple 0 00 # <EoL Comment>;
SQPG STOP;
FORMAT clk portc
R100 simple 0 ZZ # <EoL Comment>;
# Producing pattern at index 2
R20 simple 0 ZZ # <EoL Comment>;
SQPG STOP;

The later will also generate three patterns, each named with the postfix.

In addition to combining cycles, I also have a pin state combiner` which should clean up superfluous pin state changes and leave the way clear for the cycle combiner.

One unfortunate thing that I wasn't able to find a workaround for was that the dut and tester from the standard context must be functions, so the () are required. The standard context now returns these as lambda functions which are run to give the most up-to-date DUT. Without that, Python sends a reference to the object, but there's no easy way I could tell to fully unload it when we want to re-initialize the target within a similar context, such as in a produce_pattern loop.

Some other notes:

This is still a work in progress, but I think there's enough groundwork to warrant a review, and probably enough to where someone could pick up program generation, if there's any volunteers.