diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-12-20 12:44:12 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-12-20 12:44:12 +0100 |
commit | 9366676ed5074cf1efee95382cf99728bc3707e7 (patch) | |
tree | 5492233830cf37681a3a8bbba82b21e6d107947f /src/bitmap-ball.py | |
parent | da810896f4c249d61f00e9e413d82dad2ad2058e (diff) |
ball pixeldata in memory IP core
Diffstat (limited to 'src/bitmap-ball.py')
-rwxr-xr-x | src/bitmap-ball.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bitmap-ball.py b/src/bitmap-ball.py index 4d5be0c..25b7fd3 100755 --- a/src/bitmap-ball.py +++ b/src/bitmap-ball.py @@ -21,10 +21,10 @@ def pixeldata(): if __name__ == "__main__": # get array of 12-bit pixels pixels = pixeldata() - # declare rom_t as array with size len(pixels) and word width of 12 bits - print(f"type rom_t is array (0 to {len(pixels) - 1}) of std_logic_vector(11 downto 0);") - # format pixel value as x"rgb" (12-bit hexadecimal with padding) - formatted_pixels = [f"x\"{hex(c)[2:].zfill(3)}\"" for c in pixels] - # print constant bitmap_ball - print(f"constant bitmap_ball: rom_t := ({', '.join(formatted_pixels)});") + # coe file header + print("memory_initialization_radix=16;\nmemory_initialization_vector=", end='') + # format pixel value as 12-bit hexadecimal with padding seperated by comma and space + formatted_pixels = ','.join([f"{hex(c)[2:].zfill(3)}" for c in pixels]) + print(f"{formatted_pixels};") + |