From: Joshua Wise Date: Fri, 9 May 2008 12:07:34 +0000 (-0400) Subject: PS2 cut 1 X-Git-Url: http://git.joshuawise.com/fpgaboy.git/commitdiff_plain/bc75fc673a7453cb5b9077d70695d3525d13366d PS2 cut 1 --- diff --git a/CoreTop.prj b/CoreTop.prj index 0df5890..4f1c839 100644 --- a/CoreTop.prj +++ b/CoreTop.prj @@ -12,3 +12,4 @@ verilog work "Sound1.v" verilog work "Sound2.v" verilog work "Soundcore.v" verilog work "Buttons.v" +verilog work "PS2Button.v" diff --git a/CoreTop.ucf b/CoreTop.ucf index 1981fcd..d065b22 100644 --- a/CoreTop.ucf +++ b/CoreTop.ucf @@ -103,3 +103,5 @@ NET "cr_A<20>" LOC="K3" | SLEW="fast"; NET "cr_A<21>" LOC="D1" | SLEW="fast"; NET "cr_A<22>" LOC="K6" | SLEW="fast"; +NET "PS2C" LOC="R12"; +NET "PS2D" LOC="P11"; \ No newline at end of file diff --git a/Makefile b/Makefile index f42e5b9..15107c3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ VLOGS = 7seg.v Framebuffer.v GBZ80Core.v Interrupt.v LCDC.v Sound1.v \ - Sound2.v Soundcore.v System.v Timer.v Uart.v Buttons.v + Sound2.v Soundcore.v System.v Timer.v Uart.v Buttons.v PS2Button.v VLOGS_ALL = $(VLOGS) insn_call-callcc.v insn_incdec16.v insn_jr-jrcc.v \ insn_ld_reg_hl.v insn_ld_reg_reg.v insn_nop.v insn_ret-retcc.v \ diff --git a/PS2Button.v b/PS2Button.v index e65226c..571af43 100644 --- a/PS2Button.v +++ b/PS2Button.v @@ -1,19 +1,13 @@ module PS2Button( input inclk, input indata, - input rst, - output outclk, - output outdata, - output reg [7:0] buttons + output wire [7:0] buttons ); - assign outdata = 1'b1; - assign outclk = 1'b1; - - reg bitcount [3:0] = 0; - reg [7:0] key; - reg keyarrow, keyup, parity; - reg key_a,key_b,key_st,key_sel,key_up,key_dn,key_l,key_r; + reg [3:0] bitcount = 0; + reg [7:0] key = 0; + reg keyarrow = 0, keyup = 0, parity = 0; + reg key_a = 0,key_b = 0,key_st = 0,key_sel = 0,key_up = 0,key_dn = 0,key_l = 0,key_r = 0; assign buttons = {key_st,key_sel,key_b,key_a,key_dn,key_up,key_l,key_r}; diff --git a/System.v b/System.v index 931e900..68de591 100644 --- a/System.v +++ b/System.v @@ -232,6 +232,7 @@ module CoreTop( output wire cr_nADV, cr_nCE, cr_nOE, cr_nWE, cr_CRE, cr_nLB, cr_nUB, cr_CLK, output wire [22:0] cr_A, inout [15:0] cr_DQ, + input ps2c, ps2d, `endif output wire hs, vs, output wire [2:0] r, g, @@ -256,6 +257,7 @@ module CoreTop( IBUFG iclkbuf(.O(xtalb), .I(xtal)); CPUDCM dcm (.CLKIN_IN(xtalb), .CLKFX_OUT(clk)); pixDCM pixdcm (.CLKIN_IN(xtalb), .CLKFX_OUT(vgaclk)); + wire [7:0] ps2buttons; `endif wire [15:0] addr [1:0]; @@ -348,16 +350,31 @@ module CoreTop( .vgag(g), .vgab(b)); + wire [7:0] sleds; +`ifdef isim + assign leds = sleds; +`else + assign leds = sleds | ps2buttons; +`endif Switches sw( .clk(clk), .address(addr[0]), .data(data[0]), .wr(wr[0]), .rd(rd[0]), - .ledout(leds), + .ledout(sleds), .switches(switches) ); +`ifdef isim +`else + PS2Button ps2( + .inclk(ps2c), + .indata(ps2d), + .buttons(ps2buttons) + ); +`endif + Buttons ass( .core_clk(clk), .addr(addr[0]), @@ -365,7 +382,11 @@ module CoreTop( .wr(wr[0]), .rd(rd[0]), .int(btnirq), + `ifdef isim .buttons(switches) + `else + .buttons(ps2buttons) + `endif ); AddrMon amon(