EmbDev.net

Forum: FPGA, VHDL & Verilog Port Map Errors


Author: Jay JA (jboss10)
Posted on:

Rate this post
0 useful
not useful
I have quite a large project involving a Traffic Light system. I'm at 
the point of port mapping all of my blocks together within the top 
entity as I will post..

library IEEE; 
use ieee.std_LOGIC_1164.all; 


entity Final_TLSystem is 

port
   (V_Sensor          :  in  std_logic;
    mclk         :  in  std_logic; 
    mst_reset       :  in  std_logic; 
    Traffic_Lights   :  out std_logic_vector ( 5 downto 0)
    
    ); 
    
end Final_TLSystem; 
  
  architecture Final_TLSystem_arch of Final_TLSystem is 
  signal internal     : std_logic_vector (1 downto 0);
  signal tempTrig : std_logic_vector (1 downto 0);
  signal tempclk   : std_logic; 
  signal tempTime : std_logic_vector (1 downto 0);
  
  
 
  
  component SeqLogic is
  port     (clk_in  : in  std_logic;
         reset   : in  std_logic; 
         TS      : in  STD_logic;
         TL      : in  std_logic; 
         V       : in  std_logic; 
         S        : out std_logic_vector (1 downto 0)
         
         );
         
  end component; 
  
component TLightSystem is 

  port  (State_In : in  std_logic_vector  (1 downto 0);   
        Lights   : out std_logic_vector (5 downto 0);
       TS_TL   : out std_logic_vector (1 downto 0)
       );
      
           

end component;

--component FreqDivider is
  --  port(
    --     clk_24MHz : in STD_LOGIC;
     --    clk_24KHz : out STD_LOGIC
     --    );
--end component;

component pulse_counter is

port     ( clk_24Khz     : in  std_logic; 
        trigger_long  : in  std_logic; 
        trigger_short : in  std_logic; 
        TS         : out std_logic; 
        TL         : out std_logic 
       );
      
end component; 

begin 

  U1 : SeqLogic      port map (V=> V_sensor, internal(0)=>S(0), internal(1)=>S(1),tempTrig(0) => TS, tempTrig(1)=>TL, tempclk=>clk_in, reset=> mst_reset); 
  U2 : TLightSystem  port map (Lights=>Traffic_Lights, tempTrig(0)=> TS_TL(0), tempTrig1=> TS_TL(1), tempS0=> State_In(0), tempS1 => State_In(1)); 
  U3 : pulse_counter port map (tempclk=>clk_24KHz, tempTime(0)=> TS, tempTime(1)=>TL, tempTrig(0)=> trigger_long, tempTrig(1)=>trigger_short, clk_24KHz=>mclk);  


end Final_TLSystem_arch; 


Errors I'm receiving:
"type of formal parameter "internal" does not match type or value"
"object "S" is used but not declared"
"cannot associate formal port "internal" of mode "object" with an 
expression"

..same errors trickle down with tempTrig, clk_in, TS, TL, tempClk, and 
reset. I'm clearly not connected this right.

Thanks for any input. Let me know if any other information is needed.

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Ouch! There are multiple basic bugs in this description.

First:
A port map is "port_signal => external_signal" from the view of the 
component.
Your tempclk is the external signal:
> signal tempclk   : std_logic;
and your clk_24khz is the port signal:
> component pulse_counter is
> port ( clk_24Khz  : in  std_logic;
So this assignment here (and as far as I see most of the others also) is 
the wrong direction:
> U3 : pulse_counter port map (tempclk=>clk_24KHz, ...

Second:
> U1 : SeqLogic      port map (V=> V_sensor,
You MUST(!!) pass eyery asynchronous external signal through at least 
one better are two synchronisation flipflops before you use it inside 
your design. See this here:
http://www.lothar-miller.de/s9y/archives/64-State-...


Third:
> mclk, tempclk, clk_24khz ...
Far way much too much clocks in this beginners design!!
A beginners design must have exactly 1 clock. All the rest is done by 
clock enables. See there the very last code snippet:
http://www.lothar-miller.de/s9y/archives/80-Hello-...
The whole design has only clk as clock. 't' is the clock enable.

Author: asd (Guest)
Posted on:

Rate this post
0 useful
not useful
  U1 : SeqLogic      port map (V=> V_sensor, internal(0)=>S(0), internal(1)=>S(1),tempTrig(0) => TS, tempTrig(1)=>TL, tempclk=>clk_in, reset=> mst_reset); 
  U2 : TLightSystem  port map (Lights=>Traffic_Lights, tempTrig(0)=> TS_TL(0), tempTrig1=> TS_TL(1), tempS0=> State_In(0), tempS1 => State_In(1)); 
  U3 : pulse_counter port map (tempclk=>clk_24KHz, tempTime(0)=> TS, tempTime(1)=>TL, tempTrig(0)=> trigger_long, tempTrig(1)=>trigger_short, clk_24KHz=>mclk);

wrong order of port map assignments. Should be S(0)=>internal(0) for 
example...
Would also be much more readable with some line feeds:
U1 : SeqLogic
  port map (
   V      => V_sensor,
   S      => internal,
   TS     => tempTrig(0),
   TL     => tempTrig(1),
   clk_in => tempclk,
   reset  => mst_reset);
something in that style...

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.