From b02c2d67d6450cd1bea6942d293a6f6ea8a607f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Wed, 12 Feb 2025 17:14:30 +0100 Subject: [PATCH] PoC: fpga/tb: Allow access to syscall irq trigger area --- hw/application_fpga/core/tk1/rtl/tk1.v | 9 ++++++++- hw/application_fpga/core/tk1/tb/tb_tk1.v | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/application_fpga/core/tk1/rtl/tk1.v b/hw/application_fpga/core/tk1/rtl/tk1.v index 523e61e..624a1e0 100644 --- a/hw/application_fpga/core/tk1/rtl/tk1.v +++ b/hw/application_fpga/core/tk1/rtl/tk1.v @@ -456,7 +456,14 @@ module tk1 #( end // In unused space - if ((cpu_addr[29 : 24] > 6'h10) && (cpu_addr[29 : 24] < 6'h3f)) begin + if ((cpu_addr[29 : 24] > 6'h10) && (cpu_addr[29 : 24] < 6'h21)) begin + force_trap_set = 1'h1; + end + + // Entire IRQ31 trigger area is accessible + + // In unused space + if ((cpu_addr[29 : 24] > 6'h21) && (cpu_addr[29 : 24] < 6'h3f)) begin force_trap_set = 1'h1; end diff --git a/hw/application_fpga/core/tk1/tb/tb_tk1.v b/hw/application_fpga/core/tk1/tb/tb_tk1.v index a4588f1..4012ea4 100644 --- a/hw/application_fpga/core/tk1/tb/tb_tk1.v +++ b/hw/application_fpga/core/tk1/tb/tb_tk1.v @@ -1046,6 +1046,16 @@ module tb_tk1 (); // Unused trap range: 0xd1000000-0xfeffffff $display("--- test11: Unused"); cpu_read_check_range_should_trap(32'hd1000000, 32'hd100000f); + cpu_read_check_range_should_trap(32'he0fffff0, 32'he0ffffff); + + // IRQ31 No trap range. Entire 0xe1 range is accessible. + cpu_read_check_range_should_not_trap(32'he1000000, 32'he100000f); + cpu_read_check_range_should_not_trap(32'he1fffff0, 32'he1ffffff); + + // Unused trap range: 0xe2000000-0xfeffffff + // + $display("--- test11: Unused"); + cpu_read_check_range_should_trap(32'he2000000, 32'he200000f); cpu_read_check_range_should_trap(32'hfefffff0, 32'hfeffffff); // TK1 trap range: 0xff000400-0xffffffff