<commit_before># -*- coding: utf-8 -*-

tooltip = \
"""Interface like funtionality: like in SystemVerilog. 
Suited for central registers etc.

reg_names specifies which names should be extracted"""

# cell definition
# name = 'Interface'
# libname = 'common'
from  supsisim import const

inp = []
outp = []

parameters = dict(reg_names = 'reg1')
properties = {} # for netlisting
#view variables:

def ports(param):
    reg_names = param['reg_names'] if 'reg_names' in param else 'reg1'
    reg_names = reg_names.replace(', ', ' ').split()
    w2 = 100
    inp, outp, inout = [], [], []

    # inp
    inp.append(('section', -w2, -const.PD))    

    # outp
    for ix, pname in enumerate(reg_names):
        outp.append((pname, w2, ix * const.PD))
    return inp, outp, inout
    

def getSymbol(param, properties,parent=None,scene=None,):
    import supsisim.block
    attributes = dict()
    attributes['name'] = name
    attributes['libname'] = libname
    inp, outp, _ = ports(param)
    attributes['input'] = inp
    attributes['output'] = outp
    b = supsisim.block.Block(attributes,param,properties, name, libname, parent, scene)
                 
    return b
    
def toMyhdlInstance(instname, connectdict, param):
    # properties end up in the connectdict
    inp, outp, _ = ports(param)
    
    r  = []
    section, tp = connectdict[inp[0][0]]
    for pname, x, y in outp:
        netname, tp = connectdict[pname]
        r.append('{nn}.next = {s}.{pn}'.format(nn = netname, pn = pname, s = section))
        
    assigns = '\n        '.join(r)
    fmt = '    @always({})\n' + \
          '    def u_{}():\n' + \
          '        {}\n'
    return fmt.format(section, instname, assigns)

views = {}<commit_msg>fix netlisting to correct syntax<commit_after># -*- coding: utf-8 -*-

tooltip = \
"""Interface like funtionality: like in SystemVerilog. 
Suited for central registers etc.

reg_names specifies which names should be extracted"""

# cell definition
# name = 'Interface'
# libname = 'common'
from  supsisim import const

inp = []
outp = []

parameters = dict(reg_names = 'reg1')
properties = {} # for netlisting
#view variables:

def ports(param):
    reg_names = param['reg_names'] if 'reg_names' in param else 'reg1'
    reg_names = reg_names.replace(', ', ' ').split()
    w2 = 100
    inp, outp, inout = [], [], []

    # inp
    inp.append(('reg', -w2, -const.PD))    

    # outp
    for ix, pname in enumerate(reg_names):
        outp.append((pname, w2, ix * const.PD))
    return inp, outp, inout
    

def getSymbol(param, properties,parent=None,scene=None,):
    import supsisim.block
    attributes = dict()
    attributes['name'] = name
    attributes['libname'] = libname
    inp, outp, _ = ports(param)
    attributes['input'] = inp
    attributes['output'] = outp
    b = supsisim.block.Block(attributes,param,properties, name, libname, parent, scene)
                 
    return b
    
def toMyhdlInstance(instname, connectdict, param):
    # properties end up in the connectdict
    inp, outp, _ = ports(param)
    
    r  = []
    reg, tp = connectdict[inp[0][0]]
    for pname, x, y in outp:
        netname, tp = connectdict[pname]
        r.append('{nn}.next = {r}.{pn}'.format(nn = netname, pn = pname, r = reg))
        
    assigns = '\n        '.join(r)
    fmt = '    #assignments\n' + \
          '    @always_comb\n' + \
          '    def u_{i}():\n' + \
          '        {a}\n'
    return fmt.format(i=instname, a=assigns)

views = {}
{'fraction_non_alphanumeric': 0.1481375358166189, 'fraction_numerical': 0.006303724928366762, 'mean_word_length': 2.6478578892371996, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1555523', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1192, 'n_words': 304}