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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [trunk/] [rtl/] [verilog/] [vga_wb_slave.v] - Diff between revs 28 and 30

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

Rev 28 Rev 30
Line 1... Line 1...
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
////  WISHBONE rev.B2 compliant VGA/LCD Core; Wishbone Slave     ////
////  WISHBONE rev.B2 compliant enhanced VGA/LCD Core            ////
////  Wishbone slave interface                                   ////
////  Wishbone slave interface                                   ////
////                                                             ////
////                                                             ////
////  Author: Richard Herveille                                  ////
////  Author: Richard Herveille                                  ////
////          richard@asics.ws                                   ////
////          richard@asics.ws                                   ////
////          www.asics.ws                                       ////
////          www.asics.ws                                       ////
////                                                             ////
////                                                             ////
////  Downloaded from: http://www.opencores.org/projects/vga_lcd ////
////  Downloaded from: http://www.opencores.org/projects/vga_lcd ////
////                                                             ////
////                                                             ////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
//// Copyright (C) 2001 Richard Herveille                        ////
//// Copyright (C) 2001, 2002 Richard Herveille                  ////
////                    richard@asics.ws                         ////
////                    richard@asics.ws                         ////
////                                                             ////
////                                                             ////
//// This source file may be used and distributed without        ////
//// This source file may be used and distributed without        ////
//// restriction provided that this copyright statement is not   ////
//// restriction provided that this copyright statement is not   ////
//// removed from the file and that any derivative work contains ////
//// removed from the file and that any derivative work contains ////
Line 35... Line 35...
////                                                             ////
////                                                             ////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
 
 
//  CVS Log
//  CVS Log
//
//
//  $Id: vga_wb_slave.v,v 1.5 2002-01-28 03:47:16 rherveille Exp $
//  $Id: vga_wb_slave.v,v 1.6 2002-02-07 05:42:10 rherveille Exp $
//
//
//  $Date: 2002-01-28 03:47:16 $
//  $Date: 2002-02-07 05:42:10 $
//  $Revision: 1.5 $
//  $Revision: 1.6 $
//  $Author: rherveille $
//  $Author: rherveille $
//  $Locker:  $
//  $Locker:  $
//  $State: Exp $
//  $State: Exp $
//
//
// Change History:
// Change History:
//               $Log: not supported by cvs2svn $
//               $Log: not supported by cvs2svn $
 
 
 
 
`include "timescale.v"
`include "timescale.v"
 
