W
wallge
Guest
Say I to implement the following C language constructs in my VHDL
testbench:
I want to have a generic image struct:
typedef struct {
unsigned int height;
unsigned int width;
unsigned char *pixels;
} Image_Type;
I think something like this can be done with a VHDL record type.
Then initialize it with the following function:
int init_image_struct(unsigned int height, unsigned int width,
Image_Type *image)
{
image->height = height;
image->width = width;
image->pixels = (unsigned char*) malloc(sizeof(unsigned char) *
height * width);
return 0;
}
I would like to pass my vhdl functions constants or parameters read
from files at some point during the course of my simulation run.
I want to be able to do this so I can handle images of various sizes
without knowing the size ahead of time.
This would prevent the need for hard coded images sizes (need a new
type for each different image size).
Can anyone tell me how to do this in VHDL?
Also how to prevent memory leaks?
testbench:
I want to have a generic image struct:
typedef struct {
unsigned int height;
unsigned int width;
unsigned char *pixels;
} Image_Type;
I think something like this can be done with a VHDL record type.
Then initialize it with the following function:
int init_image_struct(unsigned int height, unsigned int width,
Image_Type *image)
{
image->height = height;
image->width = width;
image->pixels = (unsigned char*) malloc(sizeof(unsigned char) *
height * width);
return 0;
}
I would like to pass my vhdl functions constants or parameters read
from files at some point during the course of my simulation run.
I want to be able to do this so I can handle images of various sizes
without knowing the size ahead of time.
This would prevent the need for hard coded images sizes (need a new
type for each different image size).
Can anyone tell me how to do this in VHDL?
Also how to prevent memory leaks?