summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-11-14 21:24:06 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2010-11-14 21:24:06 (GMT)
commitce0956acab5799e45a8001b50f45364f06e744dc (patch)
treed6f2f6f18eb6b261cccd43b7440b34fa5ac207c6
parentd572233d9d5bab27df907ebcd16e1b6113f85236 (diff)
downloadabc8000-old-ce0956acab5799e45a8001b50f45364f06e744dc.zip
abc8000-old-ce0956acab5799e45a8001b50f45364f06e744dc.tar.gz
abc8000-old-ce0956acab5799e45a8001b50f45364f06e744dc.tar.bz2
abc8000-old-ce0956acab5799e45a8001b50f45364f06e744dc.tar.xz
Hook up an interrupt for the keyboard
Hook up the keyboard to interrupt line 0 (lowest priority.)
-rw-r--r--de1/de1.v4
-rw-r--r--ps2.v14
2 files changed, 16 insertions, 2 deletions
diff --git a/de1/de1.v b/de1/de1.v
index 69b81ac..41f95a1 100644
--- a/de1/de1.v
+++ b/de1/de1.v
@@ -604,6 +604,7 @@ module abc8000_de1 (
// ------------------------------------------------------------------------
wire [15:0] kbd_cpu_di;
+ wire kbd_irq_n;
ps2 kbd
(
@@ -615,7 +616,8 @@ module abc8000_de1 (
.cpu_a ( cpu_a[1] ),
.cpu_do ( cpu_do[15:8] ),
.cpu_di ( kbd_cpu_di[15:8] ),
- .cpu_r_wn ( cpu_r_wn )
+ .cpu_r_wn ( cpu_r_wn ),
+ .irq_n ( mfp_gpip_in[0] )
);
assign kbd_cpu_di[7:0] = 8'hff; // Byte-sized device only
diff --git a/ps2.v b/ps2.v
index 343d3dd..2d70b9a 100644
--- a/ps2.v
+++ b/ps2.v
@@ -39,7 +39,9 @@ module ps2 (
input cpu_a, // Address bit
input [7:0] cpu_do, // CPU data out (cpu->card)
output [7:0] cpu_di, // CPU data in (card->cpu)
- input cpu_r_wn // R/W#
+ input cpu_r_wn, // R/W#
+
+ output irq_n // Has data (IRQ generation)
);
// Debounced inputs
@@ -219,6 +221,16 @@ module ps2 (
wire [7:0] status = { 6'b0, tx_busy, ~rx_empty };
assign cpu_di = cpu_rd ? (cpu_a ? status : rx_cpu_data) : 8'hFF;
+ // IRQ output
+ reg irq_q;
+ always @(negedge rst_n or posedge clk)
+ if (~rst_n)
+ irq_q <= 1'b0;
+ else
+ irq_q <= ~rx_empty;
+
+ assign irq_n = ~irq_q;
+
//
// Receive FIFO
//