//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// GPIO Monitor ////
|
//// GPIO Monitor ////
|
//// ////
|
//// ////
|
//// This file is part of the GPIO project ////
|
//// This file is part of the GPIO project ////
|
//// http://www.opencores.org/cores/gpio/ ////
|
//// http://www.opencores.org/cores/gpio/ ////
|
//// ////
|
//// ////
|
//// Description ////
|
//// Description ////
|
//// Generates and monitors GPIO external signals (+auxiliary) ////
|
//// Generates and monitors GPIO external signals (+auxiliary) ////
|
//// ////
|
//// ////
|
//// To Do: ////
|
//// To Do: ////
|
//// Nothing ////
|
//// Nothing ////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// - Damjan Lampret, lampret@opencores.org ////
|
//// - Damjan Lampret, lampret@opencores.org ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// 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 ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
// Revision 1.2 2001/07/14 20:37:20 lampret
|
// Revision 1.2 2001/07/14 20:37:20 lampret
|
// Test bench improvements.
|
// Test bench improvements.
|
//
|
//
|
// Revision 1.1 2001/06/05 07:45:22 lampret
|
// Revision 1.1 2001/06/05 07:45:22 lampret
|
// Added initial RTL and test benches. There are still some issues with these files.
|
// Added initial RTL and test benches. There are still some issues with these files.
|
//
|
//
|
//
|
//
|
|
|
`include "timescale.v"
|
`include "timescale.v"
|
|
|
module gpio_mon(gpio_aux, gpio_in, gpio_eclk, gpio_out, gpio_oen);
|
module gpio_mon(gpio_aux, gpio_in, gpio_eclk, gpio_out, gpio_oen);
|
|
|
parameter gw = 32;
|
parameter gw = 32;
|
|
|
//
|
//
|
// I/O ports
|
// I/O ports
|
//
|
//
|
output [gw-1:0] gpio_aux; // Auxiliary
|
output [gw-1:0] gpio_aux; // Auxiliary
|
output [gw-1:0] gpio_in; // GPIO inputs
|
output [gw-1:0] gpio_in; // GPIO inputs
|
output gpio_eclk; // GPIO external clock
|
output gpio_eclk; // GPIO external clock
|
input [gw-1:0] gpio_out; // GPIO outputs
|
input [gw-1:0] gpio_out; // GPIO outputs
|
input [gw-1:0] gpio_oen; // GPIO output enables
|
input [gw-1:0] gpio_oen; // GPIO output enables
|
|
|
//
|
//
|
// Internal regs
|
// Internal regs
|
//
|
//
|
reg [gw-1:0] gpio_aux;
|
reg [gw-1:0] gpio_aux;
|
reg [gw-1:0] gpio_in;
|
reg [gw-1:0] gpio_in;
|
reg gpio_eclk;
|
reg gpio_eclk;
|
|
|
initial gpio_eclk = 0;
|
initial gpio_eclk = 0;
|
|
|
//
|
//
|
// Set gpio_in
|
// Set gpio_in
|
//
|
//
|
task set_gpioin;
|
task set_gpioin;
|
input [31:0] val;
|
input [31:0] val;
|
begin
|
begin
|
gpio_in = val;
|
gpio_in = val;
|
end
|
end
|
endtask
|
endtask
|
|
|
//
|
//
|
// Set gpio_aux
|
// Set gpio_aux
|
//
|
//
|
task set_gpioaux;
|
task set_gpioaux;
|
input [31:0] val;
|
input [31:0] val;
|
begin
|
begin
|
gpio_aux = val;
|
gpio_aux = val;
|
end
|
end
|
endtask
|
endtask
|
|
|
//
|
//
|
// Set gpio_eclk
|
// Set gpio_eclk
|
//
|
//
|
task set_gpioeclk;
|
task set_gpioeclk;
|
input [31:0] val;
|
input [31:0] val;
|
begin
|
begin
|
gpio_eclk = val[0];
|
gpio_eclk = val[0];
|
end
|
end
|
endtask
|
endtask
|
|
|
|
|
//
|
//
|
// Get gpio_out
|
// Get gpio_out
|
//
|
//
|
task get_gpioout;
|
task get_gpioout;
|
output [31:0] val;
|
output [31:0] val;
|
reg [31:0] val;
|
reg [31:0] val;
|
begin
|
begin
|
val = gpio_out;
|
val = gpio_out;
|
end
|
end
|
endtask
|
endtask
|
|
|
//
|
//
|
// Get gpio_oen
|
// Get gpio_oen
|
//
|
//
|
task get_gpiooen;
|
task get_gpiooen;
|
output [31:0] val;
|
output [31:0] val;
|
begin
|
begin
|
val = gpio_oen;
|
val = gpio_oen;
|
end
|
end
|
endtask
|
endtask
|
|
|
endmodule
|
endmodule
|
|
|