Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

Combinational Loop In VHDL synthesis

Dear all

I've been working on a project in which I build an interconnection network with similar modules. Each module has 4 inout dataports. Also they have two control ports, one for R/W (Read or Write) and one for switching (like a crossbar switch). To build up the network I need to connect these modules together via their inout data ports. I want to be able to transfer data bidirectionally. I have included my code at the end. This code just has two modules connected to each other.

- After synthesis in Quartus, ISE, or Synopsys Design Compiler or Synplify Pro, I get warnings which says there are a lot of nodes with combinational loop. But Why? Have I done anything wrong?

- The .vho netlist I get from Quartus, has inout ports with std_logic_vector type while my original design signed inout ports. Is this resulting from the combinational loops the synthesizer detects?

I would be grateful if anyone can help me with this.

The Module

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    entity Inter_Con_Mod is
        generic(WL: integer:= 8);
        port(PortL0,PortL1,PortR0,PortR1: inout signed(WL-1 downto 0);
              RW: in std_logic;
                SW: in std_logic);
               
    end Inter_Con_Mod;
    
    architecture Behav of Inter_Con_Mod is
    
    begin
     
     PortR0 <= PortL0 when (SW = '0' and RW = '0') else
                  PortL1 when (SW = '1' and RW = '0') else
                (others => 'Z');
     PortR1 <= PortL1 when (SW = '0' and RW = '0') else
                  PortL0 when (SW = '1' and RW = '0') else
                (others => 'Z');
    
     PortL0 <= PortR0 when (SW = '0' and RW = '1') else
                  PortR1 when (SW = '1' and RW = '1') else
                (others => 'Z');
     PortL1 <= PortR1 when (SW = '0' and RW = '1') else
                  PortR0 when (SW = '1' and RW = '1') else
                (others => 'Z');
    

The Interconnection Example (Top Module)

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Datapath is
    generic(WL: integer:=8);
    port(DL0,DL1: inout signed(WL-1 downto 0);
          DR0,DR1: inout signed(WL-1 downto 0);
          C0,C1: in std_logic;
          RW: in std_logic);
          
end Datapath;
architecture Behavioral of Datapath is
       component Inter_Con_Mod is
            generic(WL: integer);
            port(PortL0,PortL1,PortR0,PortR1: inout signed(WL-1 downto 0);
                    RW: in std_logic;
                    SW: in std_logic);
         end component;
         signal M0_L0,M0_L1,M0_R0,M0_R1: signed(WL-1 downto 0);
         signal M1_L0,M1_L1,M1_R0,M1_R1: signed(WL-1 downto 0);
         
begin
     
     M0: Inter_Con_Mod 
            generic map(WL => WL)
            port map (M0_L0,M0_L1,M0_R0,M0_R1,RW,C0);
     M1: Inter_Con_Mod 
            generic map(WL => WL)
            port map (M1_L0,M1_L1,M1_R0,M1_R1,RW,C1);
    
     DL0 <= M0_L0 when RW = '1' else
              (others => 'Z');
     DL1 <= M0_L1 when RW = '1' else
              (others => 'Z');
    
     M0_L0 <= DL0 when RW = '0' else
                 (others => 'Z');
     M0_L1 <= DL1 when RW = '0' else
                 (others => 'Z');
     M1_L0 <= M0_R0 when RW = '0' else
                 (others => 'Z');
     M1_L1 <= M0_R1 when RW = '0' else
                 (others => 'Z');
                  
                 
     M0_R0 <= M1_L0 when RW = '1' else
                 (others => 'Z');
     M0_R1 <= M1_L1 when RW = '1' else
                 (others => 'Z');
     M1_R0 <= DR0 when RW = '1' else
                 (others => 'Z');
     M1_R1 <= DR1 when RW = '1' else
                 (others => 'Z');
     
     DR0 <= M1_R0 when RW = '0' else
                 (others => 'Z');
    DR1 <= M1_R1 when RW = '0' else
                 (others => 'Z');                 
                               
                              
end Behavioral;

15 Replies