From bc7dfea9c46a8c8efb7d5ef5cebb0d1fe4c71728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Str=C3=B6mbergson?= Date: Tue, 9 May 2023 15:41:04 +0200 Subject: [PATCH] Add test9: EXE monitor control and detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Joachim Strömbergson --- hw/application_fpga/core/tk1/tb/tb_tk1.v | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/hw/application_fpga/core/tk1/tb/tb_tk1.v b/hw/application_fpga/core/tk1/tb/tb_tk1.v index 4f14803..602ddc5 100644 --- a/hw/application_fpga/core/tk1/tb/tb_tk1.v +++ b/hw/application_fpga/core/tk1/tb/tb_tk1.v @@ -575,6 +575,48 @@ module tb_tk1(); endtask // test8 + //---------------------------------------------------------------- + // test9() + // EXE monitor control and detection. + //---------------------------------------------------------------- + task test9; + begin + tc_ctr = tc_ctr + 1; + + $display(""); + $display("--- test9: EXE monitor control and detection started."); + + $display("--- test9: Define and enable a memory area."); + write_word(ADDR_CPU_MON_FIRST, 32'h10000000); + write_word(ADDR_CPU_MON_LAST, 32'h20000000); + write_word(ADDR_CPU_MON_CTRL, 32'h1); + + $display("--- test9: cpu_mon_first_reg: 0x%08x, cpu_mon_last_reg: 0x%08x", + dut.cpu_mon_first_reg, dut.cpu_mon_last_reg); + + $display("--- test9: Try to redefine memory area after enabling monitor."); + write_word(ADDR_CPU_MON_FIRST, 32'hdeadbabe); + write_word(ADDR_CPU_MON_LAST, 32'hdeadcafe); + $display("--- test9: cpu_mon_first_reg: 0x%08x, cpu_mon_last_reg: 0x%08x", + dut.cpu_mon_first_reg, dut.cpu_mon_last_reg); + + $display("--- test9: force_trap before illegal access: 0x%1x", tb_force_trap); + $display("--- test9: Creating an illegal access."); + + tb_cpu_addr = 32'h13371337; + tb_cpu_instr = 1'h1; + tb_cpu_valid = 1'h1; + #(2 * CLK_PERIOD); + $display("--- test9: cpu_addr: 0x%08x, cpu_instr: 0x%1x, cpu_valid: 0x%1x", + tb_cpu_addr, tb_cpu_instr, tb_cpu_valid); + $display("--- test9: force_trap: 0x%1x", tb_force_trap); + + $display("--- test9: completed."); + $display(""); + end + endtask // test8 + + //---------------------------------------------------------------- // tk1_test //---------------------------------------------------------------- @@ -596,6 +638,7 @@ module tb_tk1(); test6(); test7(); test8(); + test9(); display_test_result(); $display("");