`include "vga_defines.v"
 
 
module vga_wb_slave(CLK_I, RST_I, nRESET, ADR_I, DAT_I, DAT_O, SEL_I, WE_I, STB_I, CYC_I, ACK_O, ERR_O, INTA_O,
module vga_wb_slave(CLK_I, RST_I, nRESET, ADR_I, DAT_I, DAT_O, SEL_I, WE_I, STB_I, CYC_I, ACK_O, ERR_O, INTA_O,
                bl, csl, vsl, hsl, pc, cd, vbl, cbsw, vbsw, ven, avmp, acmp, vbsint_in, cbsint_in, hint_in, vint_in, luint_in, sint_in,
                bl, csl, vsl, hsl, pc, cd, vbl, cbsw, vbsw, ven, avmp, acmp,
 
                cursor0_en, cursor0_xy, cursor0_ba, cursor0_ld, cursor1_en, cursor1_xy, cursor1_ba, cursor1_ld,
 
                vbsint_in, cbsint_in, hint_in, vint_in, luint_in, sint_in,
                Thsync, Thgdel, Thgate, Thlen, Tvsync, Tvgdel, Tvgate, Tvlen, VBARa, VBARb, clut_acc, clut_ack, clut_q);
                Thsync, Thgdel, Thgate, Thlen, Tvsync, Tvgdel, Tvgate, Tvlen, VBARa, VBARb, clut_acc, clut_ack, clut_q);
 
 
        //
        //
        // inputs & outputs
        // inputs & outputs
        //
        //
Line 86... Line 89...
        output pc;   // pseudo color
        output pc;   // pseudo color
        output [1:0] cd;   // color depth
        output [1:0] cd;   // color depth
        output [1:0] vbl;  // video memory burst length
        output [1:0] vbl;  // video memory burst length
        output cbsw; // clut bank switch enable
        output cbsw; // clut bank switch enable
        output vbsw; // video memory bank switch enable
        output vbsw; // video memory bank switch enable
        output ven;  // vdeio system enable
        output ven;        // video system enable
 
 
 
        // hardware cursor settings
 
        output         cursor0_en;
 
        output [31: 0] cursor0_xy;
 
        output [31:11] cursor0_ba;   // cursor0 base address
 
        output         cursor0_ld;   // reload cursor0 from video memory
 
        output         cursor1_en;
 
        output [31: 0] cursor1_xy;
 
        output [31:11] cursor1_ba;   // cursor1 base address
 
        output         cursor1_ld;   // reload cursor1 from video memory
 
 
 
        reg [31: 0] cursor0_xy;
 
        reg [31:11] cursor0_ba;
 
        reg         cursor0_ld;
 
        reg [31: 0] cursor1_xy;
 
        reg [31:11] cursor1_ba;
 
        reg         cursor1_ld;
 
 
        // status register inputs
        // status register inputs
        input avmp;          // active video memory page
        input avmp;          // active video memory page
        input acmp;          // active clut memory page
        input acmp;          // active clut memory page
        input vbsint_in;     // bank switch interrupt request
        input vbsint_in;     // bank switch interrupt request
Line 125... Line 145...
 
 
 
 
        //
        //
        // variable declarations
        // variable declarations
        //
        //
        wire [2:0] REG_ADR  = ADR_I[4:2];
        parameter REG_ADR_HIBIT = 3;
 
 
 
        wire [REG_ADR_HIBIT:0] REG_ADR  = ADR_I[REG_ADR_HIBIT +2 : 2];
        wire       CLUT_ADR = ADR_I[11];
        wire       CLUT_ADR = ADR_I[11];
 
 
        parameter [2:0] CTRL_ADR  = 3'b000;
        parameter [REG_ADR_HIBIT : 0] CTRL_ADR  = 4'b0000;
        parameter [2:0] STAT_ADR  = 3'b001;
        parameter [REG_ADR_HIBIT : 0] STAT_ADR  = 4'b0001;
        parameter [2:0] HTIM_ADR  = 3'b010;
        parameter [REG_ADR_HIBIT : 0] HTIM_ADR  = 4'b0010;
        parameter [2:0] VTIM_ADR  = 3'b011;
        parameter [REG_ADR_HIBIT : 0] VTIM_ADR  = 4'b0011;
        parameter [2:0] HVLEN_ADR = 3'b100;
        parameter [REG_ADR_HIBIT : 0] HVLEN_ADR = 4'b0100;
        parameter [2:0] VBARA_ADR = 3'b101;
        parameter [REG_ADR_HIBIT : 0] VBARA_ADR = 4'b0101;
        parameter [2:0] VBARB_ADR = 3'b110;
        parameter [REG_ADR_HIBIT : 0] VBARB_ADR = 4'b0110;
 
        parameter [REG_ADR_HIBIT : 0] C0XY_ADR  = 4'b1000;
 
        parameter [REG_ADR_HIBIT : 0] C0BAR_ADR = 4'b1001;
 
        parameter [REG_ADR_HIBIT : 0] C1XY_ADR  = 4'b1010;
 
        parameter [REG_ADR_HIBIT : 0] C1BAR_ADR = 4'b1011;
 
 
 
 
        reg [31:0] ctrl, stat, htim, vtim, hvlen;
        reg [31:0] ctrl, stat, htim, vtim, hvlen;
        wire hint, vint, vbsint, cbsint, luint, sint;
        wire hint, vint, vbsint, cbsint, luint, sint;
        wire hie, vie, vbsie, cbsie;
        wire hie, vie, vbsie, cbsie;
Line 188... Line 214...
                                HTIM_ADR  : htim  <= #1 DAT_I;
                                HTIM_ADR  : htim  <= #1 DAT_I;
                                VTIM_ADR  : vtim  <= #1 DAT_I;
                                VTIM_ADR  : vtim  <= #1 DAT_I;
                                HVLEN_ADR : hvlen <= #1 DAT_I;
                                HVLEN_ADR : hvlen <= #1 DAT_I;
                                VBARA_ADR : VBARa <= #1 DAT_I[31: 2];
                                VBARA_ADR : VBARa <= #1 DAT_I[31: 2];
                                VBARB_ADR : VBARb <= #1 DAT_I[31: 2];
                                VBARB_ADR : VBARb <= #1 DAT_I[31: 2];
 
                                C0XY_ADR  : cursor0_xy <= #1 DAT_I[31: 0];
 
                                C0BAR_ADR : cursor0_ba <= #1 DAT_I[31:11];
 
                                C1XY_ADR  : cursor1_xy <= #1 DAT_I[31: 0];
 
                                C1BAR_ADR : cursor1_ba <= #1 DAT_I[31:11];
                        endcase
                        endcase
        end
        end
 
 
 
        always@(posedge CLK_I)
 
                begin
 
                        cursor0_ld <= #1 reg_wacc && (ADR_I == C0BAR_ADR);
 
                        cursor1_ld <= #1 reg_wacc && (ADR_I == C1BAR_ADR);
 
                end
 
 
        // generate control register
        // generate control register
        always@(posedge CLK_I or negedge nRESET)
        always@(posedge CLK_I or negedge nRESET)
                if (!nRESET)
                if (!nRESET)
                        ctrl <= #1 0;
                        ctrl <= #1 0;
Line 215... Line 250...
                        stat <= #1 0;
                        stat <= #1 0;
                else if (RST_I)
                else if (RST_I)
                        stat <= #1 0;
                        stat <= #1 0;
                else
                else
                        begin
                        begin
 
                                `ifdef VGA_HWC1
 
                                        stat[21] <= #1 1'b1;
 
                                `else
 
                                        stat[21] <= #1 1'b0;
 
                                `endif
 
                                `ifdef VGA_HWC0
 
                                        stat[20] <= #1 1'b1;
 
                                `else
 
                                        stat[20] <= #1 1'b0;
 
                                `endif
 
 
                                stat[17] <= #1 acmp;
                                stat[17] <= #1 acmp;
                                stat[16] <= #1 avmp;
                                stat[16] <= #1 avmp;
 
 
                                if (reg_wacc & (REG_ADR == STAT_ADR) )
                                if (reg_wacc & (REG_ADR == STAT_ADR) )
                                        begin
                                        begin
                                                stat[7] <= #1 cbsint_in | (stat[7] & !DAT_I[7]);
                                                stat[7] <= #1 cbsint_in | (stat[7] & !DAT_I[7]);
                                                stat[6] <= #1 vbsint_in | (stat[6] & !DAT_I[6]);
                                                stat[6] <= #1 vbsint_in | (stat[6] & !DAT_I[6]);
                                                stat[5] <= #1 hint_in   | (stat[5] & !DAT_I[5]);
                                                stat[5] <= #1 hint_in   | (stat[5] & !DAT_I[5]);
Line 239... Line 286...
                                        end
                                        end
                        end
                        end
 
 
 
 
        // decode control register
        // decode control register
 
        assign cursor1_en = ctrl[21];
 
        assign cursor0_en = ctrl[20];
        assign bl    = ctrl[15];
        assign bl    = ctrl[15];
        assign csl   = ctrl[14];
        assign csl   = ctrl[14];
        assign vsl   = ctrl[13];
        assign vsl   = ctrl[13];
        assign hsl   = ctrl[12];
        assign hsl   = ctrl[12];
        assign pc    = ctrl[11];
        assign pc    = ctrl[11];
Line 285... Line 334...
                HTIM_ADR  : reg_dato = htim;
                HTIM_ADR  : reg_dato = htim;
                VTIM_ADR  : reg_dato = vtim;
                VTIM_ADR  : reg_dato = vtim;
                HVLEN_ADR : reg_dato = hvlen;
                HVLEN_ADR : reg_dato = hvlen;
                VBARA_ADR : reg_dato = {VBARa, 2'b0};
                VBARA_ADR : reg_dato = {VBARa, 2'b0};
                VBARB_ADR : reg_dato = {VBARb, 2'b0};
                VBARB_ADR : reg_dato = {VBARb, 2'b0};
 
                C0XY_ADR  : reg_dato = cursor0_xy;
 
                C0BAR_ADR : reg_dato = {cursor0_ba, 11'h0};
 
                C1XY_ADR  : reg_dato = cursor1_xy;
 
                C1BAR_ADR : reg_dato = {cursor1_ba, 11'h0};
                default   : reg_dato = 32'h0000_0000;
                default   : reg_dato = 32'h0000_0000;
        endcase
        endcase
 
 
        always@(posedge CLK_I)
        always@(posedge CLK_I)
                DAT_O <= #1 reg_acc ? reg_dato : {8'h0, clut_q};
                DAT_O <= #1 reg_acc ? reg_dato : {8'h0, clut_q};
Line 297... Line 350...
        always@(posedge CLK_I)
        always@(posedge CLK_I)
                INTA_O <= #1 (hint & hie) | (vint & vie) | (vbsint & vbsie) | (cbsint & cbsie) | luint | sint;
                INTA_O <= #1 (hint & hie) | (vint & vie) | (vbsint & vbsie) | (cbsint & cbsie) | luint | sint;
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.