Line 1... |
Line 1... |
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: wbgpio.v
|
// Filename: wbgpio.v
|
//
|
//
|
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
|
// Project: OpenArty, an entirely open SoC based upon the Arty platform
|
//
|
//
|
// Purpose: A General Purpose Input/Output controller. This controller
|
// Purpose: A General Purpose Input/Output controller. This controller
|
// allows a user to read the current state of the 16-GPIO input
|
// allows a user to read the current state of the 16-GPIO input
|
// pins, or to set the state of the 16-GPIO output pins. Specific numbers
|
// pins, or to set the state of the 16-GPIO output pins. Specific numbers
|
// of pins are configurable from 1-16.
|
// of pins are configurable from 1-16.
|
Line 34... |
Line 34... |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// You should have received a copy of the GNU General Public License along
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
// target there if the PDF file isn't present.) If not, see
|
// target there if the PDF file isn't present.) If not, see
|
// <http://www.gnu.org/licenses/> for a copy.
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
Line 65... |
Line 65... |
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((i_wb_stb)&&(i_wb_we))
|
if ((i_wb_stb)&&(i_wb_we))
|
o_gpio <= ((o_gpio)&(~i_wb_data[(NOUT+16-1):16]))
|
o_gpio <= ((o_gpio)&(~i_wb_data[(NOUT+16-1):16]))
|
|((i_wb_data[(NOUT-1):0])&(i_wb_data[(NOUT+16-1):16]));
|
|((i_wb_data[(NOUT-1):0])&(i_wb_data[(NOUT+16-1):16]));
|
|
|
reg [(NIN-1):0] x_gpio, r_gpio;
|
reg [(NIN-1):0] x_gpio, q_gpio, r_gpio;
|
// 3 LUTs, 33 FF's
|
// 3 LUTs, 33 FF's
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
begin
|
begin
|
x_gpio <= i_gpio;
|
x_gpio <= i_gpio;
|
r_gpio <= x_gpio;
|
q_gpio <= x_gpio;
|
|
r_gpio <= q_gpio;
|
o_int <= (x_gpio != r_gpio);
|
o_int <= (x_gpio != r_gpio);
|
end
|
end
|
|
|
assign o_wb_data = { {(16-NIN){1'b0}}, r_gpio,
|
assign o_wb_data = { {(16-NIN){1'b0}}, r_gpio,
|
{(16-NOUT){1'b0}}, o_gpio };
|
{(16-NOUT){1'b0}}, o_gpio };
|