diff --git a/doc/uart.md b/doc/uart.md index b349eb4..6a6d191 100644 --- a/doc/uart.md +++ b/doc/uart.md @@ -37,7 +37,7 @@ It uses a fixed serial configuration of 115200 bps, 8 data bits, 1 stop bit, no ## Notes -A 16 byte FIFO is used when receiving data. +A 64 byte FIFO is used when receiving data. When reading data, each byte needs to be acknowledged by writing the _C_ flag to the UART register. diff --git a/tridoracpu/tridoracpu.srcs/irqctrl.v b/tridoracpu/tridoracpu.srcs/irqctrl.v index b71df60..5608440 100644 --- a/tridoracpu/tridoracpu.srcs/irqctrl.v +++ b/tridoracpu/tridoracpu.srcs/irqctrl.v @@ -1,6 +1,6 @@ `timescale 1ns / 1ps -module irqctrl #(IRQ_LINES = 3, IRQ_DELAY_WIDTH = 4) ( +module irqctrl #(IRQ_LINES = 3, IRQ_DELAY_WIDTH = 8) ( input wire clk, input wire [IRQ_LINES-1:0] irq_in, input wire cs, diff --git a/tridoracpu/tridoracpu.srcs/stackcpu.v b/tridoracpu/tridoracpu.srcs/stackcpu.v index 1d929f7..b8ef78c 100644 --- a/tridoracpu/tridoracpu.srcs/stackcpu.v +++ b/tridoracpu/tridoracpu.srcs/stackcpu.v @@ -399,7 +399,10 @@ module stackcpu #(parameter ADDR_WIDTH = 32, WIDTH = 32, // process irq always @(posedge clk) begin - if(seq_state == MEM && irq_pending && !(ins_xfer & xfer_r2p)) // in FETCH state, clear irq_pending. + // in MEM state, clear irq_pending, when nPC has been set to IV + // RET instruction is a special case because we need to use + // the new PC that is in mem_data + if(seq_state == MEM && irq_pending && !(ins_xfer && xfer_r2p)) irq_pending <= 0; else irq_pending <= irq_pending || irq; // else set irq_pending when irq is high diff --git a/tridoracpu/tridoracpu.srcs/tdraudio.v b/tridoracpu/tridoracpu.srcs/tdraudio.v index 1629e31..4ad978d 100644 --- a/tridoracpu/tridoracpu.srcs/tdraudio.v +++ b/tridoracpu/tridoracpu.srcs/tdraudio.v @@ -233,7 +233,7 @@ module tdraudio #(DATA_WIDTH=32) ( chan2_rd_data, amp_wr_data, chan2_rd_en, chan2_wr_en, chan2_amp, - chan2_irq, chan2_running); + chan2_running, chan2_irq); wavegen chan3(clk, reset, reg_sel, chan3_rd_data, amp_wr_data, diff --git a/tridoracpu/tridoracpu.srcs/top.v b/tridoracpu/tridoracpu.srcs/top.v index a4533d2..0dc3346 100644 --- a/tridoracpu/tridoracpu.srcs/top.v +++ b/tridoracpu/tridoracpu.srcs/top.v @@ -278,6 +278,9 @@ module top( (io_slot == 4) ? tdraudio_rd_data: `endif -1; + irqctrl irqctrl0(`clock, irq_in, irqc_cs, mem_write_enable, + irqc_seten, irqc_rd_data0, + irq); // CPU ----------------------------------------------------------------- stackcpu cpu0(.clk(`clock), .rst(rst), .irq(irq), @@ -288,10 +291,6 @@ module top( .mem_wait(mem_wait), .debug1(led1), .debug2(led2), .debug3(led3)); - // Interrupt Controller - irqctrl irqctrl0(`clock, irq_in, irqc_cs, mem_write_enable, - irqc_seten, irqc_rd_data0, - irq); // count clock ticks // generate interrupt every 20nth of a second diff --git a/tridoracpu/tridoracpu.xpr b/tridoracpu/tridoracpu.xpr index a9dc20f..a3dd3f6 100644 --- a/tridoracpu/tridoracpu.xpr +++ b/tridoracpu/tridoracpu.xpr @@ -358,9 +358,7 @@ - - Vivado Synthesis Defaults - + @@ -380,9 +378,7 @@ - - Default settings for Implementation. - + @@ -391,9 +387,7 @@ - - - +