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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [trunk/] [rtl/] [verilog/] [vga_colproc.v] - Diff between revs 17 and 19

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

Rev 17 Rev 19
Line 1... Line 1...
//
//
// File colproc.vhd, Color Processor
// File colproc.vhd, Color Processor
// Project: VGA
// Project: VGA
// Author : Richard Herveille. Ideas and thoughts: Sherif Taher Eid
// Author : Richard Herveille. Ideas and thoughts: Sherif Taher Eid
 
//
// rev. 1.0 August  2nd, 2001. Initial Verilog release
// rev. 1.0 August  2nd, 2001. Initial Verilog release
// rev. 1.1 August 29th, 2001. Changed statemachine to increase bandwidth.
// rev. 1.1 August 29th, 2001. Changed statemachine to increase bandwidth.
//
// rev. 2.0 October  2nd, 2001. Revised core. Included color lookup table in Color Processor
 
 
`include "timescale.v"
`include "timescale.v"
 
 
module vga_colproc(clk, srst, pixel_buffer_di, wb_di, ColorDepth, PseudoColor,
module vga_colproc(clk, srst, pixel_buffer_di, ColorDepth, PseudoColor,
                                                pixel_buffer_empty, pixel_buffer_rreq, RGB_fifo_full,
                                                pixel_buffer_empty, pixel_buffer_rreq, RGB_fifo_full,
                                                RGB_fifo_wreq, R, G, B, clut_req, clut_offs, clut_ack);
                                                RGB_fifo_wreq, R, G, B,
 
                                                clut_req, clut_ack, clut_offs, clut_q);
 
 
 
        //
        // inputs & outputs
        // inputs & outputs
 
        //
        input clk;                    // master clock
        input clk;                    // master clock
        input srst;                   // synchronous reset
        input srst;                   // synchronous reset
 
 
        input [31:0] pixel_buffer_di; // Pixel Buffer data input
        input [31:0] pixel_buffer_di; // Pixel Buffer data input
        input [31:0] wb_di;           // wishbone data input
 
 
 
        input [1:0] ColorDepth;       // color depth (8bpp, 16bpp, 24bpp)
        input [1:0] ColorDepth;       // color depth (8bpp, 16bpp, 24bpp)
        input PseudoColor;            // pseudo color enabled (only for 8bpp color depth)
        input PseudoColor;            // pseudo color enabled (only for 8bpp color depth)
 
 
        input  pixel_buffer_empty;
        input  pixel_buffer_empty;
Line 30... Line 33...
        output RGB_fifo_wreq;
        output RGB_fifo_wreq;
        reg    RGB_fifo_wreq;
        reg    RGB_fifo_wreq;
        output [7:0] R, G, B;         // pixel color information
        output [7:0] R, G, B;         // pixel color information
        reg    [7:0] R, G, B;
        reg    [7:0] R, G, B;
 
 
        output clut_req;              // Color lookup table access request
        output        clut_req;  // clut request
        reg    clut_req;
        reg    clut_req;
        output [7:0] clut_offs;       // offset into color lookup table
        input         clut_ack;  // clut acknowledge
 
        output [ 7:0] clut_offs; // clut offset
        reg    [7:0] clut_offs;
        reg    [7:0] clut_offs;
        input  clut_ack;              // Color lookup table data acknowledge
        input  [23:0] clut_q;    // clut data in
 
 
 
        //
        // variable declarations
        // variable declarations
 
        //
        reg [31:0] DataBuffer;
        reg [31:0] DataBuffer;
 
 
        reg [7:0] Ra, Ga, Ba;
        reg [7:0] Ra, Ga, Ba;
        reg [1:0] colcnt;
        reg [1:0] colcnt;
        reg RGBbuf_wreq;
        reg RGBbuf_wreq;
 
 
 
 
        //
        //
        // Module body
        // Module body
        //
        //
 
 
        // store word from pixelbuffer / wishbone input
        // store word from pixelbuffer / wishbone input
Line 152... Line 157...
                                c_state <= #1 idle;
                                c_state <= #1 idle;
                        else
                        else
                                c_state <= #1 nxt_state;
                                c_state <= #1 nxt_state;
 
 
 
 
        reg clut_acc;
        reg iclut_req;
        reg pixelbuf_rreq;
        reg pixelbuf_rreq;
        reg [7:0] iR, iG, iB, iRa, iGa, iBa;
        reg [7:0] iR, iG, iB, iRa, iGa, iBa;
 
 
        // output decoder
        // output decoder
        always@(c_state or pixel_buffer_empty or colcnt or DataBuffer or RGB_fifo_full or clut_ack or wb_di or Ba or Ga or Ra)
        always@(c_state or pixel_buffer_empty or colcnt or DataBuffer or RGB_fifo_full or clut_ack or clut_q or Ba or Ga or Ra)
        begin : output_decoder
        begin : output_decoder
 
 
                // initial values
                // initial values
                pixelbuf_rreq = 1'b0;
                pixelbuf_rreq = 1'b0;
                RGBbuf_wreq = 1'b0;
                RGBbuf_wreq = 1'b0;
                clut_acc = 1'b0;
                iclut_req = 1'b0;
 
 
                iR  = 'h0;
                iR  = 'h0;
                iG  = 'h0;
                iG  = 'h0;
                iB  = 'h0;
                iB  = 'h0;
                iRa = 'h0;
                iRa = 'h0;
Line 231... Line 236...
 
 
                                                if ( (!pixel_buffer_empty) && !(|colcnt) )
                                                if ( (!pixel_buffer_empty) && !(|colcnt) )
                                                        pixelbuf_rreq = 1'b1;
                                                        pixelbuf_rreq = 1'b1;
                                        end
                                        end
 
 
                                iR = wb_di[23:16];
                                iR = clut_q[23:16];
                                iG = wb_di[15: 8];
                                iG = clut_q[15: 8];
                                iB = wb_di[ 7: 0];
                                iB = clut_q[ 7: 0];
 
 
                                clut_acc = ~RGB_fifo_full;
                                iclut_req = ~RGB_fifo_full;
 
 
                                if ( !(|colcnt) && clut_ack)
                                if ( !(|colcnt) && clut_ack)
                                        clut_acc =1'b0;
                                        iclut_req =1'b0;
                        end
                        end
 
 
                        //
                        //
                        // 16 bits per pixel
                        // 16 bits per pixel
                        //
                        //
Line 347... Line 352...
                                end
                                end
                        else
                        else
                                begin
                                begin
                                        pixel_buffer_rreq <= #1 pixelbuf_rreq;
                                        pixel_buffer_rreq <= #1 pixelbuf_rreq;
                                        RGB_fifo_wreq <= #1 RGBbuf_wreq;
                                        RGB_fifo_wreq <= #1 RGBbuf_wreq;
                                        clut_req <= #1 clut_acc;
                                        clut_req <= #1 iclut_req;
                                end
                                end
        end
        end
 
 
        // assign clut offset
        // assign clut offset
        always@(colcnt or DataBuffer)
        always@(colcnt or DataBuffer)
Line 369... Line 374...
        always@(posedge clk)
        always@(posedge clk)
                if(srst)
                if(srst)
                        colcnt <= #1 2'b11;
                        colcnt <= #1 2'b11;
                else if (RGBbuf_wreq)
                else if (RGBbuf_wreq)
                        colcnt <= #1 colcnt -2'h1;
                        colcnt <= #1 colcnt -2'h1;
 
 
endmodule
endmodule
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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.