Finally, actually reading a PGM file in VHDL
And so, finally, after all that setup, some code to read PGM files and how to make use of it. Next stage will be writing some files! As always, the code can be found on github
Browse the notebook
And so, finally, after all that setup, some code to read PGM files and how to make use of it. Next stage will be writing some files! As always, the code can be found on github
Having written a function to read a PGM image, how do we use it? Well, the testbench at the bottom of the pgm vhdl file has an example: variable i : pixel\_array\_ptr; -- Without the transpose function, we would have to …
Having set up a library for reading images, let’s now go on to read an image in! pgm_read Recall, we have a function: impure function pgm_read (filename : string) return pixel_array_ptr; So, some declarations - …
Data storage One of the things VHDL can do (contrary to popular belief :)) is 2-D arrays. So reading images into a 2-D array is a very natural way to store the data. We’ll create a package called pgm to keep all …
procedure assert_equal ( prefix'event : string; got, expected : integer; level : severity_level := error) is begin assert got = expected report prefix & " wrong. Got " & integer'image(got) & …