From e913e2e3ba85c38363083e4700cf85b3f8035c18 Mon Sep 17 00:00:00 2001
From: Roberto Hexsel <roberto@inf.ufpr.br>
Date: Wed, 14 Oct 2015 17:23:12 -0300
Subject: [PATCH] fixed signal loop in not_waiting

---
 cMIPS/vhdl/tb_cMIPS.vhd | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/cMIPS/vhdl/tb_cMIPS.vhd b/cMIPS/vhdl/tb_cMIPS.vhd
index c86a12c..3f4f552 100644
--- a/cMIPS/vhdl/tb_cMIPS.vhd
+++ b/cMIPS/vhdl/tb_cMIPS.vhd
@@ -511,7 +511,7 @@ begin  -- TB
   cpu_d_wait <= data_wait and io_wait;
   io_wait    <= io_lcd_wait and io_fpu_wait;
 
-  not_waiting <= (inst_wait and data_wait and io_wait);
+  not_waiting <= (inst_wait and data_wait); --  and io_wait);
 
   -- irq <= b"000000"; -- NO interrupt requests
   irq <= uart_irq & counter_irq & b"0000"; -- uart+counter interrupts
@@ -905,23 +905,22 @@ architecture behavioral of io_addr_decode is
   constant x_hi   : std_logic_vector(31 downto HI_DEV)  := (others=>'1');
   constant x_lo   : std_logic_vector(HI_DEV-1 downto 0) := (others=>'0');
   constant x_mask : std_logic_vector := x_hi & x_lo;  -- 1..10..0
-  
+
+  signal in_range : boolean;
   signal aVal : std_logic;
   signal dev  : integer;                    -- DEBUGGING only
 begin
 
---   aVal <= '0' when ( cpu_d_aVal = '0' and rst = '1' and not_waiting = '1' and
---                      ((addr and x_mask) = x_IO_BASE_ADDR) ) else
---           '1';
+  -- in_range <= ((addr and x_mask) = x_IO_BASE_ADDR);
+  
+  in_range <= ((addr(HI_ADDR downto LO_ADDR) and in_r) /= ng_r) and
+              ((addr(HI_SEL_BITS downto HI_ADDR+1) and oth) = ng_o);
 
   dev <= to_integer(signed(addr(HI_SEL_ADDR downto LO_SEL_ADDR)));
-   
+  
   aVal <= '0' when ( cpu_d_aVal = '0' and rst = '1' and not_waiting = '1' and
-                     ((addr(HI_ADDR downto LO_ADDR) and in_r) /= ng_r) and
-                     ((addr(HI_SEL_BITS downto HI_ADDR+1) and oth) = ng_o)
-                   ) else
-          '1';
-
+                     in_range ) else '1';
+  
   U_decode: process(clk, aVal, addr, dev)
     variable dev_sel    : reg4;
     constant is_noise   : integer := 0;
-- 
GitLab