From 11d4dab9cdef178cd0c38697b381764a6c81a067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergiusz=20=27q3k=27=20Baza=C5=84ski?= Date: Sun, 7 Sep 2014 18:30:46 +0200 Subject: [PATCH] More tests for icache Hooray, it really does work! --- test/test_icache.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/test_icache.cpp b/test/test_icache.cpp index d6434e8..cc9e53d 100644 --- a/test/test_icache.cpp +++ b/test/test_icache.cpp @@ -4,7 +4,11 @@ #include "Vqm_icache.h" - +unsigned int _read_ram_at(unsigned int address) +{ + // for now, just return the address + return address; +} void simulate_memory_controller(Vqm_icache *ic) { @@ -56,7 +60,7 @@ void simulate_memory_controller(Vqm_icache *ic) else { printf("[mem ctrl] command word, %i left\n", current_command.left-1); - ic->mem_rd_data = 0xF0000000 + current_command.addr; + ic->mem_rd_data = _read_ram_at(current_command.addr + (4-current_command.left)*4); ic->mem_rd_empty = 0; current_command.left--; } @@ -98,8 +102,21 @@ void test_icache(void) while (1) { if (counter == 10) + { + printf("[TEST] Trying to read from 0x8bedead0...\n"); icache->enable = 1; - icache->address = 0x80bedead; + icache->address = 0x8bedead0; + } + if (counter > 11 && icache->stall == 0 && icache->address != 0x8bedead4) + { + printf("[TEST] Trying to read from 0x8bedead4 (should take one cycle...)\n"); + icache->address = 0x8bedead4; + } + if (counter > 40 && icache->stall == 0 && icache->address != 0x8bedead8) + { + printf("[TEST] Trying to read from 0x8bedead8 (should take one cycle...)\n"); + icache->address = 0x8bedead8; + } if (counter > 100) break; icache->clk = !icache->clk;