//==================================================================//
|
//==================================================================//
|
// File: d_MouseInput.v //
|
// File: d_MouseInput.v //
|
// Version: 0.0.0.2 //
|
// Version: 0.0.0.2 //
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
|
// Copyright (C) Stephen Pickett //
|
// Copyright (C) Stephen Pickett //
|
// Jun 08, 2005 //
|
// Jun 08, 2005 //
|
// //
|
// //
|
// This program is free software; you can redistribute it and/or //
|
// This program is free software; you can redistribute it and/or //
|
// modify it under the terms of the GNU General Public License //
|
// modify it under the terms of the GNU General Public License //
|
// as published by the Free Software Foundation; either version 2 //
|
// as published by the Free Software Foundation; either version 2 //
|
// of the License, or (at your option) any later version. //
|
// of the License, or (at your option) any later version. //
|
// //
|
// //
|
// This program is distributed in the hope that it will be useful, //
|
// This program is distributed in the hope that it will be useful, //
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
// GNU General Public License for more details. //
|
// GNU General Public License for more details. //
|
// //
|
// //
|
// If you have not received a copy of the GNU General Public License//
|
// If you have not received a copy of the GNU General Public License//
|
// along with this program; write to: //
|
// along with this program; write to: //
|
// Free Software Foundation, Inc., //
|
// Free Software Foundation, Inc., //
|
// 51 Franklin Street, Fifth Floor, //
|
// 51 Franklin Street, Fifth Floor, //
|
// Boston, MA 02110-1301, USA. //
|
// Boston, MA 02110-1301, USA. //
|
// //
|
// //
|
//------------------------------------------------------------------//
|
//------------------------------------------------------------------//
|
// Revisions: //
|
// Revisions: //
|
// Ver 0.0.0.1 May , 2005 Under Development //
|
// Ver 0.0.0.1 May , 2005 Under Development //
|
// Ver 0.0.0.2 Jun 08, 2005 Modulized 'UserLines' //
|
// Ver 0.0.0.2 Jun 08, 2005 Modulized 'UserLines' //
|
// //
|
// //
|
//==================================================================//
|
//==================================================================//
|
|
|
module Driver_MouseInput(
|
module Driver_MouseInput(
|
CLK_50MHZ, MASTER_RST,
|
CLK_50MHZ, MASTER_RST,
|
XCOORD, YCOORD, L_BUTTON, R_BUTTON, M_BUTTON,
|
XCOORD, YCOORD, L_BUTTON, R_BUTTON, M_BUTTON,
|
TRIGGER_LEVEL, VERT_OFFSET, HORZ_OFFSET,
|
TRIGGER_LEVEL, VERT_OFFSET, HORZ_OFFSET,
|
TIMESCALE, TRIGGERSTYLE
|
TIMESCALE, TRIGGERSTYLE
|
);
|
);
|
|
|
|
|
//==================================================================//
|
//==================================================================//
|
// PARAMETER DEFINITIONS //
|
// PARAMETER DEFINITIONS //
|
//==================================================================//
|
//==================================================================//
|
parameter P_clickLimit_left = 10'd556;
|
parameter P_clickLimit_left = 10'd556;
|
parameter P_clickLimit_right = 10'd558;
|
parameter P_clickLimit_right = 10'd558;
|
parameter P_clickLimit_leftV = 10'd559;
|
parameter P_clickLimit_leftV = 10'd559;
|
parameter P_clickLimit_rightV = 10'd561;
|
parameter P_clickLimit_rightV = 10'd561;
|
parameter P_clickLimit_top = 10'd102;
|
parameter P_clickLimit_top = 10'd102;
|
parameter P_clickLimit_bot = 10'd100;
|
parameter P_clickLimit_bot = 10'd100;
|
|
|
|
|
//==================================================================//
|
//==================================================================//
|
// VARIABLE DEFINITIONS //
|
// VARIABLE DEFINITIONS //
|
//==================================================================//
|
//==================================================================//
|
//----------------------//
|
//----------------------//
|
// INPUTS / OUTPUTS //
|
// INPUTS / OUTPUTS //
|
//----------------------//
|
//----------------------//
|
input CLK_50MHZ; // System wide clock
|
input CLK_50MHZ; // System wide clock
|
input MASTER_RST; // System wide reset
|
input MASTER_RST; // System wide reset
|
input[9:0] XCOORD; // X coordinate of the cursor
|
input[9:0] XCOORD; // X coordinate of the cursor
|
input[9:0] YCOORD; // Y coordinate of the cursor
|
input[9:0] YCOORD; // Y coordinate of the cursor
|
input L_BUTTON; // Left Mouse Button Press
|
input L_BUTTON; // Left Mouse Button Press
|
input R_BUTTON; // Right Mouse Button Press
|
input R_BUTTON; // Right Mouse Button Press
|
input M_BUTTON; // Middle Mouse Button Press
|
input M_BUTTON; // Middle Mouse Button Press
|
output[9:0] TRIGGER_LEVEL; // Current Trigger Level
|
output[9:0] TRIGGER_LEVEL; // Current Trigger Level
|
output[9:0] VERT_OFFSET; // VERTICAL OFFSET
|
output[9:0] VERT_OFFSET; // VERTICAL OFFSET
|
output[9:0] HORZ_OFFSET; // HORIZONTAL OFFSET
|
output[9:0] HORZ_OFFSET; // HORIZONTAL OFFSET
|
output[3:0] TIMESCALE; // Current Tiemscale value
|
output[3:0] TIMESCALE; // Current Tiemscale value
|
output[1:0] TRIGGERSTYLE; // Style (rise/fall) of trigger
|
output[1:0] TRIGGERSTYLE; // Style (rise/fall) of trigger
|
|
|
//----------------------//
|
//----------------------//
|
// WIRES / NODES //
|
// WIRES / NODES //
|
//----------------------//
|
//----------------------//
|
wire CLK_50MHZ, MASTER_RST;
|
wire CLK_50MHZ, MASTER_RST;
|
wire[9:0] XCOORD;
|
wire[9:0] XCOORD;
|
wire[9:0] YCOORD;
|
wire[9:0] YCOORD;
|
wire L_BUTTON, R_BUTTON, M_BUTTON;
|
wire L_BUTTON, R_BUTTON, M_BUTTON;
|
wire[9:0] TRIGGER_LEVEL, VERT_OFFSET, HORZ_OFFSET;
|
wire[9:0] TRIGGER_LEVEL, VERT_OFFSET, HORZ_OFFSET;
|
wire[3:0] TIMESCALE;
|
wire[3:0] TIMESCALE;
|
wire[1:0] TRIGGERSTYLE;
|
wire[1:0] TRIGGERSTYLE;
|
|
|
//----------------------//
|
//----------------------//
|
// REGISTERS //
|
// REGISTERS //
|
//----------------------//
|
//----------------------//
|
|
|
|
|
//----------------------//
|
//----------------------//
|
// TESTING //
|
// TESTING //
|
//----------------------//
|
//----------------------//
|
|
|
|
|
|
|
|
|
//==================================================================//
|
//==================================================================//
|
// FUNCTIONAL DEFINITIONS //
|
// FUNCTIONAL DEFINITIONS //
|
//==================================================================//
|
//==================================================================//
|
|
|
//------------------------------------------------------------------//
|
//------------------------------------------------------------------//
|
// INTERMEDIATES //
|
// INTERMEDIATES //
|
//------------------------------------------------------------------//
|
//------------------------------------------------------------------//
|
|
|
// -- LEFT BUTTON --
|
// -- LEFT BUTTON --
|
wire Lrise, Lfall;
|
wire Lrise, Lfall;
|
reg Lbuf;
|
reg Lbuf;
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
if(MASTER_RST == 1'b1) Lbuf <= 1'b0;
|
if(MASTER_RST == 1'b1) Lbuf <= 1'b0;
|
else Lbuf <= L_BUTTON;
|
else Lbuf <= L_BUTTON;
|
end
|
end
|
|
|
assign Lrise = (!Lbuf & L_BUTTON);
|
assign Lrise = (!Lbuf & L_BUTTON);
|
assign Lfall = ( Lbuf & !L_BUTTON);
|
assign Lfall = ( Lbuf & !L_BUTTON);
|
|
|
// -- RIGHT BUTTON --
|
// -- RIGHT BUTTON --
|
wire Rrise, Rfall;
|
wire Rrise, Rfall;
|
reg Rbuf;
|
reg Rbuf;
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
if(MASTER_RST == 1'b1) Rbuf <= 1'b0;
|
if(MASTER_RST == 1'b1) Rbuf <= 1'b0;
|
else Rbuf <= R_BUTTON;
|
else Rbuf <= R_BUTTON;
|
end
|
end
|
|
|
assign Rrise = (!Rbuf & R_BUTTON);
|
assign Rrise = (!Rbuf & R_BUTTON);
|
assign Rfall = ( Rbuf & !R_BUTTON);
|
assign Rfall = ( Rbuf & !R_BUTTON);
|
|
|
|
|
// -- MIDDLE BUTTON --
|
// -- MIDDLE BUTTON --
|
wire Mrise, Mfall;
|
wire Mrise, Mfall;
|
reg Mbuf;
|
reg Mbuf;
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
always @ (posedge CLK_50MHZ or posedge MASTER_RST) begin
|
if(MASTER_RST == 1'b1) Mbuf <= 1'b0;
|
if(MASTER_RST == 1'b1) Mbuf <= 1'b0;
|
else Mbuf <= M_BUTTON;
|
else Mbuf <= M_BUTTON;
|
end
|
end
|
|
|
assign Mrise = (!Mbuf & M_BUTTON);
|
assign Mrise = (!Mbuf & M_BUTTON);
|
assign Mfall = ( Mbuf & !M_BUTTON);
|
assign Mfall = ( Mbuf & !M_BUTTON);
|
|
|
|
|
//------------------------------------------------------------------//
|
//------------------------------------------------------------------//
|
// USER MODIFIABLE LINES //
|
// USER MODIFIABLE LINES //
|
//------------------------------------------------------------------//
|
//------------------------------------------------------------------//
|
sub_UserLines set_trigger(
|
sub_UserLines set_trigger(
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.LINE_VALUE_OUT(TRIGGER_LEVEL),
|
.LINE_VALUE_OUT(TRIGGER_LEVEL),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_FALL(Lfall),
|
.BUTTON_FALL(Lfall),
|
.XCOORD(XCOORD),
|
.XCOORD(XCOORD),
|
.YCOORD(YCOORD),
|
.YCOORD(YCOORD),
|
.RESET_VALUE(10'd99),
|
.RESET_VALUE(10'd99),
|
.LEFT(P_clickLimit_left),
|
.LEFT(P_clickLimit_left),
|
.RGHT(P_clickLimit_right),
|
.RGHT(P_clickLimit_right),
|
.BOT(TRIGGER_LEVEL),
|
.BOT(TRIGGER_LEVEL),
|
// .BOT(TRIGGER_LEVEL-1'b1),
|
// .BOT(TRIGGER_LEVEL-1'b1),
|
.TOP(TRIGGER_LEVEL+1'b1),
|
.TOP(TRIGGER_LEVEL+1'b1),
|
.SETXnY(1'b0)
|
.SETXnY(1'b0)
|
);
|
);
|
|
|
sub_UserLines set_Voffset(
|
sub_UserLines set_Voffset(
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.LINE_VALUE_OUT(VERT_OFFSET),
|
.LINE_VALUE_OUT(VERT_OFFSET),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_FALL(Lfall),
|
.BUTTON_FALL(Lfall),
|
.XCOORD(XCOORD),
|
.XCOORD(XCOORD),
|
.YCOORD(YCOORD),
|
.YCOORD(YCOORD),
|
.RESET_VALUE(10'd0),
|
.RESET_VALUE(10'd0),
|
.LEFT(P_clickLimit_leftV),
|
.LEFT(P_clickLimit_leftV),
|
.RGHT(P_clickLimit_rightV),
|
.RGHT(P_clickLimit_rightV),
|
.BOT(VERT_OFFSET),
|
.BOT(VERT_OFFSET),
|
// .BOT(VERT_OFFSET-1'b1),
|
// .BOT(VERT_OFFSET-1'b1),
|
.TOP(VERT_OFFSET+1'b1),
|
.TOP(VERT_OFFSET+1'b1),
|
.SETXnY(1'b0)
|
.SETXnY(1'b0)
|
);
|
);
|
|
|
sub_UserLines set_Hoffset(
|
sub_UserLines set_Hoffset(
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.LINE_VALUE_OUT(HORZ_OFFSET),
|
.LINE_VALUE_OUT(HORZ_OFFSET),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_FALL(Lfall),
|
.BUTTON_FALL(Lfall),
|
.XCOORD(XCOORD),
|
.XCOORD(XCOORD),
|
.YCOORD(YCOORD),
|
.YCOORD(YCOORD),
|
.RESET_VALUE(10'd319),
|
.RESET_VALUE(10'd319),
|
// .LEFT(HORZ_OFFSET-1'b1),
|
// .LEFT(HORZ_OFFSET-1'b1),
|
.LEFT(HORZ_OFFSET),
|
.LEFT(HORZ_OFFSET),
|
.RGHT(HORZ_OFFSET+1'b1),
|
.RGHT(HORZ_OFFSET+1'b1),
|
.BOT(P_clickLimit_bot),
|
.BOT(P_clickLimit_bot),
|
.TOP(P_clickLimit_top),
|
.TOP(P_clickLimit_top),
|
.SETXnY(1'b1)
|
.SETXnY(1'b1)
|
);
|
);
|
|
|
sub_UserTimeScaleBox TSBox(
|
sub_UserTimeScaleBox TSBox(
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.VALUE_OUT(TIMESCALE),
|
.VALUE_OUT(TIMESCALE),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_FALL(Lfall),
|
.BUTTON_FALL(Lfall),
|
.XCOORD(XCOORD),
|
.XCOORD(XCOORD),
|
.YCOORD(YCOORD)
|
.YCOORD(YCOORD)
|
);
|
);
|
|
|
sub_UserTriggerStyleBox TrigStyleBox(
|
sub_UserTriggerStyleBox TrigStyleBox(
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.MASTER_CLK(CLK_50MHZ), .MASTER_RST(MASTER_RST),
|
.VALUE_OUT(TRIGGERSTYLE),
|
.VALUE_OUT(TRIGGERSTYLE),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_RISE(Lrise),
|
.BUTTON_FALL(Lfall),
|
.BUTTON_FALL(Lfall),
|
.XCOORD(XCOORD),
|
.XCOORD(XCOORD),
|
.YCOORD(YCOORD)
|
.YCOORD(YCOORD)
|
);
|
);
|
|
|
|
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|