+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2019
    Posts
    66
    Helped
    0 / 0
    Points
    322
    Level
    3

    Shifting control from one module to another iteratively

    I have two separate modules that iterate over a range. One generator module will produce input for DUT and this data goes to another module that works on this data iteratively. I tried to code this but somehow I do not know how to transfer the control from one block to another step by step. Can anyone help?

  2. #2
    Super Moderator
    Points: 80,296, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,288
    Helped
    3694 / 3694
    Points
    80,296
    Level
    69

    Re: Shifting control from one module to another iteratively

    Hi,

    Could you be more specific?
    You just give very vague inoirmations.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  3. #3
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2019
    Posts
    66
    Helped
    0 / 0
    Points
    322
    Level
    3

    Re: Shifting control from one module to another iteratively

    Quote Originally Posted by KlausST View Post
    Hi,

    Could you be more specific?
    You just give very vague inoirmations.

    Klaus
    Hi,

    I wish to have an input generator module that will generate data iteratively. Every time it generates a data, I want another module to perform a function on this data and send it to the DUT. Then again , I want my generator to send out a different data to the second module which will carry out the same process again.



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 53,534, Level: 56

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    13,063
    Helped
    2604 / 2604
    Points
    53,534
    Level
    56

    Re: Shifting control from one module to another iteratively

    Your description brings to mind a chess clock. It contains two stopwatches. One player's watch runs while he considers what move to make. When he decides, he makes his move, then hits a push-switch which stops his watch and at the same time tells the other player's watch to start.

    What action takes place, that decides it's time for your two modules to switch tasks?

    Electronically the action is a SR flip-flop. When the action occurs, have that module send a pulse to its side of the flip-flop. The flip-flop changes state and remains that way, until the other module sends a pulse to its side of the flip-flop.

    Or, in software create a global variable X which can have either the value 1 (for module #1), or 2 (for module #2). As your program executes, designate the sending module as X. Designate the receiving module as 3-X. Whenever X changes, the value of 3-X automatically (everywhere it occurs in the program) designates the other module. It works in IF-THEN statements and in arrays.



    •   AltAdvertisement

        
       

  5. #5
    Full Member level 5
    Points: 2,369, Level: 11

    Join Date
    May 2014
    Posts
    279
    Helped
    28 / 28
    Points
    2,369
    Level
    11

    Re: Shifting control from one module to another iteratively

    Step 1, create a vector-array of your data
    Step 2, Use generate statements to iteratively connect the previous.

    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    type x is array<> of std_logic_vector(<>)
    signal data_in : x ... -- note this is pseudo code.
    ...
     
    G_label : for I in array_range generate --loop
    begin
        uut : component
            port map
            (
                clk => clk,
                ...
                data_in => data_in(I),
                data_out => data_in(I+1),
            );
    end generate;

    It's worth stating that array_range may be smaller than ACTUAL array_range to account for the +1 offset etc.

    I hope this is an avenue worth exploring.

    Regards,


    -----------------
    Edit#
    I read other replys and see my response is not relevant to question, but useful nonetheless for #1



  6. #6
    Super Moderator
    Points: 31,949, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,393
    Helped
    1734 / 1734
    Points
    31,949
    Level
    43

    Re: Shifting control from one module to another iteratively

    Quote Originally Posted by wesleytaylor View Post
    Step 1, create a vector-array of your data
    Step 2, Use generate statements to iteratively connect the previous.

    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    type x is array<> of std_logic_vector(<>)
    signal data_in : x ... -- note this is pseudo code.
    ...
     
    G_label : for I in array_range generate --loop
    begin
        uut : component
            port map
            (
                clk => clk,
                ...
                data_in => data_in(I),
                data_out => data_in(I+1),
            );
    end generate;

    It's worth stating that array_range may be smaller than ACTUAL array_range to account for the +1 offset etc.

    I hope this is an avenue worth exploring.

    Regards,


    -----------------
    Edit#
    I read other replys and see my response is not relevant to question, but useful nonetheless for #1
    OP has been asking questions in Systemverilog not VHDL, this sample of code isn't going to help them.

    Another way besides the SR control is use SV queues, just fill two queues in the module that interleaves, which is what it appears you are trying to convey with "that works on this data iteratively") the two input separate modules data. This way you can interleave the two inputs any way you want and start or stop the module that feeds the interleaved data to the DUT and you won't have to rely on a global control variable.



  7. #7
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2019
    Posts
    66
    Helped
    0 / 0
    Points
    322
    Level
    3

    Re: Shifting control from one module to another iteratively

    Quote Originally Posted by ads-ee View Post
    OP has been asking questions in Systemverilog not VHDL, this sample of code isn't going to help them.

    Another way besides the SR control is use SV queues, just fill two queues in the module that interleaves, which is what it appears you are trying to convey with "that works on this data iteratively") the two input separate modules data. This way you can interleave the two inputs any way you want and start or stop the module that feeds the interleaved data to the DUT and you won't have to rely on a global control variable.
    Hi,

    Thank you for your reply. I had a query about incorporating a clock in the two modules. What if the two separate modules are run on a clock? Will that mean in one posedge of clock, the first data gets fed in; goes to the next module which will iterate over a few iterations and control goes back to generator module?



    •   AltAdvertisement

        
       

  8. #8
    Super Moderator
    Points: 31,949, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,393
    Helped
    1734 / 1734
    Points
    31,949
    Level
    43

    Re: Shifting control from one module to another iteratively

    Quote Originally Posted by rrucha View Post
    Hi,

    Thank you for your reply. I had a query about incorporating a clock in the two modules. What if the two separate modules are run on a clock? Will that mean in one posedge of clock, the first data gets fed in; goes to the next module which will iterate over a few iterations and control goes back to generator module?
    Given the vague specification of your requirements. I would once again suggest using SV queues, then it won't matter if you use clocks or not, the two modules will send their data to the third module and the third module will just read from the queues and output data to the DUT in whatever fashion or interleave pattern you want.

    I think you need to draw up a high level block diagram of your testbench to get a better idea of how everything is interconnected and controlled.



  9. #9
    Advanced Member level 4
    Points: 8,723, Level: 22
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,305
    Helped
    281 / 281
    Points
    8,723
    Level
    22
    Blog Entries
    1

    Re: Shifting control from one module to another iteratively

    I think this thread is somehow related to this post:
    https://www.edaboard.com/showthread....put-generation

    Dear OP, I am not sure regarding your understanding of modules, blocks, etc.....
    I have two separate modules that iterate over a range. One generator module will produce input for DUT and this data goes to another module that works on this data iteratively. I tried to code this but somehow I do not know how to transfer the control from one block to another step by step. Can anyone help?
    As I and others have told you in other posts, to ease understanding, please post the RTL for quality help.
    FPGA enthusiast!



--[[ ]]--