From 9366676ed5074cf1efee95382cf99728bc3707e7 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 20 Dec 2022 12:44:12 +0100 Subject: ball pixeldata in memory IP core --- src/bitmap-ball.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/bitmap-ball.py') 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};") + -- cgit v1.2.3