Line 35... |
Line 35... |
//// ////
|
//// ////
|
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
|
|
// CVS Log
|
// CVS Log
|
//
|
//
|
// $Id: vga_wb_slave.v,v 1.11 2002-04-20 10:02:39 rherveille Exp $
|
// $Id: vga_wb_slave.v,v 1.12 2003-05-07 09:48:54 rherveille Exp $
|
//
|
//
|
// $Date: 2002-04-20 10:02:39 $
|
// $Date: 2003-05-07 09:48:54 $
|
// $Revision: 1.11 $
|
// $Revision: 1.12 $
|
// $Author: rherveille $
|
// $Author: rherveille $
|
// $Locker: $
|
// $Locker: $
|
// $State: Exp $
|
// $State: Exp $
|
//
|
//
|
// Change History:
|
// Change History:
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.11 2002/04/20 10:02:39 rherveille
|
|
// Changed video timing generator.
|
|
// Changed wishbone master vertical gate count code.
|
|
// Fixed a potential bug in the wishbone slave (cursor color register readout).
|
|
//
|
// Revision 1.10 2002/03/28 04:59:25 rherveille
|
// Revision 1.10 2002/03/28 04:59:25 rherveille
|
// Fixed two small bugs that only showed up when the hardware cursors were disabled
|
// Fixed two small bugs that only showed up when the hardware cursors were disabled
|
//
|
//
|
// Revision 1.9 2002/03/04 16:05:52 rherveille
|
// Revision 1.9 2002/03/04 16:05:52 rherveille
|
// Added hardware cursor support to wishbone master.
|
// Added hardware cursor support to wishbone master.
|
Line 66... |
Line 71... |
// Removed / Changed some strange logic constructions
|
// Removed / Changed some strange logic constructions
|
// Started work on hardware cursor support (not finished yet)
|
// Started work on hardware cursor support (not finished yet)
|
// Changed top-level name to vga_enh_top.v
|
// Changed top-level name to vga_enh_top.v
|
//
|
//
|
|
|
|
//synopsys translate_off
|
`include "timescale.v"
|
`include "timescale.v"
|
|
//synopsys translate_on
|
`include "vga_defines.v"
|
`include "vga_defines.v"
|
|
|
module vga_wb_slave(clk_i, rst_i, arst_i, adr_i, dat_i, dat_o, sel_i, we_i, stb_i, cyc_i, ack_o, err_o, inta_o,
|
module vga_wb_slave(
|
bl, csl, vsl, hsl, pc, cd, vbl, cbsw, vbsw, ven, avmp, acmp,
|
clk_i, rst_i, arst_i, adr_i, dat_i, dat_o, sel_i, we_i, stb_i, cyc_i, ack_o, rty_o, err_o, inta_o,
|
|
wbm_busy, dvi_odf, bl, csl, vsl, hsl, pc, cd, vbl, cbsw, vbsw, ven, avmp, acmp,
|
cursor0_res, cursor0_en, cursor0_xy, cursor0_ba, cursor0_ld, cc0_adr_i, cc0_dat_o,
|
cursor0_res, cursor0_en, cursor0_xy, cursor0_ba, cursor0_ld, cc0_adr_i, cc0_dat_o,
|
cursor1_res, cursor1_en, cursor1_xy, cursor1_ba, cursor1_ld, cc1_adr_i, cc1_dat_o,
|
cursor1_res, cursor1_en, cursor1_xy, cursor1_ba, cursor1_ld, cc1_adr_i, cc1_dat_o,
|
vbsint_in, cbsint_in, hint_in, vint_in, luint_in, sint_in,
|
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 95... |
Line 104... |
input we_i;
|
input we_i;
|
input stb_i;
|
input stb_i;
|
input cyc_i;
|
input cyc_i;
|
output ack_o;
|
output ack_o;
|
reg ack_o;
|
reg ack_o;
|
|
output rty_o;
|
|
reg rty_o;
|
output err_o;
|
output err_o;
|
reg err_o;
|
reg err_o;
|
output inta_o;
|
output inta_o;
|
reg inta_o;
|
reg inta_o;
|
|
|
|
// wishbone master controller feedback
|
|
input wbm_busy; // data transfer in progress
|
|
|
// control register settings
|
// control register settings
|
|
output [1:0] dvi_odf; // DVI output data format
|
output bl; // blanking level
|
output bl; // blanking level
|
output csl; // composite sync level
|
output csl; // composite sync level
|
output vsl; // vsync level
|
output vsl; // vsync level
|
output hsl; // hsync level
|
output hsl; // hsync level
|
output pc; // pseudo color
|
output pc; // pseudo color
|
Line 209... |
Line 224... |
//
|
//
|
|
|
assign acc = cyc_i & stb_i;
|
assign acc = cyc_i & stb_i;
|
assign acc32 = (sel_i == 4'b1111);
|
assign acc32 = (sel_i == 4'b1111);
|
assign clut_acc = CLUT_ADR & acc & acc32;
|
assign clut_acc = CLUT_ADR & acc & acc32;
|
assign reg_acc = !CLUT_ADR & acc & acc32;
|
assign reg_acc = ~CLUT_ADR & acc & acc32;
|
assign reg_wacc = reg_acc & we_i;
|
assign reg_wacc = reg_acc & we_i;
|
|
|
assign cc0_acc = CCR0_ADR & acc & acc32;
|
assign cc0_acc = (REG_ADR == CCR0_ADR) & acc & acc32;
|
assign cc1_acc = CCR1_ADR & acc & acc32;
|
assign cc1_acc = (REG_ADR == CCR1_ADR) & acc & acc32;
|
|
|
|
always @(posedge clk_i)
|
|
ack_o <= #1 ((reg_acc & acc32) | clut_ack) & ~(wbm_busy & REG_ADR == CTRL_ADR) & ~ack_o ;
|
|
|
always@(posedge clk_i)
|
always@(posedge clk_i)
|
ack_o <= #1 ((reg_acc & acc32) | clut_ack) & !ack_o;
|
rty_o <= #1 ((reg_acc & acc32) | clut_ack) & (wbm_busy & REG_ADR == CTRL_ADR) & ~rty_o ;
|
|
|
always@(posedge clk_i)
|
always@(posedge clk_i)
|
err_o <= #1 acc & !acc32 & !err_o;
|
err_o <= #1 acc & ~acc32 & ~err_o;
|
|
|
|
|
// generate registers
|
// generate registers
|
always@(posedge clk_i or negedge arst_i)
|
always@(posedge clk_i or negedge arst_i)
|
begin : gen_regs
|
begin : gen_regs
|
Line 275... |
Line 293... |
always@(posedge clk_i or negedge arst_i)
|
always@(posedge clk_i or negedge arst_i)
|
if (!arst_i)
|
if (!arst_i)
|
ctrl <= #1 0;
|
ctrl <= #1 0;
|
else if (rst_i)
|
else if (rst_i)
|
ctrl <= #1 0;
|
ctrl <= #1 0;
|
else if (reg_wacc & (REG_ADR == CTRL_ADR) )
|
else if (reg_wacc & (REG_ADR == CTRL_ADR) & ~wbm_busy )
|
ctrl <= #1 dat_i;
|
ctrl <= #1 dat_i;
|
else
|
else begin
|
begin
|
|
ctrl[6] <= #1 ctrl[6] & !cbsint_in;
|
ctrl[6] <= #1 ctrl[6] & !cbsint_in;
|
ctrl[5] <= #1 ctrl[5] & !vbsint_in;
|
ctrl[5] <= #1 ctrl[5] & !vbsint_in;
|
end
|
end
|
|
|
|
|
Line 290... |
Line 307... |
always@(posedge clk_i or negedge arst_i)
|
always@(posedge clk_i or negedge arst_i)
|
if (!arst_i)
|
if (!arst_i)
|
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
|
`ifdef VGA_HWC1
|
stat[21] <= #1 1'b1;
|
stat[21] <= #1 1'b1;
|
`else
|
`else
|
stat[21] <= #1 1'b0;
|
stat[21] <= #1 1'b0;
|
`endif
|
`endif
|
Line 328... |
Line 344... |
end
|
end
|
end
|
end
|
|
|
|
|
// decode control register
|
// decode control register
|
|
assign dvi_odf = ctrl[29:28];
|
assign cursor1_res = ctrl[25];
|
assign cursor1_res = ctrl[25];
|
assign cursor1_en = ctrl[24];
|
assign cursor1_en = ctrl[24];
|
assign cursor0_res = ctrl[23];
|
assign cursor0_res = ctrl[23];
|
assign cursor0_en = ctrl[20];
|
assign cursor0_en = ctrl[20];
|
assign bl = ctrl[15];
|
assign bl = ctrl[15];
|