OpenCores
URL https://opencores.org/ocsvn/rtfbitmapcontroller/rtfbitmapcontroller/trunk

Subversion Repositories rtfbitmapcontroller

[/] [rtfbitmapcontroller/] [trunk/] [rtl/] [verilog/] [rtfBitmapController.v] - Diff between revs 4 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 9
Line 1... Line 1...
 
`timescale 1ns / 1ps
// ============================================================================
// ============================================================================
//  Bitmap Controller (416h x 262v x 8bpp):
//  Bitmap Controller
//  - Displays a bitmap from memory.
//  - Displays a bitmap from memory.
//  - the video mode timing to be 1680x1050
 
//
//
//
//
//      (C) 2008,2010,2011  Robert Finch
//        __
//      robfinch<remove>@opencores.org
//   \\__/ o\    (C) 2008-2013  Robert Finch, Stratford
 
//    \  __ /    All rights reserved.
 
//     \/_//     robfinch<remove>@opencores.org
 
//       ||
//
//
//
//
// This source file is free software: you can redistribute it and/or modify 
// This source file is free software: you can redistribute it and/or modify 
// it under the terms of the GNU Lesser General Public License as published 
// it under the terms of the GNU Lesser General Public License as published 
// by the Free Software Foundation, either version 3 of the License, or     
// by the Free Software Foundation, either version 3 of the License, or     
Line 21... Line 24...
// You should have received a copy of the GNU General Public License        
// You should have received a copy of the GNU General Public License        
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
//                                                                          
//                                                                          
//
//
//  The default base screen address is:
//  The default base screen address is:
//              $20000 - the second 128 kb of RAM
//              $4100000 - the second 4MiB of RAM
//
//
//
//
//      Verilog 1995
//      Verilog 1995
//      Webpack 9.2i  xc3s1200-4fg320
 
//      64 slices / 118 LUTs / 175.009 MHz
 
//  72 ff's / 2 BRAM (2048x16)
 
//
//
// ============================================================================
// ============================================================================
 
 
module rtfBitmapController(
module rtfBitmapController(
        rst_i, clk_i, bte_o, cti_o, cyc_o, stb_o, ack_i, we_o, sel_o, adr_o, dat_i, dat_o,
        rst_i, s_clk_i, s_cyc_i, s_stb_i, s_ack_o, s_we_i, s_adr_i, s_dat_i, s_dat_o, irq_o,
        vclk, eol, eof, blank, rgbo, page
        clk_i, bte_o, cti_o, bl_o, cyc_o, stb_o, ack_i, we_o, sel_o, adr_o, dat_i, dat_o,
 
        vclk, hSync, vSync, blank, rgbo, xonoff
);
);
parameter BM_BASE_ADDR1 = 44'h000_0002_0000;
parameter pIOAddress = 32'hFFDC5000;
parameter BM_BASE_ADDR2 = 44'h000_0004_0000;
parameter BM_BASE_ADDR1 = 32'h0410_0000;
 
parameter BM_BASE_ADDR2 = 32'h0420_0000;
 
parameter REG_CTRL = 12'd0;
 
parameter REG_CTRL2 = 12'd1;
 
parameter REG_HDISPLAYED = 12'd2;
 
parameter REG_VDISPLAYED = 12'd3;
 
parameter REG_PAGE1ADDR = 12'd5;
 
parameter REG_PAGE2ADDR = 12'd6;
 
parameter REG_REFDELAY = 12'd7;
 
 
// SYSCON
// SYSCON
input rst_i;                            // system reset
input rst_i;                            // system reset
input clk_i;                            // system bus interface clock
 
 
// Peripheral slave port
 
input s_clk_i;
 
input s_cyc_i;
 
input s_stb_i;
 
output s_ack_o;
 
input s_we_i;
 
input [33:0] s_adr_i;
 
input [31:0] s_dat_i;
 
output [31:0] s_dat_o;
 
reg [31:0] s_dat_o;
 
output irq_o;
 
 
// Video Master Port
// Video Master Port
// Used to read memory via burst access
// Used to read memory via burst access
 
input clk_i;                            // system bus interface clock
output [1:0] bte_o;
output [1:0] bte_o;
output [2:0] cti_o;
output [2:0] cti_o;
 
output [5:0] bl_o;
output cyc_o;                   // video burst request
output cyc_o;                   // video burst request
output stb_o;
output stb_o;
input  ack_i;                   // vid_acknowledge from memory
input  ack_i;                   // vid_acknowledge from memory
output we_o;
output we_o;
output [ 1:0] sel_o;
output [ 3:0] sel_o;
output [43:0] adr_o;     // address for memory access
output [33:0] adr_o;     // address for memory access
input  [15:0] dat_i;     // memory data input
input  [31:0] dat_i;     // memory data input
output [15:0] dat_o;
output [31:0] dat_o;
 
 
// Video
// Video
input vclk;                             // Video clock 73.529 MHz
input vclk;                             // Video clock 85.71 MHz
input eol;                              // end of scan line
input hSync;                    // start/end of scan line
input eof;                              // end of frame
input vSync;                    // start/end of frame
input blank;                    // blank the output
input blank;                    // blank the output
output [7:0] rgbo;               // 8-bit RGB output
output [23:0] rgbo;              // 8-bit RGB output
reg [7:0] rgbo;
reg [23:0] rgbo;
 
 
input page;                             // which page to display
 
 
 
 
input xonoff;
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// IO registers
// IO registers
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
reg [1:0] bte_o;
reg [1:0] bte_o;
reg [2:0] cti_o;
reg [2:0] cti_o;
 
reg [5:0] bl_o;
 
reg sync_o;
reg cyc_o;
reg cyc_o;
reg stb_o;
reg stb_o;
reg we_o;
reg we_o;
reg [1:0] sel_o;
reg [3:0] sel_o;
reg [43:0] adr_o;
reg [33:0] adr_o;
reg [15:0] dat_o;
reg [31:0] dat_o;
 
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
wire cs = s_cyc_i && s_stb_i && (s_adr_i[33:14]==pIOAddress[31:12]);
 
reg ack,ack1;
 
always @(posedge clk_i)
 
begin
 
        ack1 <= cs;
 
        ack <= ack1 & cs;
 
end
 
assign s_ack_o = cs ? (s_we_i ? 1'b1 : ack) : 1'b0;
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
wire [11:0] hctr;                // horizontal reference counter
reg [11:0] hDisplayed,vDisplayed;
wire [11:0] vctr;                // vertical reference counter
reg [33:0] bm_base_addr1,bm_base_addr2;
wire [11:0] vctr1 = vctr + 12'd4;
reg [1:0] color_depth;
reg [43:0] baseAddr;     // base address register
wire [8:0] fifo_cnt;
wire [7:0] rgbo1;
reg onoff;
 
reg [5:0] Bpp;                   // bits per pixel, 8,16, or 32
 
reg [1:0] hres,vres;
 
reg page;
 
reg [11:0] hrefdelay;
 
reg [11:0] vrefdelay;
 
reg [11:0] hctr;         // horizontal reference counter
 
wire [11:0] hctr1 = hctr - hrefdelay;
 
reg [11:0] vctr;         // vertical reference counter
 
wire [11:0] vctr1 = vctr - vrefdelay;
 
reg [33:0] baseAddr;     // base address register
 
wire [31:0] rgbo1;
reg [11:0] pixelRow;
reg [11:0] pixelRow;
reg [11:0] pixelCol;
reg [11:0] pixelCol;
 
wire [31:0] pal_wo;
 
wire [31:0] pal_o;
 
 
 
always @(page or bm_base_addr1 or bm_base_addr2)
 
        baseAddr = page ? bm_base_addr2 : bm_base_addr1;
 
 
 
syncRam512x32_1rw1r upal1
 
(
 
        .wrst(1'b0),
 
        .wclk(s_clk_i),
 
        .wce(cs & s_adr_i[13]),
 
        .we(s_we_i),
 
        .wadr(s_adr_i[10:2]),
 
        .i(s_dat_i),
 
        .wo(pal_wo),
 
        .rrst(1'b0),
 
        .rclk(vclk),
 
        .rce(1'b1),
 
        .radr({1'b0,rgbo4[7:0]}),
 
        .o(pal_o)
 
);
 
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
always @(posedge s_clk_i)
 
if (rst_i) begin
 
        page <= 1'b0;
 
        hres <= 2'b11;
 
        vres <= 2'b11;
 
        hDisplayed <= 12'd340;
 
        vDisplayed <= 12'd192;
 
        onoff <= 1'b1;
 
        color_depth <= 2'b00;
 
        bm_base_addr1 <= {BM_BASE_ADDR1,2'b00};
 
        bm_base_addr2 <= {BM_BASE_ADDR2,2'b00};
 
        hrefdelay <= 12'd218;
 
        vrefdelay <= 12'd27;
 
end
 
else begin
 
        if (cs) begin
 
                if (s_we_i) begin
 
                        casex(s_adr_i[13:2])
 
                        REG_CTRL:
 
                                begin
 
                                        onoff <= s_dat_i[0];
 
                                        color_depth <= s_dat_i[10:9];
 
                                        hres <= s_dat_i[17:16];
 
                                        vres <= s_dat_i[19:18];
 
                                end
 
                        REG_CTRL2:
 
                                begin
 
                                        page <= s_dat_i[16];
 
                                end
 
                        REG_HDISPLAYED: hDisplayed <= s_dat_i[11:0];
 
                        REG_VDISPLAYED: vDisplayed <= s_dat_i[11:0];
 
                        REG_PAGE1ADDR:  bm_base_addr1 <= {s_dat_i,2'b00};
 
                        REG_PAGE2ADDR:  bm_base_addr2 <= {s_dat_i,2'b00};
 
                        REG_REFDELAY:
 
                                begin
 
                                        hrefdelay <= s_dat_i[11:0];
 
                                        vrefdelay <= s_dat_i[27:16];
 
                                end
 
                        endcase
 
                end
 
                casex(s_adr_i[13:2])
 
                REG_CTRL:
 
                        begin
 
                                s_dat_o[0] <= onoff;
 
                                s_dat_o[10:9] <= color_depth;
 
                                s_dat_o[17:16] <= hres;
 
                                s_dat_o[19:18] <= vres;
 
                        end
 
                REG_CTRL2:
 
                        begin
 
                                s_dat_o[16] <= page;
 
                        end
 
                REG_HDISPLAYED: s_dat_o <= hDisplayed;
 
                REG_VDISPLAYED: s_dat_o <= vDisplayed;
 
                REG_PAGE1ADDR:  s_dat_o <= bm_base_addr1;
 
                REG_PAGE2ADDR:  s_dat_o <= bm_base_addr2;
 
                REG_REFDELAY:   s_dat_o <= {vrefdelay,4'h0,hrefdelay};
 
                12'b100x_xxxx_xxxx:     s_dat_o <= pal_wo;
 
                endcase
 
        end
 
        else
 
                s_dat_o <= 32'd0;
 
end
 
 
always @(page)
assign irq_o = 1'b0;
        baseAddr = page ? BM_BASE_ADDR2 : BM_BASE_ADDR1;
 
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Horizontal and Vertical timing reference counters
// Horizontal and Vertical timing reference counters
// - The memory fetch address is determined from these counters.
// - The memory fetch address is determined from these counters.
// - The counters are setup with negative values so that the zero
 
//   point coincides with the top left of the display.
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
wire hSyncEdge, vSyncEdge;
 
edge_det ed0(.rst(rst_i), .clk(vclk), .ce(1'b1), .i(hSync), .pe(hSyncEdge), .ne(), .ee() );
 
edge_det ed1(.rst(rst_i), .clk(vclk), .ce(1'b1), .i(vSync), .pe(vSyncEdge), .ne(), .ee() );
 
 
counter #(12) u1 (.rst(1'b0), .clk(vclk), .ce(1'b1), .ld(eol), .d(12'hEE4), .q(hctr));
always @(posedge vclk)
counter #(12) u2 (.rst(1'b0), .clk(vclk), .ce(eol),  .ld(eof), .d(12'hFDC), .q(vctr));
if (rst_i)              hctr <= 1;
 
else if (hSyncEdge) hctr <= 1;
 
else                    hctr <= hctr + 1;
 
 
 
always @(posedge vclk)
 
if (rst_i)              vctr <= 1;
 
else if (vSyncEdge) vctr <= 1;
 
else if (hSyncEdge) vctr <= vctr + 1;
 
 
 
 
// Pixel row and column are derived from the horizontal and vertical counts.
// Pixel row and column are derived from the horizontal and vertical counts.
 
 
always @(vctr1)
always @(vctr1)
        pixelRow = vctr1[11:2];
        case(vres)
always @(hctr)
        2'b00:          pixelRow <= vctr1[11:0];
        pixelCol = hctr[11:1];
        2'b01:          pixelRow <= vctr1[11:1];
 
        2'b10:          pixelRow <= vctr1[11:2];
 
        default:        pixelRow <= vctr1[11:2];
wire vFetch = (vctr < 12'd1050) || (vctr > 12'hFF8);
        endcase
 
always @(hctr1)
// Video Request Block
        case(hres)
// 416x262
        2'b00:          pixelCol = hctr1[11:0];
// - Issue a request for access to memory every 160 clock cycles
        2'b01:          pixelCol = hctr1[11:1];
// - Reset the request flag once an access has been initiated.
        2'b10:          pixelCol = hctr1[11:2];
// - 128 bytes (pixels) are read per scan line
        default:        pixelCol = hctr1[11:2];
// - It takes about 18 clock cycles @ 25 MHz to access 32 bytes of data
        endcase
//   through the memory contoller, or about 53 video clocks
 
//   83 video clocks with a 16 MHZ memory controller.
 
 
 
reg [2:0] vreq;
 
 
 
// Must be vclk. vid_req will be active for numerous clock cycles as
 
// a burst type fetch is used. The ftch and vFetch may only be
 
// active for a single video clock cycle. vclk must be used so these
 
// signals are not missed due to a clock domain crossing. We luck
 
// out here because of the length of time vid_req is active.
 
//
 
always @(posedge vclk)
 
begin
 
        if (vFetch) begin
 
                if (vctr1[1:0]!=2'd3) begin      // we only need 13 memory accesses
 
                        if (hctr==12'd16) vreq <= 3'b100;
 
                        if (hctr==12'd176) vreq <= 3'b101;
 
                        if (hctr==12'd336) vreq <= 3'b110;
 
                        if (hctr==12'd496) vreq <= 3'b111;
 
                end
 
                else
 
                        if (hctr==12'd16) vreq <= 3'b100;
 
        end
 
        if (cyc_o) vreq <= 3'b000;
 
end
 
 
 
// Cross the clock domain with the request signal
wire vFetch = vctr1 < vDisplayed;
reg do_cyc;
wire fifo_rst = hctr[11:4]==8'h00;
always @(posedge clk_i)
 
        do_cyc <= vreq[2];
 
 
 
wire[19:0] rowOffset = pixelRow * 10'd416;
wire[23:0] rowOffset = pixelRow * hDisplayed;
reg [8:0] fetchCol;
reg [11:0] fetchCol;
 
 
// - read from assigned video memory address, using burst mode reads
// - read from assigned video memory address, using burst mode reads
// - 32 pixels at a time are read
// - 64 pixels at a time are read
// - video data is fetched one pixel row in advance
// - video data is fetched one pixel row in advance
//
//
reg [3:0] bcnt;
reg [5:0] bcnt;
 
wire [5:0] bcnt_inc = bcnt + 6'd1;
 
reg [33:0] adr;
always @(posedge clk_i)
always @(posedge clk_i)
if (rst_i) begin
if (rst_i) begin
        bte_o <= 2'b00;         // linear burst
        wb_nack();
        cti_o <= 3'b000;        // classic cycle
        fetchCol <= 12'd0;
        cyc_o <= 1'b0;
        bcnt <= 6'd0;
        stb_o <= 1'b0;
 
        sel_o <= 2'b00;
 
        we_o <= 1'b0;
 
        adr_o <= 44'h000_0000_0000;
 
        dat_o <= 16'h0000;
 
        fetchCol <= 9'd0;
 
        bcnt <= 4'd0;
 
end
end
else begin
else begin
        if (do_cyc & !cyc_o) begin
        if (fifo_rst) begin
                cti_o <= 3'b010;        // incrementing burst cycle
                fetchCol <= 12'd0;
 
                adr <= baseAddr + rowOffset;
 
        end
 
        else if (fifo_cnt < 9'd500 && vFetch && onoff && xonoff && fetchCol < hDisplayed && !cyc_o) begin
 
                cti_o <= 3'b001;        // constant address burst
                cyc_o <= 1'b1;
                cyc_o <= 1'b1;
                stb_o <= 1'b1;
                stb_o <= 1'b1;
                sel_o <= 2'b11;
                sel_o <= 4'b1111;
                bcnt <= 4'd0;
                bcnt <= 6'd0;
                fetchCol <= {vctr1[1:0],vreq[1:0],5'h00};
                bl_o <= 6'd7;
                // This works out to be an even multiple of 32 bytes
                adr_o <= adr;
                adr_o <= baseAddr + rowOffset + 10'd416 + {vctr1[1:0],vreq[1:0],5'h00};
 
        end
        end
        if (cyc_o & ack_i) begin
        if (cyc_o & ack_i) begin
                adr_o <= adr_o + 32'd2;
                case(color_depth)
                fetchCol <= fetchCol + 9'd2;
                2'b00:  fetchCol <= fetchCol + 12'd4;
                bcnt <= bcnt + 4'd1;
                2'b01:  fetchCol <= fetchCol + 12'd2;
                if (bcnt==4'd14)
                2'b11:  fetchCol <= fetchCol + 12'd1;
 
                default:        fetchCol <= 12'hFF0;
 
                endcase
 
                bcnt <= bcnt_inc;
 
                if (bl_o==bcnt_inc)
                        cti_o <= 3'b111;        // end of burst
                        cti_o <= 3'b111;        // end of burst
                if (bcnt==4'd15) begin
                else if (bl_o==bcnt) begin
                        cti_o <= 3'b000;        // classic cycles again
                        wb_nack();
                        cyc_o <= 1'b0;
                        adr <= adr + 34'd32;
                        stb_o <= 1'b0;
 
                        sel_o <= 2'b00;
 
                        adr_o <= 44'h000_0000_0000;
 
                end
                end
        end
        end
end
end
 
 
 
task wb_nack;
 
begin
 
        bte_o <= 2'b00;         // linear burst
 
        cti_o <= 3'b000;        // classic cycle
 
        bl_o <= 6'd0;
 
        cyc_o <= 1'b0;
 
        stb_o <= 1'b0;
 
        sel_o <= 4'b0000;
 
        we_o <= 1'b0;
 
        adr_o <= 34'h0000_0000;
 
        dat_o <= 32'h0000_0000;
 
end
 
endtask
 
 
 
reg [11:0] pixelColD1;
 
reg [31:0] rgbo2,rgbo3,rgbo4;
always @(posedge vclk)
always @(posedge vclk)
        rgbo <= rgbo1;
        if (color_depth==2'b00)
 
                rgbo4 <= rgbo2;
 
        else if (color_depth==2'b01)
 
                rgbo4 <= {rgbo3[14:10],3'b0,rgbo3[9:5],3'b0,rgbo3[4:0],3'b0};
 
        else
 
                rgbo4 <= rgbo1;
 
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
// Video Line Buffer
 
// - gets written in bursts, but read continuously
 
// - buffer is used as two halves - one half is displayed (read) while
 
//   the other is fetched (write).
 
// - only the lower eleven bits of the address are used as an index,
 
//   these bits will match with the addresses generated by the burst
 
//   controller above.
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 
 
// Storage for 2048x8 bit pixels (2048x8 data)
reg rd_fifo,rd_fifo1,rd_fifo2;
 
reg de;
 
always @(posedge vclk)
 
        if (rd_fifo1)
 
                de <= ~blank;
 
 
 
always @(posedge vclk)
 
        if (onoff & xonoff & de) begin
 
                if (color_depth==2'b00)
 
                        rgbo <= pal_o;
 
                else
 
                        rgbo <= rgbo4;
 
        end
 
        else
 
                rgbo <= 24'd0;
 
 
 
wire vrd;
 
always @(posedge vclk) pixelColD1 <= pixelCol;
 
always @(posedge vclk)
 
if (pixelCol < hDisplayed + 12'd8)
 
        case({color_depth,hres})
 
        4'b0000:        rd_fifo1 <= hctr[1:0]==2'b00;    // 4 clocks
 
        4'b0001:        rd_fifo1 <= hctr[2:0]==3'b000;   // 8 clocks
 
        4'b0010:        rd_fifo1 <= hctr[3:0]==4'b0000;  // 16 clocks
 
        4'b0011:        rd_fifo1 <= hctr[3:0]==4'b0000;  // unsupported
 
        4'b0100:        rd_fifo1 <= hctr[0]==1'b0;               // 2 clocks
 
        4'b0101:        rd_fifo1 <= hctr[1:0]==2'b00;    // 4 clocks
 
        4'b0110:        rd_fifo1 <= hctr[2:0]==3'b000;   // 8 clocks (twice as often as a byte)
 
        4'b0111:        rd_fifo1 <= hctr[2:0]==3'b000;
 
        4'b1000:        rd_fifo1 <= 1'b0;
 
        4'b1001:        rd_fifo1 <= 1'b0;
 
        4'b1010:        rd_fifo1 <= 1'b0;
 
        4'b1011:        rd_fifo1 <= 1'b0;
 
        4'b1100:        rd_fifo1 <= 1'b1;
 
        4'b1101:        rd_fifo1 <= hctr[0]==1'b0;
 
        4'b1110:        rd_fifo1 <= hctr[1:0]==2'b00;
 
        4'b1111:        rd_fifo1 <= hctr[1:0]==2'b00;
 
        endcase
 
reg shift,shift1,shift2;
 
always @(posedge vclk)
 
if (pixelCol < hDisplayed + 12'd8)
 
        case({color_depth,hres})
 
        // shift four times as often as a load
 
        4'b0000:        shift1 <= 1'b1;
 
        4'b0001:        shift1 <= hctr[0]==1'b0;
 
        4'b0010:        shift1 <= hctr[1:0]==2'b00;
 
        4'b0011:        shift1 <= hctr[1:0]==2'b00;
 
        // shift twice as often as a load
 
        4'b0100:        shift1 <= 1'b1;
 
        4'b0101:        shift1 <= hctr[0]==1'b0;
 
        4'b0110:        shift1 <= hctr[1:0]==2'b00;
 
        4'b0111:        shift1 <= hctr[1:0]==2'b00;
 
        // unsupported color depth
 
        4'b1000:        shift1 <= 1'b0;
 
        4'b1001:        shift1 <= 1'b0;
 
        4'b1010:        shift1 <= 1'b0;
 
        4'b1011:        shift1 <= 1'b0;
 
        // nothing to shift (all loads)
 
        4'b1100:        shift1 <= 1'b0;
 
        4'b1101:        shift1 <= 1'b0;
 
        4'b1110:        shift1 <= 1'b0;
 
        4'b1111:        shift1 <= 1'b0;
 
        endcase
 
always @(posedge vclk) shift2 <= shift1;
 
always @(posedge vclk) shift <= shift2;
 
always @(posedge vclk) rd_fifo2 <= rd_fifo1;
 
always @(posedge vclk) rd_fifo <= rd_fifo2;
 
always @(posedge vclk)
 
        if (rd_fifo)
 
                rgbo2 <= rgbo1;
 
        else if (shift)
 
                rgbo2 <= {8'h00,rgbo2[31:8]};
 
always @(posedge vclk)
 
        if (rd_fifo)
 
                rgbo3 <= rgbo1;
 
        else if (shift)
 
                rgbo3 <= {16'h0000,rgbo3[31:16]};
 
 
RAMB16_S9_S18 ram0
rtfVideoFifo uf1
(
(
        .CLKA(vclk),
        .rst(fifo_rst),
        .ADDRA({pixelRow[0],pixelCol[8:1],~pixelCol[0]}), // <- pixelCol[0] nonsense, we need the highest pixel first
        .wclk(clk_i),
        .DIA(8'hFF),
        .wr(cyc_o & ack_i),
        .DIPA(1'b1),
        .di(dat_i),
        .DOA(rgbo1),
        .rclk(vclk),
        .ENA(1'b1),
        .rd(rd_fifo),
        .WEA(1'b0),
        .do(rgbo1),
        .SSRA(blank),
        .cnt(fifo_cnt)
 
 
        .CLKB(clk_i),
 
        .ADDRB({~pixelRow[0],fetchCol[8:1]}),
 
        .DIB(dat_i),
 
        .DIPB(2'b11),
 
        .DOB(),
 
        .ENB(cyc_o),
 
        .WEB(ack_i),
 
        .SSRB(1'b0)
 
);
);
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.