OpenCores
URL https://opencores.org/ocsvn/nocmodel/nocmodel/trunk

Subversion Repositories nocmodel

[/] [nocmodel/] [trunk/] [nocmodel/] [noc_tbm_utils.py] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 dargor
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
 
4
#
5
# NoC TBM simulation support - Utilities
6
#   This module declares additional helper functions 
7
#
8
# Author:  Oscar Diaz
9
# Version: 0.2
10
# Date:    17-03-2011
11
 
12
#
13
# This code is free software; you can redistribute it and/or
14
# modify it under the terms of the GNU Lesser General Public
15
# License as published by the Free Software Foundation; either
16
# version 2.1 of the License, or (at your option) any later version.
17
#
18
# This code is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21
# Lesser General Public License for more details.
22
#
23
# You should have received a copy of the GNU Lesser General Public
24
# License along with this library; if not, write to the
25
# Free Software  Foundation, Inc., 59 Temple Place, Suite 330,
26
# Boston, MA  02111-1307  USA
27
#
28
 
29
#
30
# Changelog:
31
#
32
# 03-03-2011 : (OD) initial release
33
#
34
 
35
"""
36
=============================
37
NoCmodel TBM simulation utils
38
=============================
39
 
40
This module declares additional helper functions.
41
 
42
* Function 'add_tbm_basic_support'
43
"""
44
 
45
from noc_tbm_base import *
46
from nocmodel.basicmodels import *
47
 
48
# helper functions
49
def add_tbm_basic_support(instance, **kwargs):
50
    """
51
    This function will add for every object in noc_instance a noc_tbm object
52
    """
53
    if isinstance(instance, noc):
54
        # add simulation object
55
        instance.tbmsim = noc_tbm_simulation(instance, **kwargs)
56
        # and add tbm objects recursively
57
        for obj in instance.all_list():
58
            altkwargs = kwargs
59
            altkwargs.pop("log_file", None)
60
            altkwargs.pop("log_level", None)
61
            add_tbm_basic_support(obj, **kwargs)
62
    elif isinstance(instance, ipcore):
63
        instance.tbm = basic_ipcore_tbm(instance, **kwargs)
64
        # don't forget internal channel
65
        instance.channel_ref.tbm = basic_channel_tbm(instance.channel_ref, **kwargs)
66
    elif isinstance(instance, router):
67
        instance.tbm = basic_router_tbm(instance, **kwargs)
68
    elif isinstance(instance, channel):
69
        instance.tbm = basic_channel_tbm(instance, **kwargs)
70
    else:
71
        raise TypeError("Unsupported object: type %s" % type(instance))

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.