Ok, here is the complete GEOMETRY unit test-bench. After all this work, I found some hidden errors in the blitter unit, so this post also includes a full update to the 'GPU_EP4CE10' project. Please test and let me know if it works as a numerous minor 'invisible' glitches/bugs were uncovered and patched.
For the geometry test-bench, it is a stand-alone SystemVerolog project which you only need ModelSim running to run. Just un-zip the 'GPU_GEOMETRY_Testbench_v1.0.zip', open ModelSim, select 'File - Change Directory...', then type in the transcript:
do setup.do > sets up ModelSim
do run.do > Re-compiles & runs the test-bench executing the default 'GEO_tb_command_list.txt'.
The results should be:
1. A waveform with the Script_CMD and LINE# showing you all the generated waveforms.
2. Three .bmp pictures.
3. A log file 'GEO_tb_command_results.txt' showing you the sent commands.
Geometry command list in the ascii .txt file:
******************************************************************************************************************
Commands: (*** No spaces allowed in any <FILE_NAME>)
[at]LOG_FILE <FILE_NAME> > Generates a results log file. (No spaces allowed in file name).
[at]END_LOG_FILE > Forcefully closes/ends the log file.
[at]STOP > Stops the script processing/simulation. Click on 'run -all' to continue script after the stop command.
[at]END > Ends the script processing/simulation. (You may now paint/set youw own manual controls in the waveform view and run -all)
[at]LOAD_GPU_RAM <file_name.bin> > Reads a binary file, up to 1 megabyte, into the GEO pixel-writer memory.
[at]SAVE_GPU_RAM <file_name.bin> > Saves GEO pixel-writer 1 megabyte memory into a binary file.
[at]CLR_GPU_RAM > Clears the GPU memory
[at]CLR_BMP <color_byte> > Clears the test geometry_plotter bitmap memory to a set byte. (This is not the pixel writer)
[at]SAVE_GEO_BMP <FILE_NAME> <width> <height> <1=B&W> > Saves a 256 color BMP picture of the geometry_plotter's output, NOT GPU Ram. Max 2048x2048. <1=B&W> or 0 for dummy 256 color palette
[at]SAVE_PIXIE_BMP <FILE_NAME> <src/dest> <width> <height> <1=B&W> > Saves a 256 color BMP picture of the pixie-writer system GPU memory. SET_PAGET settings must be set & PIXIE must be enabled prior to draw commands. <1=B&W> or 0 for dummy 256 color palette
[at]RESET > Sends a reset to the geometry unit.
[at]ENA_PIXIE <0/1> > Enables/disables pixel writer. (Pixel writer is disabled by default)
[at]WAIT_IDLE <0/1> > Waits for the all processes to finish whatever they are currently doing before running next command. IE 1 command at a time.
[at]SEND_CMD <h0000-hFFFF> > send a raw command, 16 bit hex value
[at]SET_XY <x/y> <0..3> <decimal> > Sets 12 bit register X or Y with 12 bit decimal value 0-4095, basically calls SEND_CMD with the right value.
[at]SET_PAGET <src/dest> <base_address_hex> <width> <depth> > Sets PAGET's (pixel address generator) source/dest memory address, image width, color depth in bits/pixel = (1/2/4/8/16).
[at]SET_MAX_XY <x> <y> > Sets the maximum destination XY resolution.
[at]DRAW PIXEL <X> <Y> <c> > Draws a dot at coordinates [XY], c=color(0..255)
[at]DRAW LINE <aX> <aY> <bX> <bY> <c> > Draws a line from coordinates a[XY] to b[XY].
[at]DRAW BOX <aX> <aY> <bX> <bY> <c> <f> > Draws a box from top left a[XY] to bottom right b[XY] coordinates. f=fill(0/1)
[at]DRAW TRI <aX> <aY> <bX> <bY> <cX> <cY> <c> <f> > Draws a triangle with coordinates [abc][XY].
[at]DRAW QUAD <tlX> <tlY> <trX> <trY> <brX> <brY> <blX> <blY> <c> <f> > Draws a quadrilateral, tl=Top Left, tr=Top Right, br=Bottom Right, bl=Bottom Left.
[at]DRAW ELLI <Xc> <Yc> <Xr> <Yr> <c> <q> <f> > Draws an ellipse. Q=Quadrant.
fill = 0/1
Quadrant = 0-3 to draw 1 of 4 quadrants.
Quadrant = 4 to draw all 4 quadrants.
**** BLITTER must have PAGET (SRCE/DEST) set to function.
[at]BLIT TCOL <transparent_color> > [0.255] Selects which color in the source image will be transparent when doing a paste when paste mask is enabled.
[at]BLIT SIZE <px> <py> <width> <height> > Sets the source image top left pixel position (px,py) and the copy (width,height) in pixels.
[at]BLIT ZOOM <usX> <usY> <dsX> <dsY> > Sets blitter zoom, us=upsample float X/Y zooms up the SRCE image copy input 1.000000 to 4095.00000. (12 bit granularity)
ds=downsample float X/Y shrinks the DEST image paste output 1.000000 to 0.000245. (12 bit granularity)
[at]BLIT CONFIG <ena> <mask> <h-centp> <mirror> <v-centp> <flip> <r90> <r45>
ena = blitter off/on 1 = blitter on when writing pixels.
0 = blitter off when writing pixels.
mask = Transparancy mask enable. 1 = source transparent color pixels will not paste pixels onto destination, IE those colors are transparent.
0 = Every pixel from the source will paste onto the destination.
h-centp = horizontal center paste. 1 = Offset the paste to the left by half of blit_width.
0 = Use the paste coordinates as the beginning left.
mirror = Horizontal mirror paste. 1 = Mirror the output on the X axis.
0 = Off.
v-centp = Vertical center paste. 1 = Offset the paste up by half of blit_height
0 = Use the paste coordinates as the beginning top of the paste
flip = Vertical flip paste. 1 = Vertically flip the output on the Y axis.
0 = Off
r90 = Enable Rotate 90 degree. 1 = Swaps the X&Y coordinates on the paste.
r45 = Enable Rotate 45 degree. 1 = Increments/decrements the X&Y coordinates on the paste in unison.
[at]VWAIT <#of frames> <video line#> > Pause geometry processor until the #frames and video line# has been reached.
Frames = 1 thru 15, 0 = no wait
line = 0 thru 255 > (There is a hidden multiplier for line (1,2,4,8) to support video modes up to 2040 lines. Not supported in this demo.)
*****************************************************************************************************************
After the 'do run.do', you may execute the other example command scripts by typing:
do test_8bitfont.do
do test_45deg.do > Takes ~1 minute to simulate...
do test_art.do
do test_blitter.do
do test_blitter_hires.do > Takes ~1 minute to simulate...
do test_vwait.do
The above 'do test_****.do' only change the 'TB_COMMAND_SCRIPT_FILE' parameter to a new source script filename, then a 'restart -f', then a 'run -all' to run the simulation.
If everything works OK, this will end any additions to the current Geometry unit. The next version will be separated into 4 blocks, operate with 16bit X&Y coordinates with a 32/64 bit opcode while the pixel address generator and pixel writer will need upgrading to 32bit addressing, 32 bit color support and 256bit data bus for the ram.