Check all edge interrupts
This commit is contained in:
@@ -42,6 +42,7 @@ $(CODE_TB): $(SRCS) $(TBS) $(INIT_MEM)
|
|||||||
$(TARGET): $(INIT_MEM) $(SRCS)
|
$(TARGET): $(INIT_MEM) $(SRCS)
|
||||||
iverilog -g2005-sv $(FLAGS) -s $(TOP_MODULE) -o $(TARGET) $(INC) $(SRCS)
|
iverilog -g2005-sv $(FLAGS) -s $(TOP_MODULE) -o $(TARGET) $(INC) $(SRCS)
|
||||||
|
|
||||||
|
.PHONY: $(INIT_MEM)
|
||||||
$(INIT_MEM):
|
$(INIT_MEM):
|
||||||
# Make kernel
|
# Make kernel
|
||||||
$(MAKE) -C $(REPO_TOP)/sw/kernel
|
$(MAKE) -C $(REPO_TOP)/sw/kernel
|
||||||
|
|||||||
@@ -22,12 +22,16 @@ end
|
|||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
u_sim_top.u_dut.int_in = 0;
|
u_sim_top.u_dut.int_in = 0;
|
||||||
repeat (1000) @(posedge u_sim_top.r_clk_cpu);
|
repeat (2400) @(posedge u_sim_top.r_clk_cpu);
|
||||||
u_sim_top.u_dut.int_in = 1;
|
for (int i = 0; i < 256; i++) begin
|
||||||
|
repeat (100) @(posedge u_sim_top.r_clk_cpu);
|
||||||
|
u_sim_top.u_dut.int_in = 1 << i;
|
||||||
|
$display("Activiating interrupt %d", i);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
repeat (2000) @(posedge u_sim_top.r_clk_cpu);
|
repeat (40000) @(posedge u_sim_top.r_clk_cpu);
|
||||||
$display("Timed out");
|
$display("Timed out");
|
||||||
$finish_and_return(-1);
|
$finish_and_return(-1);
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,23 +1,70 @@
|
|||||||
|
.MACPACK generic
|
||||||
|
|
||||||
.export _init, _nmi_int, _irq_int
|
.export _init, _nmi_int, _irq_int
|
||||||
|
|
||||||
|
.import tmp1
|
||||||
|
|
||||||
CMD = $effc
|
CMD = $effc
|
||||||
DAT = $effd
|
DAT = $effd
|
||||||
|
|
||||||
|
.zeropage
|
||||||
|
finish: .res 1
|
||||||
|
curr_irq: .res 1
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
_nmi_int:
|
_nmi_int:
|
||||||
_irq_int:
|
_irq_int:
|
||||||
|
; We should have triggered interrupt 1
|
||||||
|
stz CMD
|
||||||
|
lda DAT
|
||||||
|
cmp curr_irq
|
||||||
|
bne @bad
|
||||||
|
|
||||||
|
lda #$ff
|
||||||
|
sta CMD
|
||||||
|
lda #$1
|
||||||
|
sta DAT
|
||||||
|
|
||||||
|
inc curr_irq
|
||||||
|
beq @good
|
||||||
|
cli
|
||||||
|
rti
|
||||||
|
|
||||||
|
@good:
|
||||||
lda #$6d
|
lda #$6d
|
||||||
sta $00
|
sta finish
|
||||||
|
|
||||||
|
@bad:
|
||||||
|
lda #$bd
|
||||||
|
sta finish
|
||||||
|
|
||||||
_init:
|
_init:
|
||||||
lda #$20
|
ldx #$ff
|
||||||
sta CMD
|
txs
|
||||||
lda #$ff
|
ldx #$20 ; enable
|
||||||
sta DAT
|
ldy #$ff
|
||||||
lda #$40
|
jsr cmd_all
|
||||||
sta CMD
|
ldx #$40 ; edge type
|
||||||
lda #$ff
|
ldy #$00
|
||||||
sta DAT
|
jsr cmd_all
|
||||||
|
stz curr_irq
|
||||||
cli
|
cli
|
||||||
@end: bra @end
|
jmp wait
|
||||||
|
|
||||||
|
cmd_all:
|
||||||
|
txa
|
||||||
|
add #$20
|
||||||
|
sta tmp1
|
||||||
|
loop:
|
||||||
|
txa
|
||||||
|
sta CMD
|
||||||
|
tya
|
||||||
|
sta DAT
|
||||||
|
inx
|
||||||
|
cpx tmp1
|
||||||
|
blt loop
|
||||||
|
rts
|
||||||
|
|
||||||
|
wait:
|
||||||
|
bra wait
|
||||||
Reference in New Issue
Block a user