Line 95... |
Line 95... |
read_pixel = this.lines[coordinate.y].pixel[coordinate.x];
|
read_pixel = this.lines[coordinate.y].pixel[coordinate.x];
|
endfunction: read_pixel
|
endfunction: read_pixel
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
function flattened_frame_t flatten_frame();
|
function flattened_frame_t flatten_frame();
|
int i = 0;
|
|
log.info($sformatf("%m"));
|
|
flatten_frame = new[lines_per_frame*pixels_per_line];
|
flatten_frame = new[lines_per_frame*pixels_per_line];
|
|
|
foreach(this.lines[l])
|
foreach(this.lines[l])
|
foreach(this.lines[l].pixel[p])
|
foreach(this.lines[l].pixel[p])
|
begin
|
flatten_frame[(l*pixels_per_line)+p] = this.lines[l].pixel[p];
|
flatten_frame[i] = this.lines[l].pixel[p];
|
|
i++;
|
|
end
|
|
endfunction: flatten_frame
|
endfunction: flatten_frame
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
|
function void load_flatten_frame(flattened_frame_t a);
|
|
make_constant(0);
|
|
foreach(lines[l])
|
|
foreach(lines[l].pixel[p])
|
|
lines[l].pixel[p] = a[(l*pixels_per_line)+p];
|
|
endfunction: load_flatten_frame
|
|
|
|
// --------------------------------------------------------------------
|
function void make_constant(int pixel);
|
function void make_constant(int pixel);
|
log.info($sformatf("%m"));
|
log.info($sformatf("%m"));
|
this.lines = new[lines_per_frame];
|
this.lines = new[lines_per_frame];
|
|
|
foreach(this.lines[l])
|
foreach(this.lines[l])
|
Line 345... |
Line 347... |
log.display($sformatf("%m | pixels_per_clk = %06d | %s", pixels_per_clk, name));
|
log.display($sformatf("%m | pixels_per_clk = %06d | %s", pixels_per_clk, name));
|
log.display($sformatf("%m | pattern = %s | %s", pattern, name));
|
log.display($sformatf("%m | pattern = %s | %s", pattern, name));
|
endfunction: print_config
|
endfunction: print_config
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
function string convert2string();
|
function string convert2string(int grid=8);
|
string s;
|
string s;
|
string f ="";
|
string f ="";
|
|
string fs = $sformatf("%%s%%%0d.h" , (bits_per_pixel % 4 == 0)
|
|
? bits_per_pixel / 4
|
|
: (bits_per_pixel / 4) + 1
|
|
);
|
foreach(this.lines[l])
|
foreach(this.lines[l])
|
begin
|
begin
|
s = $sformatf("[%4.d]", l);
|
s = $sformatf("[%4.d]", l);
|
foreach(this.lines[l].pixel[p])
|
foreach(this.lines[l].pixel[p])
|
s = {s, $sformatf("|%4.h", this.lines[l].pixel[p])};
|
s = {s, $sformatf(fs, (p % grid == 0) ? "!" : "|", this.lines[l].pixel[p])};
|
|
|
f = {f, s, "|\n"};
|
f = {f, s, "|\n"};
|
end
|
end
|
return f;
|
return f;
|
endfunction: convert2string
|
endfunction: convert2string
|
|
|