Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Constant (large) 2D array of unsigned declaration

Status
Not open for further replies.

nabla101

Junior Member level 3
Joined
Feb 8, 2011
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,600
Hi, I want to declare four constant arrays to emulate four frames of a VGA resolution video sequence, to use for simulation of a video CODEC. I am only considering luminance values to begin with, which have values from 0 (black) to 255 (white). I want to use a simple pattern like a cross moving across a background of a different shade for the emulated video sequence. I want to know if anyone has any ideas on how I can easily define the arrays using a formula, or from a file for example since there are 19200 unsigned elements in each 2D array, too many to define practically.

I was thinking of starting like this:

Code:
type PXL is unsigned 0 to 255;
type VGA_frame is array (0 to 639, 0 to 479) of PXL;

constant frame_0 : VGA_frame := ( ..... 
                                                ..... )

But obviously that would take impossibly long to do, so is there another way?
 

If you are using modelsim, you can read/write binary files directly, which allows you to read bitmap files. Unfortunatly, with other simulators its not so simple or impossible.

Otherwise you can store all the data in a text file, or PGM (portable grey map) which is an ascii formatted image file - see here:
PGM Format Specification

If you do all this right, you can declare the VGA frame as:

type PXL is natural 0 to 255; --unsigned type is not appropriate here
type VGA_frame is array(natural range <>, natural range<>) of PXL;

and then read from the file to set the dimentsion on an array, but Ill leave those details up to you.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top