From 4644c79cbd3eb050d4fe7d56093b0536fa3c93e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Str=C3=B6mbergson?= Date: Tue, 9 May 2023 15:18:21 +0200 Subject: [PATCH] Adding test 8: GPIO test 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 | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/hw/application_fpga/core/tk1/tb/tb_tk1.v b/hw/application_fpga/core/tk1/tb/tb_tk1.v index ef7499a..4f14803 100644 --- a/hw/application_fpga/core/tk1/tb/tb_tk1.v +++ b/hw/application_fpga/core/tk1/tb/tb_tk1.v @@ -547,6 +547,34 @@ module tb_tk1(); endtask // test7 + //---------------------------------------------------------------- + // test8() + // GPIO control. + //---------------------------------------------------------------- + task test8; + begin + tc_ctr = tc_ctr + 1; + + $display(""); + $display("--- test8: GPIO control started."); + + $display("--- test8: Set Inputs for GPIO 1 and 2 high."); + tb_gpio1 = 1'h1; + tb_gpio2 = 1'h1; + #(2 * CLK_PERIOD); + $display("--- test8: Check that we can read GPIO 1 and 2 as high."); + read_word(ADDR_GPIO, 32'h3); + + $display("--- test8: Set GPIO 3 and 4 high by writing to the registers."); + write_word(ADDR_GPIO, 32'hf); + $display("--- test8: gpio3: 0x%1x, gpio4: 0x%1x", tb_gpio3, tb_gpio4); + + $display("--- test8: completed."); + $display(""); + end + endtask // test8 + + //---------------------------------------------------------------- // tk1_test //---------------------------------------------------------------- @@ -567,6 +595,7 @@ module tb_tk1(); test5(); test6(); test7(); + test8(); display_test_result(); $display("");