From 480f4e3d456332d058062691e82388799b3f2b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Str=C3=B6mbergson?= Date: Tue, 9 May 2023 14:10:18 +0200 Subject: [PATCH] Add test6: Test that RAM ASLR and SCRAMBLE registers can be set by fw 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 | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hw/application_fpga/core/tk1/tb/tb_tk1.v b/hw/application_fpga/core/tk1/tb/tb_tk1.v index dd5519e..6e10eff 100644 --- a/hw/application_fpga/core/tk1/tb/tb_tk1.v +++ b/hw/application_fpga/core/tk1/tb/tb_tk1.v @@ -489,6 +489,42 @@ module tb_tk1(); endtask // test5 + //---------------------------------------------------------------- + // test6() + // Write and RAM scrambling in fw mode. + //---------------------------------------------------------------- + task test6; + begin + tc_ctr = tc_ctr + 1; + + $display(""); + $display("--- test6: Write RAM scrambling in fw mode."); + $display("--- test6: Reset DUT to switch to fw mode."); + reset_dut(); + + $display("--- test6: Write RAM ASLR and RAM SCRAMBLE."); + write_word(ADDR_RAM_ASLR, 32'h13371337); + write_word(ADDR_RAM_SCRAMBLE, 32'h47114711); + + $display("--- test6: Check value in dut RAM ASLR and SCRAMBLE registers."); + $display("--- test6: ram_aslr_reg: 0x%04x, ram_scramble_reg: 0x%08x", dut.ram_aslr_reg, dut.ram_scramble_reg); + + $display("--- test6: Switch to app mode."); + write_word(ADDR_SWITCH_APP, 32'hf000000); + + $display("--- test6: Write RAM ASLR and SCRAMBLE again."); + write_word(ADDR_RAM_ASLR, 32'hdeadbeef); + write_word(ADDR_RAM_SCRAMBLE, 32'hf00ff00f); + + $display("--- test6: Check value in dut RAM ASLR and SCRAMBLE registers."); + $display("--- test6: ram_aslr_reg: 0x%04x, ram_scramble_reg: 0x%08x", dut.ram_aslr_reg, dut.ram_scramble_reg); + + $display("--- test6: completed."); + $display(""); + end + endtask // test6 + + //---------------------------------------------------------------- // tk1_test //---------------------------------------------------------------- @@ -507,6 +543,7 @@ module tb_tk1(); test3(); test4(); test5(); + test6(); display_test_result(); $display("");