Module 3: BrianHG_GFX_Window_DDR3_Reader.sv update:
Finished all the IO, definitions and testbench setup. Next onto the formulai and testing in my DDR3 1080p example.
Here are your new window controls with description exposed to the Z80:
input [2:0] CMD_win_bpp [0:LAYERS-1], // Bits per pixel. For 1,2,4,8,16a,32,16b bpp, use 0,1,2,3,4,5,6. *16a bpp = 4444 RGBA, 16b bpp = 565 RGB.
input [31:0] CMD_win_base_addr [0:LAYERS-1], // The beginning memory address for the window.
input [HC_BITS-1:0] CMD_win_bitmap_width [0:LAYERS-1], // The full width of the bitmap stored in memory. If tile mode is enabled, then the number of tiles wide.
input [HC_BITS-1:0] CMD_win_bitmap_x_pos [0:LAYERS-1], // The beginning X pixel position inside the bitmap in memory.
input [VC_BITS-1:0] CMD_win_bitmap_y_pos [0:LAYERS-1], // The beginning Y line position inside the bitmap in memory.
input [HC_BITS-1:0] CMD_win_x_offset [0:LAYERS-1], // The onscreen X position of the window.
input [VC_BITS-1:0] CMD_win_y_offset [0:LAYERS-1], // The onscreen Y position of the window.
input [HC_BITS-1:0] CMD_win_x_size [0:LAYERS-1], // The onscreen display width of the window. *** Using 0 will disable the window.
input [VC_BITS-1:0] CMD_win_y_size [0:LAYERS-1], // The onscreen display height of the window. *** Using 0 will disable the window.
input [3:0] CMD_win_scale_width [0:LAYERS-1], // Pixel horizontal zoom width. For 1x,2x,3x thru 16x, use 0,1,2 thru 15.
input [3:0] CMD_win_scale_height [0:LAYERS-1], // Pixel vertical zoom height. For 1x,2x,3x thru 16x, use 0,1,2 thru 15.
input [3:0] CMD_win_scale_h_begin [0:LAYERS-1], // Begin display part-way into a zoomed pixel for sub-pixel accurate scrolling.
input [3:0] CMD_win_scale_v_begin [0:LAYERS-1], // Begin display part-way into a zoomed pixel for sub-pixel accurate scrolling.
input [7:0] CMD_win_alpha_override [0:LAYERS-1], // When 0, the layer translucency will be determined by the graphic data.
// Any figure from +1 to +127 will progressive force all the graphics opaque.
// Any figure from -1 to -128 will progressive force all the graphics transparent.
input CMD_win_tile_enable [0:LAYERS-1], // Enable Tile mode enable. *** Display will be corrupt if the BrianHG_GFX_Video_Line_Buffer
// module's ENABLE_TILE_MODE parameter isn't turned on.
input [2:0] CMD_win_tile_bpp [0:LAYERS-1], // Defines the tile bits per pixel. For 1,2,4,8,16a,32,16b bpp, use 0,1,2,3,4,5,6. *16a bpp = 4444 RGBA, 16b bpp = 565 RGB.
input [15:0] CMD_win_tile_base [0:LAYERS-1], // Defines the beginning tile 16 bit base address (multiplied by) X 16 bytes for a maximum of 1 megabytes addressable tile set.
input [1:0] CMD_win_tile_width [0:LAYERS-1], // Defines the width of the tile. 0,1,2,3 = 4,8,16,32
input [1:0] CMD_win_tile_height [0:LAYERS-1], // Defines the height of the tile. 0,1,2,3 = 4,8,16,32
HC_BITS and VC_BITS are set to 16 meaning a maximum horizontal and vertical resolution of 65536 pixels or tiles.
LAYERS is a parameter which allows you to set the maximum available window layers.
All the above inputs are wired to incrementing addresses from the new HW_REGS module.
The tile/font and palette memory are also addressed as regular DDR3 memory as they are wired through the new TAP_xxx port.
It looks like you will need 32 bytes worth of controls per window.
We should double it just for spare future expansion.
So, once we configure a base offset for the HW_REGS, each progressive window layer will has the same controls, but beginning at +64 bytes above the previous window's beginning address.
Except for CMD_win_scale_h_begin & CMD_win_scale_v_begin inputs (which you probably not want to use unless it is something special), this new window module does all the cruddy math work internally when addressing sub-pixel positions with regards to tile/font and the input CMD_win_bitmap_x/y_pos settings so you just enter the coordinate you want and my window HDL will automatically work out the sub-pixel addressing within each tile or bitmap below 32bit for you.
When choosing a base address and bitmap width, it is still recommended that you pad the address and size to every 32 bytes to make the most of the new BrianHG_DDR3_Memory_Copy_Manager.sv coming in the new year which will copy memory from A->B with functions which can be used for general memory copying with advanced functions for graphics, sound mixing/blending/processing where 128/256bit mode is the fastest, but to use the 128/256 bit mode, your source and destination memory pointers will need to be located on 128/256bit boundaries. Otherwise, 64bit mode is half speed, 32bit mode is half that, 16 bit mode is half that, and 8 bit mode is half that.