SimObject.py (12023:272819f230c0) SimObject.py (12035:7b8e1b36875d)
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 667 unchanged lines hidden (view full) ---

676 # here). Sort the params based on their key
677 params = map(lambda (k, v): v, sorted(cls._params.local.items()))
678 ports = cls._ports.local
679
680 code('''#include "pybind11/pybind11.h"
681#include "pybind11/stl.h"
682
683#include "params/$cls.hh"
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 667 unchanged lines hidden (view full) ---

676 # here). Sort the params based on their key
677 params = map(lambda (k, v): v, sorted(cls._params.local.items()))
678 ports = cls._ports.local
679
680 code('''#include "pybind11/pybind11.h"
681#include "pybind11/stl.h"
682
683#include "params/$cls.hh"
684#include "python/pybind11/core.hh"
684#include "sim/init.hh"
685#include "sim/sim_object.hh"
686
687#include "${{cls.cxx_header}}"
688
689''')
690
691 for param in params:

--- 721 unchanged lines hidden (view full) ---

1413 fatal("%s.%s without default or user set value",
1414 self.path(), param)
1415
1416 value = value.getValue()
1417 if isinstance(self._params[param], VectorParamDesc):
1418 assert isinstance(value, list)
1419 vec = getattr(cc_params, param)
1420 assert not len(vec)
685#include "sim/init.hh"
686#include "sim/sim_object.hh"
687
688#include "${{cls.cxx_header}}"
689
690''')
691
692 for param in params:

--- 721 unchanged lines hidden (view full) ---

1414 fatal("%s.%s without default or user set value",
1415 self.path(), param)
1416
1417 value = value.getValue()
1418 if isinstance(self._params[param], VectorParamDesc):
1419 assert isinstance(value, list)
1420 vec = getattr(cc_params, param)
1421 assert not len(vec)
1421 setattr(cc_params, param, list(value))
1422 # Some types are exposed as opaque types. They support
1423 # the append operation unlike the automatically
1424 # wrapped types.
1425 if isinstance(vec, list):
1426 setattr(cc_params, param, list(value))
1427 else:
1428 for v in value:
1429 getattr(cc_params, param).append(v)
1422 else:
1423 setattr(cc_params, param, value)
1424
1425 port_names = self._ports.keys()
1426 port_names.sort()
1427 for port_name in port_names:
1428 port = self._port_refs.get(port_name, None)
1429 if port != None:

--- 118 unchanged lines hidden ---
1430 else:
1431 setattr(cc_params, param, value)
1432
1433 port_names = self._ports.keys()
1434 port_names.sort()
1435 for port_name in port_names:
1436 port = self._port_refs.get(port_name, None)
1437 if port != None:

--- 118 unchanged lines hidden ---