G
gtwrek@pacbell.net
Guest
Ok, I'm trying now to use Systemverilog to model some higher level
functions, that
we'll later implement in synthesizable code. They're video processing
functions,
so the modules are operating on either pixels, lines, or frames.
I'm trying to figure out the easiest way of modelling the data
movement without getting
my hands dirty with flow control/etc. The SystemVerilog "mailbox"
class looks promising.
Here's an example of a pixel processing block:
module top;
bit [ 2 : 0 ] [ 7 : 0 ] pixel; // RGB pixel
mailbox pixel_in = new();
// in some procedural block
pixel_in.put( pixel );
// Call sub-level block which takes single pixels...
pixel_processor pixel_processor( .pixel_in( pixel_in ) );
endmodule
module pixel_processor
(
input mailbox pixel_in
);
reg [ 2 : 0 ] [ 7 : 0 ] pixel;
initial
forever
begin
pixel_in.get( pixel ); // Will block
$display( "I got a pixel: %0x!", pixel );
// Do some operation on said pixel...
end
endmodule
This work's great - my calling function can push pixels onto a memory,
by submodule will "wake up" and
process anything as soon as it's available. Great.
However, I'm having trouble extending this concept to lines, and
frames. Due to the nature of my
processing, I have no advanced knowledge of line length, or frame
length. So, I need some sort
of dynamic type. Objects push'ed onto mailboxes must be singular
(i.e. static size). I've no problem
defining dynamic arrays for lines:
bit [ 2 : 0 ] [ 7 : 0 ] line [*];
But how to I use this with a mailbox?
I know that a mailbox is just a class, which I can extend. I've
played around with creating classes for
my lines, and frames - but it doesn't seem to fit into the mailbox
concept above.
I'm wondering if anyone else has suggestions here to point me in the
correct direction. Should be
a simple concept - got a feeling I'm missing something obvious.
Mark
functions, that
we'll later implement in synthesizable code. They're video processing
functions,
so the modules are operating on either pixels, lines, or frames.
I'm trying to figure out the easiest way of modelling the data
movement without getting
my hands dirty with flow control/etc. The SystemVerilog "mailbox"
class looks promising.
Here's an example of a pixel processing block:
module top;
bit [ 2 : 0 ] [ 7 : 0 ] pixel; // RGB pixel
mailbox pixel_in = new();
// in some procedural block
pixel_in.put( pixel );
// Call sub-level block which takes single pixels...
pixel_processor pixel_processor( .pixel_in( pixel_in ) );
endmodule
module pixel_processor
(
input mailbox pixel_in
);
reg [ 2 : 0 ] [ 7 : 0 ] pixel;
initial
forever
begin
pixel_in.get( pixel ); // Will block
$display( "I got a pixel: %0x!", pixel );
// Do some operation on said pixel...
end
endmodule
This work's great - my calling function can push pixels onto a memory,
by submodule will "wake up" and
process anything as soon as it's available. Great.
However, I'm having trouble extending this concept to lines, and
frames. Due to the nature of my
processing, I have no advanced knowledge of line length, or frame
length. So, I need some sort
of dynamic type. Objects push'ed onto mailboxes must be singular
(i.e. static size). I've no problem
defining dynamic arrays for lines:
bit [ 2 : 0 ] [ 7 : 0 ] line [*];
But how to I use this with a mailbox?
I know that a mailbox is just a class, which I can extend. I've
played around with creating classes for
my lines, and frames - but it doesn't seem to fit into the mailbox
concept above.
I'm wondering if anyone else has suggestions here to point me in the
correct direction. Should be
a simple concept - got a feeling I'm missing something obvious.
Mark