+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Newbie level 2
    Points: 20, Level: 1

    Join Date
    May 2019
    Posts
    2
    Helped
    0 / 0
    Points
    20
    Level
    1

    How to map 2 inputs to an input between 2 components?

    Not even sure if my title describes it correctly.

    I'm trying to instantiate 2 components together, in this case a register file and an ALU

    In the instantiation entity, i have

    Code:
     PORT(
          ....
          inputdatapath: IN STD_LOGIC_VECTOR(7 DOWNTO 0);
          ....
          )
    in the RF component i have an 8 bit input and in the ALU component i have an 8 bit output

    I wanted to wire the ALU output into the 8 bit input of the RF with a signal, while also having the RF input be mapped to the inputdatapath. Basically 2 inputs into the RF input.

    I seem to keep getting positional association errors because i'm doing it wrong.

    Click image for larger version. 

Name:	datapath.png 
Views:	8 
Size:	13.9 KB 
ID:	153129

    Not sure what i should do to map something like this.

    Thanks

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 30,484, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,012
    Helped
    1676 / 1676
    Points
    30,484
    Level
    42

    Re: How to map 2 inputs to an input between 2 components?

    Your drawing is shorting two drivers the inputdatapath "driver" and the output of the ALU. Having multiple drivers on a signal or into a component is not allowed. You need to use a multiplexer or show us the entire code so we can determine what you are trying to do.



    •   AltAdvertisment

        
       

  3. #3
    Full Member level 6
    Points: 2,170, Level: 10

    Join Date
    Aug 2016
    Posts
    369
    Helped
    55 / 55
    Points
    2,170
    Level
    10

    Re: How to map 2 inputs to an input between 2 components?

    Hi,

    You need to have a signal that selects which data you want to transfer to the RF at any point in time. A single bit signal will do such that when that signal is '1' you select one of the data (ie either inputdatapath or ALU output) and when it is '0' you select the other.

    It's easy to implement it with an IF/ELSE statement.
    -------------
    --Akanimo.



    •   AltAdvertisment

        
       

  4. #4
    Newbie level 2
    Points: 20, Level: 1

    Join Date
    May 2019
    Posts
    2
    Helped
    0 / 0
    Points
    20
    Level
    1

    Re: How to map 2 inputs to an input between 2 components?

    using a mux makes sense, the RF has extra selectors and enables to determine where the input goes so i thought omitting a mux was possible if they were simply connected together and giving it signals to enable a particular register would be enough.

    thanks



  5. #5
    Full Member level 6
    Points: 2,170, Level: 10

    Join Date
    Aug 2016
    Posts
    369
    Helped
    55 / 55
    Points
    2,170
    Level
    10

    Re: How to map 2 inputs to an input between 2 components?

    Quote Originally Posted by potatovdhl View Post
    using a mux makes sense, the RF has extra selectors and enables to determine where the input goes...
    Of course. And for instance in VHDL, Post #3 would implement a mux.
    -------------
    --Akanimo.



--[[ ]]--