Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter definition #14

Open
mkosunen opened this issue Feb 12, 2021 · 7 comments
Open

Parameter definition #14

mkosunen opened this issue Feb 12, 2021 · 7 comments
Assignees

Comments

@mkosunen
Copy link
Member

Define the parameters that must be defined within an entity in order to enable parallel runs from the parent.

@mkosunen
Copy link
Member Author

Ping @kspoof ( @ECD-jry in case you are interested)

@mkosunen
Copy link
Member Author

Depends on #16

@kspoof
Copy link
Contributor

kspoof commented Feb 12, 2021

So far we've used parameters par=True/False and queue=[]

Requirements for entities. In brackets is how I have been doing this so far.

  1. The method in the entity needs to take in queue from parent for returning data. (if given set it to self.queue and set par=True)
  2. After simulation, set data to the queue (if par=True, set data to self.queue)

Is the current way good enough?

@mkosunen
Copy link
Member Author

mkosunen commented Feb 13, 2021

Thing to consider is how to define and determine the order in which the values are put to queue. This could be done for example by defining that

  1. Values are alwasy put to the queue by looping through the self.IOS.Memembers like (this is pseudocode, I do not remember the exact syntax)
for key,value in self.IOS.Members:
    put (key,value.Data)
  1. In receiving parent, those values could then be assigned with

(key,value)=get(queue)
dut.IOS.Members[key].Data=value


I hope you get the idea, My python is bit rusty in Saturday mornings. :)

@kspoof kspoof linked a pull request Feb 15, 2021 that will close this issue
@kspoof
Copy link
Contributor

kspoof commented Feb 15, 2021

I made it now so that the instances return their IOS (can be disabled with a flag because at least my testbench doesn't have IOs).

Other data (e.g. calculated gain) is returned as a dictionary. run_parallel() saves this dictionary's value key pairs as parameters for each instance

So, the code needed in the instances is

if self.par==True: 
    retlist = self.IOSdict_for_parent() # returns a dictionary in a list (if return_IOS is false, the dict is empty). Currently required even if return_IOS = False
    customret = {'amplitude' : self.sig_sco.peak_to_peak} #optional. Example for returning data other than IOS. These key value pairs end up as parameters for the ran instance
    retlist.append(customret) #optional (see above)
    self.queue.put(retlist)

@mkosunen
Copy link
Member Author

Hmm. self.IO.Members is a dict already, but ok

So the assumption is that what is returned is a dictionary? OK

What is important is then what expected to happen in parent. I propose the following

The parent loops through the returned dictioany as (again peseudocode)

for key,val in returned_dict:
    if key in d.IOS.Members:
      d.IOS.Members[key]=val
   elif hasattr(d,'key'):
    #i do not know how to do this, but set the value of an attribute when the name of the attribute is given as parameter   
    settattr(d,'key') = value
   else:
       self.print_log(type='W', msg='Creating attiribute key for instance d')
       settattr(d,'key') = va settattr(d,'key') = val

@mkosunen
Copy link
Member Author

Let's leave this open. First step would be to convert these to properties at thsdk, so they do not need to be repeated in every entity.

@mkosunen mkosunen removed a link to a pull request Feb 17, 2021
@mkosunen mkosunen reopened this Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants