Line 29... |
Line 29... |
|
|
module sub_UserLines(
|
module sub_UserLines(
|
MASTER_CLK, MASTER_RST,
|
MASTER_CLK, MASTER_RST,
|
LINE_VALUE_OUT,
|
LINE_VALUE_OUT,
|
BUTTON_RISE, BUTTON_FALL,
|
BUTTON_RISE, BUTTON_FALL,
|
XCOORD, YCOORD,
|
XCOORD, YCOORD, RESET_VALUE,
|
LEFT, RGHT, BOT, TOP,
|
LEFT, RGHT, BOT, TOP,
|
SETXnY
|
SETXnY
|
);
|
);
|
|
|
//==================================================================//
|
//==================================================================//
|
Line 58... |
Line 58... |
input BUTTON_RISE; // Trigger has risen
|
input BUTTON_RISE; // Trigger has risen
|
input BUTTON_FALL; // Trigger has fallen
|
input BUTTON_FALL; // Trigger has fallen
|
|
|
output[9:0] LINE_VALUE_OUT; // a 10 bit register to store the X or Y value
|
output[9:0] LINE_VALUE_OUT; // a 10 bit register to store the X or Y value
|
|
|
|
input[9:0] RESET_VALUE; // Reset value
|
|
|
//----------------------//
|
//----------------------//
|
// NODES //
|
// NODES //
|
//----------------------//
|
//----------------------//
|
wire MASTER_CLK, MASTER_RST;
|
wire MASTER_CLK, MASTER_RST;
|
wire[9:0] XCOORD, YCOORD;
|
wire[9:0] XCOORD, YCOORD, RESET_VALUE;
|
wire[9:0] LEFT, RGHT, TOP, BOT;
|
wire[9:0] LEFT, RGHT, TOP, BOT;
|
wire SETXnY;
|
wire SETXnY;
|
wire BUTTON_RISE, BUTTON_FALL;
|
wire BUTTON_RISE, BUTTON_FALL;
|
|
|
reg[9:0] LINE_VALUE_OUT;
|
reg[9:0] LINE_VALUE_OUT;
|
Line 97... |
Line 99... |
drag <= 1'b0;
|
drag <= 1'b0;
|
else
|
else
|
drag <= drag;
|
drag <= drag;
|
end
|
end
|
|
|
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
Until this is figured out, it is bad to have the lines at 'zero'
|
|
(due to the comparison for 'in range')
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
always @ (posedge MASTER_CLK or posedge MASTER_RST) begin
|
always @ (posedge MASTER_CLK or posedge MASTER_RST) begin
|
if(MASTER_RST)
|
if(MASTER_RST)
|
LINE_VALUE_OUT <= 10'd200;
|
LINE_VALUE_OUT <= RESET_VALUE;
|
else if(drag && SETXnY)
|
else if(drag && SETXnY)
|
LINE_VALUE_OUT <= XCOORD;
|
LINE_VALUE_OUT <= XCOORD;
|
else if(drag && !SETXnY)
|
else if(drag && !SETXnY && (YCOORD<=10'd400))
|
LINE_VALUE_OUT <= YCOORD;
|
LINE_VALUE_OUT <= YCOORD;
|
else
|
else
|
LINE_VALUE_OUT <= LINE_VALUE_OUT;
|
LINE_VALUE_OUT <= LINE_VALUE_OUT;
|
end
|
end
|
|
|