Skip to content

Latest commit

 

History

History
70 lines (61 loc) · 8.13 KB

0043-2020-07-15.md

File metadata and controls

70 lines (61 loc) · 8.13 KB

15 Jul 2020

More commits on t08f:

  • e50a956: "Ball now bounces if it hits the paddle. Otherwise it goes off screen and gets weird". Ball/paddle hit test is very simple: hit reg tracks whether, during the frame, there was any moment when inBallX, inBallY, inPaddle, and wallL were all simultaneously assertd. If so, it counts as a hit, and hence the ball must start (or continue) moving right. hit is reset upon the start of the next frame. If the ball goes off the screen (to the left), it will end up wrapping around on X, leading to a brief time when it is not visible before it pops out of the right edge of the screen again, moving left. However, when off the screen, the inBallX calculation becomes invalid, so stripes end up flashing across the screen.
  • 05eeea5: "Don't try rendering ball while it is off screen". This fixes the glitches (stripes) when the ball goes off the screen. We use the time while the ball is off screen to our advantage, showing the player they lost, but we also have a simple test to ensure inBallX doesn't get asserted if the ball is not in the proper visible area. NOTE: The first fit I found for this was pterms=54, inputs=54.
  • 37eb232: "Minor change". Adding speaker net, but not connected. Tried changing inPaddle logic to be more like other trackers, but later I end up reverting this for more flexibility.
  • fd03674: "Simple hit sound, but not quite fitting yet". Initial attempt to use v line counter to produce a "hit" tone, plus some optimisations.
  • 208c4c5: "Paddle hit sound works with pterms 38, inputs 54". Simplified tone generator a tiny bit. Now it fits (and works) to produce a tone just for when the ball hits the paddle. Not sure what modes I used for synthesis and fitter, but they're in the .xise.
  • a2754f9: "Adding g.sh script for super-exhaustive XST/fitter loops". Initial attempt to synthesize and fit from command-line, in a way that tries lots of different combinations that we can control.
  • 5907d3a: "XC95 t08f: Faster ball, long hit tone, optimisations. Fits with Speed/High+Speed, 29/54". hit (for tone generator) now lasts a bit longer (instead of getting shorter the lower down the screen the hit occurs) because it's now asserted where a ball/paddle intersection is first detected, and then cleared when we next start rendering the top of the paddle. This gives us a tone that lasts the duration of about 1 frame. There are also a few other minor optimisations and the ball speed is now doubled (which makes it a bit more challenging). Also, I think this is the first time I built the .jed file directly from source using g.sh. Note that info on the end of the commit message means g.sh was able to get a fit by doing Synthesis (xst) with "Speed" optimisation set to "High" effort, and Fit (cpldfit) set to use Speed optimisation also, and pterms limit of 29 with inputs limit of 54.
  • 1b01869: "XC95 t08f: Bounce sound on right wall. Area/High+Speed, 15/54". Adding a tone to the right wall, too. Some minor improvements to g.sh.
  • 02c591b: "XC95 t08f-opt3: Tones on all collisions now. Lots of arcane optimisation. Fits with: -ignoretspec, Area/Normal+Speed, 23/54". Mucking around with lots of tough optimisations so we can fit in a ball tone for all 3 walls and the paddle. Not quite working right: Top and bottom tones are more of a "tick" sound rather than an actual tone.
  • 477551d: "XC95 t08f-opt3: Different tones for wall vs. paddle, and back to simpler comparators. -ignoretspec with Speed/Normal+Speed, 22/54". Went back to using simple comparators instead of bit tests, and it seems to work well now. Top wall tone is slightly longer than any other, but I don't care.
  • 11c57db: "XC95 t08f: A little bit of tidying now that I'm trying to wrap this one up". Just as it says, though I accidentally deleted the .rpt file (included in the next commit: acfb4ad).

Fitter results:

Macrocells     Product Terms    Function Block   Registers      Pins           
Used/Tot       Used/Tot         Inps Used/Tot    Used/Tot       Used/Tot       
69 /72  ( 96%) 237 /360  ( 66%) 163/216 ( 75%)   50 /72  ( 69%) 7  /52  ( 13%)

These are some quick notes for using g.sh:

  1. Make sure the file has execute permission set: chmod +x g.sh
  2. Symlink the file into your home directory.
  3. Build a specific testNN/tNNR project in XISE first. Even if it fails, it will still create our .prj file.
  4. Start running through different settings combos by running g.sh in the command-line:
    cd ~
    ./g.sh NNR
    ...where NNR is (say) 08f if you want to build test08/t08f.
  5. If you want to control the number of pterms it tries in each iteration, the total args it supports are: ./g.sh project [maxpterms [minpterms]]
    • maxpterms defaults to 90.
    • minpterms defaults to 10.

Note that it will give output resembling this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/shared_projects/sandpit/fpga/XC9572XL/test08/t08f/working ~
~~~~~~ Running again with options:
~~~ opt_level:           1
~~~ opt_mode:            speed
~~~ optimize (cpldfit):  speed
~~~ ignoretspec:         0
~~~ pld_xp:              NO
~~~ pld_mp:              NO
~~~ mux_extract:         Yes
~~~ resource_sharing:    YES
~~~ fsm_encoding:        Compact
~~~ pld_ce:              NO
~~~ keep_hierarchy:      No
~~~ loc:                 on
XST: OK
Translate: OK
Fit: ()988888888887777777777666666666655555555554444444444333333333322222222221111111111
Fit: ()o987654321o987654321o987654321o987654321o987654321o987654321o987654321o987654321o
Fit: ().....................................................................
FIT: 22

...where the last line will be either the number of pterms on which it found a fit (and will be highlighted in green) or will be FAIL (and highlighted in red).

The number strings represent "columns" showing the pterms number it is trying at each "dot" step. Reading the numbers vertically, it starts at 9o (90), then 89, 88 ... and it found a fit during 22.

Note that there are two extra environment vars you can pass to g.sh:

  • FIND_ALL_FITS=1 -- Will attempt to test all pterms combos to show each that succeeds.
  • FIND_ALL_COMBOS=1 -- Will try all settings combinations, i.e. not just stop at the firs that succeeds.