data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v
[Errno 2] No such file or directory: 'preprocess.output'
1: b'%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:12: Cannot find include file: ../../utils/sim/sim.v\n`include "../../utils/sim/sim.v" \n         ^~~~~~~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/190755935/src/image/sim,data/full_repos/permissive/190755935/../../utils/sim/sim.v\n             data/full_repos/permissive/190755935/src/image/sim,data/full_repos/permissive/190755935/../../utils/sim/sim.v.v\n             data/full_repos/permissive/190755935/src/image/sim,data/full_repos/permissive/190755935/../../utils/sim/sim.v.sv\n             ../../utils/sim/sim.v\n             ../../utils/sim/sim.v.v\n             ../../utils/sim/sim.v.sv\n             obj_dir/../../utils/sim/sim.v\n             obj_dir/../../utils/sim/sim.v.v\n             obj_dir/../../utils/sim/sim.v.sv\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:14: Cannot find include file: ../../image/rtl/image_defs.v\n`include "../../image/rtl/image_defs.v" \n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:17: Define or directive not defined: \'`IS_w\'\n        parameter [`IS_w-1:0] IS = `IS_DEFAULT\n                   ^~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:17: Define or directive not defined: \'`IS_DEFAULT\'\n        parameter [`IS_w-1:0] IS = `IS_DEFAULT\n                                   ^~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:18: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    )(\n    ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:22: Define or directive not defined: \'`OutputDebug\'\n    parameter Output=`OutputDebug;\n                     ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:22: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n    parameter Output=`OutputDebug;\n                                 ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:25: Define or directive not defined: \'`Realtime\'\n    `Realtime\n    ^~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:28: Define or directive not defined: \'`Clock10MHz\'\n    `Clock10MHz\n    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:38: syntax error, unexpected \'@\'\n            @( posedge clock );\n            ^\n%Warning-STMTDLY: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:37: Unsupported: Ignoring delay on this delayed statement.\n            #2\n            ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:40: Unsupported: Ignoring delay on this delayed statement.\n            #2\n            ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:50: Define or directive not defined: \'`Info\'\n            `Info( "    Reset");\n            ^~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:50: syntax error, unexpected \';\'\n            `Info( "    Reset");\n                               ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:71: Define or directive not defined: \'`I_w\'\n    localparam [7:0] ImageWidth =  `I_w( IS );\n                                   ^~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:73: Define or directive not defined: \'`IS_WIDTH\'\n    localparam [7:0] Width  = `IS_WIDTH( IS );\n                              ^~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:74: Define or directive not defined: \'`IS_HEIGHT\'\n    localparam [7:0] Height = `IS_HEIGHT( IS );\n                              ^~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:76: Define or directive not defined: \'`IS_PIXEL_COUNT\'\n    localparam [31:0] PixelCount = `IS_PIXEL_COUNT( IS );\n                                   ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:78: Define or directive not defined: \'`IS_WIDTH_WIDTH\'\n    localparam [7:0] WidthWidth  = `IS_WIDTH_WIDTH( IS );\n                                   ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:79: Define or directive not defined: \'`IS_HEIGHT_WIDTH\'\n    localparam [7:0] HeightWidth = `IS_HEIGHT_WIDTH( IS );\n                                   ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:80: Define or directive not defined: \'`IS_DATA_WIDTH\'\n    localparam [7:0] DataWidth   = `IS_DATA_WIDTH( IS );\n                                   ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:82: Define or directive not defined: \'`IS_C0_WIDTH\'\n    localparam [7:0] C0Width    = `IS_C0_WIDTH( IS );\n                                  ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:83: Define or directive not defined: \'`IS_C1_WIDTH\'\n    localparam [7:0] C1Width    = `IS_C1_WIDTH( IS );\n                                  ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:84: Define or directive not defined: \'`IS_C2_WIDTH\'\n    localparam [7:0] C2Width    = `IS_C2_WIDTH( IS );\n                                  ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:85: Define or directive not defined: \'`IS_ALPHA_WIDTH\'\n    localparam [7:0] AlphaWidth = `IS_ALPHA_WIDTH( IS );\n                                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:86: Define or directive not defined: \'`IS_Z_WIDTH\'\n    localparam [7:0] ZWidth     = `IS_Z_WIDTH( IS );\n                                  ^~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:103: Define or directive not defined: \'`IS_w\'\n    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );\n                ^~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:103: Define or directive not defined: \'`IS\'\n    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );\n                                     ^~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:103: syntax error, unexpected \',\'\n    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );\n                                           ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:103: Define or directive not defined: \'`IS_FORMAT_RGB\'\n    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );\n                                                              ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:105: Define or directive not defined: \'`IS_DATA_WIDTH\'\n    localparam ColorDataWidth = `IS_DATA_WIDTH( IS_RGB8 );\n                                ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:109: syntax error, unexpected IDENTIFIER\n    image_background #(\n    ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:135: syntax error, unexpected assign\n    assign background_out_start   = `I_Start(   IS, image_background2debayer );\n    ^~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:135: Define or directive not defined: \'`I_Start\'\n    assign background_out_start   = `I_Start(   IS, image_background2debayer );\n                                    ^~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:136: Define or directive not defined: \'`I_Stop\'\n    assign background_out_stop    = `I_Stop(    IS, image_background2debayer );\n                                    ^~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:137: Define or directive not defined: \'`I_Data\'\n    assign background_out_data    = `I_Data(    IS, image_background2debayer );\n                                    ^~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:138: Define or directive not defined: \'`I_Error\'\n                                                                                 : ... Suggested alternative: \'`error\'\n    assign background_out_error   = `I_Error(   IS, image_background2debayer );\n                                    ^~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:139: Define or directive not defined: \'`I_Valid\'\n    assign background_out_valid   = `I_Valid(   IS, image_background2debayer );\n                                    ^~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:140: Define or directive not defined: \'`I_Request\'\n    assign background_out_request = `I_Request( IS, image_background2debayer );\n                                    ^~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:141: Define or directive not defined: \'`I_Cancel\'\n    assign background_out_cancel  = `I_Cancel(  IS, image_background2debayer );\n                                    ^~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:142: Define or directive not defined: \'`I_Ready\'\n    assign background_out_ready   = `I_Ready(   IS, image_background2debayer );\n                                    ^~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:148: Define or directive not defined: \'`IS_w\'\n    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );\n                ^~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:148: Define or directive not defined: \'`IS\'\n    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );\n                                   ^~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:148: syntax error, unexpected \',\'\n    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );\n                                         ^\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:148: Define or directive not defined: \'`IS_FORMAT_RGB\'\n    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );\n                                                                   ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:150: Define or directive not defined: \'`I_w\'\n    localparam DBImageWidth     = `I_w( IS_DB );\n                                  ^~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:151: Define or directive not defined: \'`IS_DATA_WIDTH\'\n    localparam DBImageDataWidth = `IS_DATA_WIDTH( IS_DB );\n                                  ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:165: syntax error, unexpected assign\n    assign debayer_out_start = `I_Start( IS_DB, debayer_image_out );\n    ^~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:165: Define or directive not defined: \'`I_Start\'\n    assign debayer_out_start = `I_Start( IS_DB, debayer_image_out );\n                               ^~~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:166: Define or directive not defined: \'`I_Stop\'\n    assign debayer_out_stop = `I_Stop( IS_DB, debayer_image_out );\n                              ^~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:167: Define or directive not defined: \'`I_Data\'\n    assign debayer_out_data = `I_Data( IS_DB, debayer_image_out );\n                              ^~~~~~~\n%Error: data/full_repos/permissive/190755935/src/image/sim/image_debayer_tb.v:168: Define or directive not defined: \'`I_Error\'\n                                                                                 : ... Suggested alternative: \'`error\'\n    assign debayer_out_error = `I_Error( IS_DB, debayer_image_out );\n                               ^~~~~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module image_debayer_instance #(
        parameter [`IS_w-1:0] IS = `IS_DEFAULT
    )(
        input [1:0] operation
    );

    parameter Output=`OutputDebug;


    `Realtime


    `Clock10MHz

    task i_init;
        begin
        end
    endtask

    task  i_clock;
        begin
            #2
            @( posedge clock );

            #2
            ;
        end
    endtask

    reg  reset;
    task  i_reset;
        begin
            reset = 1;
            i_clock;
            `Info( "    Reset");
            reset = 0;
            i_clock;
        end
    endtask

    task test_init;
        begin
            i_init;
            i_reset;

            in_i = 0;
            out_i = 0;
        end
    endtask





    localparam ImplementAccessPort = 1;
    localparam [7:0] ImageWidth =  `I_w( IS );

    localparam [7:0] Width  = `IS_WIDTH( IS );
    localparam [7:0] Height = `IS_HEIGHT( IS );

    localparam [31:0] PixelCount = `IS_PIXEL_COUNT( IS );

    localparam [7:0] WidthWidth  = `IS_WIDTH_WIDTH( IS );
    localparam [7:0] HeightWidth = `IS_HEIGHT_WIDTH( IS );
    localparam [7:0] DataWidth   = `IS_DATA_WIDTH( IS );

    localparam [7:0] C0Width    = `IS_C0_WIDTH( IS );
    localparam [7:0] C1Width    = `IS_C1_WIDTH( IS );
    localparam [7:0] C2Width    = `IS_C2_WIDTH( IS );
    localparam [7:0] AlphaWidth = `IS_ALPHA_WIDTH( IS );
    localparam [7:0] ZWidth     = `IS_Z_WIDTH( IS );

    localparam C0Max    = ( 1 << C0Width ) - 1;
    localparam C1Max    = ( 1 << C1Width ) - 1;
    localparam C2Max    = ( 1 << C2Width ) - 1;
    localparam AlphaMax = ( 1 << AlphaWidth ) - 1;
    localparam ZMax     = ( 1 << ZWidth ) - 1;





    wire [ImageWidth-1:0 ] image_background2debayer;
    reg                    background_out_request_external;

    wire background_out_sending;

    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );

    localparam ColorDataWidth = `IS_DATA_WIDTH( IS_RGB8 );

    reg [ColorDataWidth-1:0] color;

    image_background #(
            .IS( IS )
    ) ibackground (
            .clock( clock ),
            .reset( reset ),

            .operation( operation ),
            .color( color ),

            .out_request_external( background_out_request_external ),

            .image_out( image_background2debayer ),

            .out_sending( background_out_sending )
        );


    wire                 background_out_start;
    wire                 background_out_stop;
    wire [DataWidth-1:0] background_out_data;
    wire                 background_out_valid;
    wire                 background_out_error;
    wire                 background_out_ready;
    wire                 background_out_request;
    wire                 background_out_cancel;

    assign background_out_start   = `I_Start(   IS, image_background2debayer );
    assign background_out_stop    = `I_Stop(    IS, image_background2debayer );
    assign background_out_data    = `I_Data(    IS, image_background2debayer );
    assign background_out_error   = `I_Error(   IS, image_background2debayer );
    assign background_out_valid   = `I_Valid(   IS, image_background2debayer );
    assign background_out_request = `I_Request( IS, image_background2debayer );
    assign background_out_cancel  = `I_Cancel(  IS, image_background2debayer );
    assign background_out_ready   = `I_Ready(   IS, image_background2debayer );





    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );

    localparam DBImageWidth     = `I_w( IS_DB );
    localparam DBImageDataWidth = `IS_DATA_WIDTH( IS_DB );

    wire [DBImageWidth-1:0 ] debayer_image_out;


    wire                        debayer_out_start;
    wire                        debayer_out_stop;
    wire [DBImageDataWidth-1:0] debayer_out_data;
    wire                        debayer_out_valid;
    wire                        debayer_out_error;
    wire                        debayer_out_ready;
    wire                        debayer_out_request;
    wire                        debayer_out_cancel;

    assign debayer_out_start = `I_Start( IS_DB, debayer_image_out );
    assign debayer_out_stop = `I_Stop( IS_DB, debayer_image_out );
    assign debayer_out_data = `I_Data( IS_DB, debayer_image_out );
    assign debayer_out_error = `I_Error( IS_DB, debayer_image_out );
    assign debayer_out_valid = `I_Valid( IS_DB, debayer_image_out );
    assign debayer_out_request = `I_Request( IS_DB, debayer_image_out );
    assign debayer_out_cancel = `I_Cancel( IS_DB, debayer_image_out );
    assign debayer_out_ready = `I_Ready( IS_DB, debayer_image_out );

    image_debayer #(
            .InIS( IS ),
            .OutIS( IS_DB )
    ) idebayer (
            .clock( clock ),
            .reset( reset ),

            .image_in( image_background2debayer ),
            .image_out( debayer_image_out )
        );





    reg  buffer_in_request_external;
    reg  buffer_out_request_external;

    wire [DBImageWidth-1:0 ] buffer_image_out;

    wire in_receiving;
    wire out_sending;

    reg  [WidthWidth-1:0]       buffer_port_out_x;
    reg  [HeightWidth-1:0]      buffer_port_out_y;
    wire [DBImageDataWidth-1:0] buffer_port_out_data;

    image_buffer #(
            .IS( IS_DB ),
            .ImplementAccessPort( ImplementAccessPort )
    ) ibuffer (
            .clock( clock ),
            .reset( reset ),

            .in_request_external( buffer_in_request_external ),
            .out_request_external( buffer_out_request_external ),

            .image_in( debayer_image_out ),
            .image_out( buffer_image_out ),

            .in_receiving( in_receiving ),
            .out_sending( out_sending ),

            .buffer_out_x( buffer_port_out_x ),
            .buffer_out_y( buffer_port_out_y ),
            .buffer_out_data( buffer_port_out_data )
        );






    wire                 buffer_out_start;
    wire                 buffer_out_stop;
    wire [DataWidth-1:0] buffer_out_data;
    wire                 buffer_out_valid;
    wire                 buffer_out_error;
    reg                  buffer_out_ready;
    reg                  buffer_out_request;
    reg                  buffer_out_cancel;

    assign buffer_out_start = `I_Start( IS_DB, buffer_image_out );
    assign buffer_out_stop = `I_Stop( IS_DB, buffer_image_out );
    assign buffer_out_data = `I_Data( IS_DB, buffer_image_out );
    assign buffer_out_error = `I_Error( IS_DB, buffer_image_out );
    assign buffer_out_valid = `I_Valid( IS_DB, buffer_image_out );

    assign `I_Request( IS_DB, buffer_image_out ) = buffer_out_request;
    assign `I_Cancel( IS_DB, buffer_image_out ) = buffer_out_cancel;
    assign `I_Ready( IS_DB, buffer_image_out ) = buffer_out_ready;





    task test_initial_state(  inout integer AssertErrorCount, inout integer AssertTestCount );
        begin
            `InfoDo $display( "    Test Initial State" );

            `InfoDo $display( "        IS            %x", IS_DB );
            `InfoDo $display( "                 IS_w %d", `IS_w );
            `InfoDo $display( "                  I_w %d", `I_w( IS_DB ) );
            `InfoDo $display( "            IS_DB.X      %d", `IS_X( IS_DB ) );
            `InfoDo $display( "            IS_DB.Y      %d", `IS_Y( IS_DB ) );
            `InfoDo $display( "            IS_DB.Width  %d", `IS_WIDTH( IS_DB ) );
            `InfoDo $display( "            IS_DB.Height %d", `IS_HEIGHT( IS_DB ) );
            `InfoDo $display( "          Pixel Count %d", PixelCount );

            `Assert( !background_out_sending, "Not Sending" );

            buffer_out_request = 0;
            buffer_out_cancel = 0;
            buffer_out_ready = 0;

            background_out_request_external <= 0;
            buffer_out_request_external <= 0;
            buffer_in_request_external <= 0;
        end
    endtask

    integer in_i;
    integer out_i;
    integer out_i_check;
    integer count;
    integer count_limit;

    reg [DataWidth-1:0] data_check;

    reg [DataWidth-1:0] pixel;

    task test_background( inout integer AssertErrorCount, inout integer AssertTestCount );
        begin

            `InfoDo $display( "    Test Background" );

            `Assert( !background_out_request, "No Out Request" );
            `Assert( !background_out_cancel, "No Out Cancel" );
            `Assert( !background_out_ready, "No Out Ready" );


            buffer_in_request_external = 1;

            `Info( "        Requesting" );

            i_clock;

            buffer_in_request_external = 0;


            `Assert( !background_out_request, "Buffer Request" );
            `Assert( !background_out_ready, "Buffer Ready" );

            i_clock;


            `Assert( background_out_request, "Buffer Request" );


            out_i = 0;

            count_limit = PixelCount + 10;
            count = 0;


            `I_C0( IS_RGB8, color ) = 8'HFF;
            `I_C1( IS_RGB8, color ) = 8'HFF;
            `I_C2( IS_RGB8, color ) = 8'HFF;

            pixel = `I_Color2Color( IS, IS_RGB8, color );

            `Info( "        Looping" );

            while ( ( out_i < PixelCount ) && ( count < count_limit ) ) begin

                if ( background_out_ready && background_out_valid ) begin
                    if ( out_i == 0 ) begin
                        `Assert( background_out_start, "Start" );
                    end
                    if ( out_i == PixelCount - 1'H1  ) begin
                        `Assert( background_out_stop, "Stop" );
                    end
                    out_i = out_i + 1'H1;

                    data_check = `I_Data( IS, background_out_data );
                    if ( ( operation == 2'H0 ) && ( `IS_FORMAT( IS ) == `IS_FORMAT_GRAYSCALE ) ) begin
                        `AssertEqual( pixel, data_check, "Xfer");
                    end
                end

                count = count + 1;
                i_clock;

            end

            `Assert( count < count_limit, "Count Limit" );
            `AssertEqual( out_i, PixelCount, "Out Count" );

        end
    endtask





    localparam [7:0] OutC0Width    = `IS_C0_WIDTH( IS_DB );
    localparam [7:0] OutC1Width    = `IS_C1_WIDTH( IS_DB );
    localparam [7:0] OutC2Width    = `IS_C2_WIDTH( IS_DB );
    localparam [7:0] OutAlphaWidth = `IS_ALPHA_WIDTH( IS_DB );
    localparam [7:0] OutZWidth     = `IS_Z_WIDTH( IS_DB );

    localparam [7:0] OutDataWidth  = `IS_DATA_WIDTH( IS_DB );

    localparam OutC0Max    = ( 1 << OutC0Width ) - 1;
    localparam OutC1Max    = ( 1 << OutC1Width ) - 1;
    localparam OutC2Max    = ( 1 << OutC2Width ) - 1;
    localparam OutAlphaMax = ( 1 << OutAlphaWidth ) - 1;
    localparam OutZMax     = ( 1 << OutZWidth ) - 1;

    integer out_frame_x;
    integer out_frame_y;
    integer out_frame_pixel_r;
    integer out_frame_pixel_g;
    integer out_frame_pixel_b;
    integer out_frame_pixel_total;

    localparam out_frame_pixel_max_total = ( (2**C0Width) + (2**C1Width) + (2**C2Width) - 3 );

    function [2:0] out_brightness( input reg[ OutDataWidth-1:0 ] pixel ); begin

            out_frame_pixel_r = ( C0Width > 0 ) ? `I_C0( IS_DB, pixel ) : 0;
            out_frame_pixel_g = ( C1Width > 0 ) ? `I_C1( IS_DB, pixel ) : 0;
            out_frame_pixel_b = ( C2Width > 0 ) ? `I_C2( IS_DB, pixel ) : 0;




            out_frame_pixel_total = out_frame_pixel_r + out_frame_pixel_g + out_frame_pixel_b;



            out_brightness = ( out_frame_pixel_total == 0 ) ? 0 :
                                  ( ( out_frame_pixel_total <= ( out_frame_pixel_max_total / 4 ) ? 1 :
                                       ( out_frame_pixel_total <= ( out_frame_pixel_max_total / 2 ) ? 2 : 3 ) ) );



        end
    endfunction

    function [2:0] out_c0( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c0 = ( OutC0Width == 0 ) ? 0 :
                            ( `I_C0( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C0( IS_DB, pixel ) <= ( OutC0Max / 4 ) ? 1 :
                                       ( `I_C0( IS_DB, pixel ) <= ( OutC0Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction

    function [2:0] out_c1( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c1 = ( OutC1Width == 0 ) ? 0 :
                            ( `I_C1( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C1( IS_DB, pixel ) <= ( OutC1Max / 4 ) ? 1 :
                                       ( `I_C1( IS_DB, pixel ) <= ( OutC1Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction

    function [2:0] out_c2( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c2 = ( OutC2Width == 0 ) ? 0 :
                            ( `I_C2( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C2( IS_DB, pixel ) <= ( OutC2Max / 4 ) ? 1 :
                                       ( `I_C2( IS_DB, pixel ) <= ( OutC2Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction



    task out_frame_mono( input reg full );
        begin


            $write( "        /" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "--" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "\\\n" );

            for ( out_frame_y = 0; out_frame_y < Height; out_frame_y = out_frame_y + 1 ) begin
                $write( "        |" );

                for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                    buffer_port_out_x = out_frame_x;
                    buffer_port_out_y = out_frame_y;

                    #1

                    b = out_c0( buffer_port_out_data );


                    $write( "%s", ( b == 0 ) ? "  " : ( ( b == 1 ) ? ". " : ( ( b == 2 ) ? ".." : "oo" ) ) );
                    if ( !full && ( out_frame_x == Width / 8 ) ) begin
                        $write( "..." );
                        out_frame_x = 15 * Width / 16;
                    end
                end
                $write( "|\n" );
                if ( !full && ( out_frame_y == Height / 8 ) ) begin
                    $write( "        ...\n" );
                    out_frame_y = 15 * Height / 16;
                end
            end


            $write( "        \\" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "--" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "/\n" );

        end
    endtask


    integer r;
    integer b;
    integer g;

    task out_frame_rgb( input reg full );
        begin


            $write( "        /" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "---" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "\\\n" );

            for ( out_frame_y = 0; out_frame_y < Height; out_frame_y = out_frame_y + 1 ) begin
                $write( "        |" );

                for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                    buffer_port_out_x = out_frame_x;
                    buffer_port_out_y = out_frame_y;

                    #1

                    r = out_c0( buffer_port_out_data );
                    g = out_c1( buffer_port_out_data );
                    b = out_c2( buffer_port_out_data );


                    $write( "%s", ( r == 0 ) ? " " : ( ( r == 1 ) ? "." : ( ( r == 2 ) ? "r" : "R" ) ) );
                    $write( "%s", ( g == 0 ) ? " " : ( ( g == 1 ) ? "." : ( ( g == 2 ) ? "g" : "G" ) ) );
                    $write( "%s", ( b == 0 ) ? " " : ( ( b == 1 ) ? "." : ( ( b == 2 ) ? "b" : "B" ) ) );



                    if ( !full && ( out_frame_x == Width / 8 ) ) begin
                        $write( "..." );
                        out_frame_x = 15 * Width / 16;
                    end
                end
                $write( "|\n" );
                if ( !full && ( out_frame_y == Height / 8 ) ) begin
                    $write( "        ...\n" );
                    out_frame_y = 15 * Height / 16;
                end
            end


            $write( "        \\" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "---" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "/\n" );

        end
    endtask
endmodule
module image_debayer_instance #(
        parameter [`IS_w-1:0] IS = `IS_DEFAULT
    )(
        input [1:0] operation
    );


    parameter Output=`OutputDebug;


    `Realtime


    `Clock10MHz

    task i_init;
        begin
        end
    endtask

    task  i_clock;
        begin
            #2
            @( posedge clock );

            #2
            ;
        end
    endtask

    reg  reset;
    task  i_reset;
        begin
            reset = 1;
            i_clock;
            `Info( "    Reset");
            reset = 0;
            i_clock;
        end
    endtask

    task test_init;
        begin
            i_init;
            i_reset;

            in_i = 0;
            out_i = 0;
        end
    endtask





    localparam ImplementAccessPort = 1;
    localparam [7:0] ImageWidth =  `I_w( IS );

    localparam [7:0] Width  = `IS_WIDTH( IS );
    localparam [7:0] Height = `IS_HEIGHT( IS );

    localparam [31:0] PixelCount = `IS_PIXEL_COUNT( IS );

    localparam [7:0] WidthWidth  = `IS_WIDTH_WIDTH( IS );
    localparam [7:0] HeightWidth = `IS_HEIGHT_WIDTH( IS );
    localparam [7:0] DataWidth   = `IS_DATA_WIDTH( IS );

    localparam [7:0] C0Width    = `IS_C0_WIDTH( IS );
    localparam [7:0] C1Width    = `IS_C1_WIDTH( IS );
    localparam [7:0] C2Width    = `IS_C2_WIDTH( IS );
    localparam [7:0] AlphaWidth = `IS_ALPHA_WIDTH( IS );
    localparam [7:0] ZWidth     = `IS_Z_WIDTH( IS );

    localparam C0Max    = ( 1 << C0Width ) - 1;
    localparam C1Max    = ( 1 << C1Width ) - 1;
    localparam C2Max    = ( 1 << C2Width ) - 1;
    localparam AlphaMax = ( 1 << AlphaWidth ) - 1;
    localparam ZMax     = ( 1 << ZWidth ) - 1;





    wire [ImageWidth-1:0 ] image_background2debayer;
    reg                    background_out_request_external;

    wire background_out_sending;

    localparam [`IS_w-1:0] IS_RGB8 = `IS( 0, 0, 32, 32, 0, 1, `IS_FORMAT_RGB, 8,  8,  8, 0, 0 );

    localparam ColorDataWidth = `IS_DATA_WIDTH( IS_RGB8 );

    reg [ColorDataWidth-1:0] color;

    image_background #(
            .IS( IS )
    ) ibackground (
            .clock( clock ),
            .reset( reset ),

            .operation( operation ),
            .color( color ),

            .out_request_external( background_out_request_external ),

            .image_out( image_background2debayer ),

            .out_sending( background_out_sending )
        );


    wire                 background_out_start;
    wire                 background_out_stop;
    wire [DataWidth-1:0] background_out_data;
    wire                 background_out_valid;
    wire                 background_out_error;
    wire                 background_out_ready;
    wire                 background_out_request;
    wire                 background_out_cancel;

    assign background_out_start   = `I_Start(   IS, image_background2debayer );
    assign background_out_stop    = `I_Stop(    IS, image_background2debayer );
    assign background_out_data    = `I_Data(    IS, image_background2debayer );
    assign background_out_error   = `I_Error(   IS, image_background2debayer );
    assign background_out_valid   = `I_Valid(   IS, image_background2debayer );
    assign background_out_request = `I_Request( IS, image_background2debayer );
    assign background_out_cancel  = `I_Cancel(  IS, image_background2debayer );
    assign background_out_ready   = `I_Ready(   IS, image_background2debayer );





    localparam [`IS_w-1:0] IS_DB = `IS( 0, 0, Width, Height, 0, 1, `IS_FORMAT_RGB, 5, 6, 5, 0, 0 );

    localparam DBImageWidth     = `I_w( IS_DB );
    localparam DBImageDataWidth = `IS_DATA_WIDTH( IS_DB );

    wire [DBImageWidth-1:0 ] debayer_image_out;


    wire                        debayer_out_start;
    wire                        debayer_out_stop;
    wire [DBImageDataWidth-1:0] debayer_out_data;
    wire                        debayer_out_valid;
    wire                        debayer_out_error;
    wire                        debayer_out_ready;
    wire                        debayer_out_request;
    wire                        debayer_out_cancel;

    assign debayer_out_start = `I_Start( IS_DB, debayer_image_out );
    assign debayer_out_stop = `I_Stop( IS_DB, debayer_image_out );
    assign debayer_out_data = `I_Data( IS_DB, debayer_image_out );
    assign debayer_out_error = `I_Error( IS_DB, debayer_image_out );
    assign debayer_out_valid = `I_Valid( IS_DB, debayer_image_out );
    assign debayer_out_request = `I_Request( IS_DB, debayer_image_out );
    assign debayer_out_cancel = `I_Cancel( IS_DB, debayer_image_out );
    assign debayer_out_ready = `I_Ready( IS_DB, debayer_image_out );

    image_debayer #(
            .InIS( IS ),
            .OutIS( IS_DB )
    ) idebayer (
            .clock( clock ),
            .reset( reset ),

            .image_in( image_background2debayer ),
            .image_out( debayer_image_out )
        );





    reg  buffer_in_request_external;
    reg  buffer_out_request_external;

    wire [DBImageWidth-1:0 ] buffer_image_out;

    wire in_receiving;
    wire out_sending;

    reg  [WidthWidth-1:0]       buffer_port_out_x;
    reg  [HeightWidth-1:0]      buffer_port_out_y;
    wire [DBImageDataWidth-1:0] buffer_port_out_data;

    image_buffer #(
            .IS( IS_DB ),
            .ImplementAccessPort( ImplementAccessPort )
    ) ibuffer (
            .clock( clock ),
            .reset( reset ),

            .in_request_external( buffer_in_request_external ),
            .out_request_external( buffer_out_request_external ),

            .image_in( debayer_image_out ),
            .image_out( buffer_image_out ),

            .in_receiving( in_receiving ),
            .out_sending( out_sending ),

            .buffer_out_x( buffer_port_out_x ),
            .buffer_out_y( buffer_port_out_y ),
            .buffer_out_data( buffer_port_out_data )
        );






    wire                 buffer_out_start;
    wire                 buffer_out_stop;
    wire [DataWidth-1:0] buffer_out_data;
    wire                 buffer_out_valid;
    wire                 buffer_out_error;
    reg                  buffer_out_ready;
    reg                  buffer_out_request;
    reg                  buffer_out_cancel;

    assign buffer_out_start = `I_Start( IS_DB, buffer_image_out );
    assign buffer_out_stop = `I_Stop( IS_DB, buffer_image_out );
    assign buffer_out_data = `I_Data( IS_DB, buffer_image_out );
    assign buffer_out_error = `I_Error( IS_DB, buffer_image_out );
    assign buffer_out_valid = `I_Valid( IS_DB, buffer_image_out );

    assign `I_Request( IS_DB, buffer_image_out ) = buffer_out_request;
    assign `I_Cancel( IS_DB, buffer_image_out ) = buffer_out_cancel;
    assign `I_Ready( IS_DB, buffer_image_out ) = buffer_out_ready;





    task test_initial_state(  inout integer AssertErrorCount, inout integer AssertTestCount );
        begin
            `InfoDo $display( "    Test Initial State" );

            `InfoDo $display( "        IS            %x", IS_DB );
            `InfoDo $display( "                 IS_w %d", `IS_w );
            `InfoDo $display( "                  I_w %d", `I_w( IS_DB ) );
            `InfoDo $display( "            IS_DB.X      %d", `IS_X( IS_DB ) );
            `InfoDo $display( "            IS_DB.Y      %d", `IS_Y( IS_DB ) );
            `InfoDo $display( "            IS_DB.Width  %d", `IS_WIDTH( IS_DB ) );
            `InfoDo $display( "            IS_DB.Height %d", `IS_HEIGHT( IS_DB ) );
            `InfoDo $display( "          Pixel Count %d", PixelCount );

            `Assert( !background_out_sending, "Not Sending" );

            buffer_out_request = 0;
            buffer_out_cancel = 0;
            buffer_out_ready = 0;

            background_out_request_external <= 0;
            buffer_out_request_external <= 0;
            buffer_in_request_external <= 0;
        end
    endtask

    integer in_i;
    integer out_i;
    integer out_i_check;
    integer count;
    integer count_limit;

    reg [DataWidth-1:0] data_check;

    reg [DataWidth-1:0] pixel;

    task test_background( inout integer AssertErrorCount, inout integer AssertTestCount );
        begin

            `InfoDo $display( "    Test Background" );

            `Assert( !background_out_request, "No Out Request" );
            `Assert( !background_out_cancel, "No Out Cancel" );
            `Assert( !background_out_ready, "No Out Ready" );


            buffer_in_request_external = 1;

            `Info( "        Requesting" );

            i_clock;

            buffer_in_request_external = 0;


            `Assert( !background_out_request, "Buffer Request" );
            `Assert( !background_out_ready, "Buffer Ready" );

            i_clock;


            `Assert( background_out_request, "Buffer Request" );


            out_i = 0;

            count_limit = PixelCount + 10;
            count = 0;


            `I_C0( IS_RGB8, color ) = 8'HFF;
            `I_C1( IS_RGB8, color ) = 8'HFF;
            `I_C2( IS_RGB8, color ) = 8'HFF;

            pixel = `I_Color2Color( IS, IS_RGB8, color );

            `Info( "        Looping" );

            while ( ( out_i < PixelCount ) && ( count < count_limit ) ) begin

                if ( background_out_ready && background_out_valid ) begin
                    if ( out_i == 0 ) begin
                        `Assert( background_out_start, "Start" );
                    end
                    if ( out_i == PixelCount - 1'H1  ) begin
                        `Assert( background_out_stop, "Stop" );
                    end
                    out_i = out_i + 1'H1;

                    data_check = `I_Data( IS, background_out_data );
                    if ( ( operation == 2'H0 ) && ( `IS_FORMAT( IS ) == `IS_FORMAT_GRAYSCALE ) ) begin
                        `AssertEqual( pixel, data_check, "Xfer");
                    end
                end

                count = count + 1;
                i_clock;

            end

            `Assert( count < count_limit, "Count Limit" );
            `AssertEqual( out_i, PixelCount, "Out Count" );

        end
    endtask





    localparam [7:0] OutC0Width    = `IS_C0_WIDTH( IS_DB );
    localparam [7:0] OutC1Width    = `IS_C1_WIDTH( IS_DB );
    localparam [7:0] OutC2Width    = `IS_C2_WIDTH( IS_DB );
    localparam [7:0] OutAlphaWidth = `IS_ALPHA_WIDTH( IS_DB );
    localparam [7:0] OutZWidth     = `IS_Z_WIDTH( IS_DB );

    localparam [7:0] OutDataWidth  = `IS_DATA_WIDTH( IS_DB );

    localparam OutC0Max    = ( 1 << OutC0Width ) - 1;
    localparam OutC1Max    = ( 1 << OutC1Width ) - 1;
    localparam OutC2Max    = ( 1 << OutC2Width ) - 1;
    localparam OutAlphaMax = ( 1 << OutAlphaWidth ) - 1;
    localparam OutZMax     = ( 1 << OutZWidth ) - 1;

    integer out_frame_x;
    integer out_frame_y;
    integer out_frame_pixel_r;
    integer out_frame_pixel_g;
    integer out_frame_pixel_b;
    integer out_frame_pixel_total;

    localparam out_frame_pixel_max_total = ( (2**C0Width) + (2**C1Width) + (2**C2Width) - 3 );

    function [2:0] out_brightness( input reg[ OutDataWidth-1:0 ] pixel ); begin

            out_frame_pixel_r = ( C0Width > 0 ) ? `I_C0( IS_DB, pixel ) : 0;
            out_frame_pixel_g = ( C1Width > 0 ) ? `I_C1( IS_DB, pixel ) : 0;
            out_frame_pixel_b = ( C2Width > 0 ) ? `I_C2( IS_DB, pixel ) : 0;




            out_frame_pixel_total = out_frame_pixel_r + out_frame_pixel_g + out_frame_pixel_b;



            out_brightness = ( out_frame_pixel_total == 0 ) ? 0 :
                                  ( ( out_frame_pixel_total <= ( out_frame_pixel_max_total / 4 ) ? 1 :
                                       ( out_frame_pixel_total <= ( out_frame_pixel_max_total / 2 ) ? 2 : 3 ) ) );



        end
    endfunction

    function [2:0] out_c0( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c0 = ( OutC0Width == 0 ) ? 0 :
                            ( `I_C0( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C0( IS_DB, pixel ) <= ( OutC0Max / 4 ) ? 1 :
                                       ( `I_C0( IS_DB, pixel ) <= ( OutC0Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction

    function [2:0] out_c1( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c1 = ( OutC1Width == 0 ) ? 0 :
                            ( `I_C1( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C1( IS_DB, pixel ) <= ( OutC1Max / 4 ) ? 1 :
                                       ( `I_C1( IS_DB, pixel ) <= ( OutC1Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction

    function [2:0] out_c2( input reg[ OutDataWidth-1:0 ] pixel ); begin
            out_c2 = ( OutC2Width == 0 ) ? 0 :
                            ( `I_C2( IS_DB, pixel ) == 0 ) ? 0 :
                                  ( ( `I_C2( IS_DB, pixel ) <= ( OutC2Max / 4 ) ? 1 :
                                       ( `I_C2( IS_DB, pixel ) <= ( OutC2Max / 2 ) ? 2 : 3 ) ) );
        end
    endfunction



    task out_frame_mono( input reg full );
        begin


            $write( "        /" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "--" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "\\\n" );

            for ( out_frame_y = 0; out_frame_y < Height; out_frame_y = out_frame_y + 1 ) begin
                $write( "        |" );

                for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                    buffer_port_out_x = out_frame_x;
                    buffer_port_out_y = out_frame_y;

                    #1

                    b = out_c0( buffer_port_out_data );


                    $write( "%s", ( b == 0 ) ? "  " : ( ( b == 1 ) ? ". " : ( ( b == 2 ) ? ".." : "oo" ) ) );
                    if ( !full && ( out_frame_x == Width / 8 ) ) begin
                        $write( "..." );
                        out_frame_x = 15 * Width / 16;
                    end
                end
                $write( "|\n" );
                if ( !full && ( out_frame_y == Height / 8 ) ) begin
                    $write( "        ...\n" );
                    out_frame_y = 15 * Height / 16;
                end
            end


            $write( "        \\" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "--" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "/\n" );

        end
    endtask


    integer r;
    integer b;
    integer g;

    task out_frame_rgb( input reg full );
        begin


            $write( "        /" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "---" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "\\\n" );

            for ( out_frame_y = 0; out_frame_y < Height; out_frame_y = out_frame_y + 1 ) begin
                $write( "        |" );

                for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                    buffer_port_out_x = out_frame_x;
                    buffer_port_out_y = out_frame_y;

                    #1

                    r = out_c0( buffer_port_out_data );
                    g = out_c1( buffer_port_out_data );
                    b = out_c2( buffer_port_out_data );


                    $write( "%s", ( r == 0 ) ? " " : ( ( r == 1 ) ? "." : ( ( r == 2 ) ? "r" : "R" ) ) );
                    $write( "%s", ( g == 0 ) ? " " : ( ( g == 1 ) ? "." : ( ( g == 2 ) ? "g" : "G" ) ) );
                    $write( "%s", ( b == 0 ) ? " " : ( ( b == 1 ) ? "." : ( ( b == 2 ) ? "b" : "B" ) ) );



                    if ( !full && ( out_frame_x == Width / 8 ) ) begin
                        $write( "..." );
                        out_frame_x = 15 * Width / 16;
                    end
                end
                $write( "|\n" );
                if ( !full && ( out_frame_y == Height / 8 ) ) begin
                    $write( "        ...\n" );
                    out_frame_y = 15 * Height / 16;
                end
            end


            $write( "        \\" );
            for ( out_frame_x = 0; out_frame_x < Width; out_frame_x = out_frame_x + 1 ) begin
                $write( "---" );
                if ( !full && ( out_frame_x == Width / 8 ) ) begin
                    $write( "..." );
                    out_frame_x = 15 * Width / 16;
                end
            end
            $write( "/\n" );

        end
    endtask
endmodule