verilog work "Sound2.v"
verilog work "Soundcore.v"
verilog work "Buttons.v"
+verilog work "PS2Button.v"
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
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 \
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};
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,
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];
.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]),
.wr(wr[0]),
.rd(rd[0]),
.int(btnirq),
+ `ifdef isim
.buttons(switches)
+ `else
+ .buttons(ps2buttons)
+ `endif
);
AddrMon amon(