params.py (13869:cd9d6b36ded0) params.py (13871:ab1644706e11)
1# Copyright (c) 2012-2014, 2017, 2018 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

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

1890
1891 if not Port.is_compat(self, other):
1892 fatal("Ports %s and %s with roles '%s' and '%s' "
1893 "are not compatible", self, other, self.role, other.role)
1894
1895 if other.peer is not self:
1896 other.connect(self)
1897
1# Copyright (c) 2012-2014, 2017, 2018 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

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

1890
1891 if not Port.is_compat(self, other):
1892 fatal("Ports %s and %s with roles '%s' and '%s' "
1893 "are not compatible", self, other, self.role, other.role)
1894
1895 if other.peer is not self:
1896 other.connect(self)
1897
1898 # Allow a master/slave port pair to be spliced between
1899 # a port and its connected peer. Useful operation for connecting
1900 # instrumentation structures into a system when it is necessary
1901 # to connect the instrumentation after the full system has been
1902 # constructed.
1903 def splice(self, new_master_peer, new_slave_peer):
1898 # Allow a compatible port pair to be spliced between a port and its
1899 # connected peer. Useful operation for connecting instrumentation
1900 # structures into a system when it is necessary to connect the
1901 # instrumentation after the full system has been constructed.
1902 def splice(self, new_1, new_2):
1904 if not self.peer or proxy.isproxy(self.peer):
1905 fatal("Port %s not connected, cannot splice in new peers\n", self)
1906
1903 if not self.peer or proxy.isproxy(self.peer):
1904 fatal("Port %s not connected, cannot splice in new peers\n", self)
1905
1907 if not isinstance(new_master_peer, PortRef) or \
1908 not isinstance(new_slave_peer, PortRef):
1906 if not isinstance(new_1, PortRef) or not isinstance(new_2, PortRef):
1909 raise TypeError(
1910 "Splicing non-port references '%s','%s' to port '%s'" % \
1907 raise TypeError(
1908 "Splicing non-port references '%s','%s' to port '%s'" % \
1911 (new_master_peer, new_slave_peer, self))
1909 (new_1, new_2, self))
1912
1913 old_peer = self.peer
1910
1911 old_peer = self.peer
1914 if self.role == 'SLAVE':
1915 self.peer = new_master_peer
1916 old_peer.peer = new_slave_peer
1917 new_master_peer.connect(self)
1918 new_slave_peer.connect(old_peer)
1919 elif self.role == 'MASTER':
1920 self.peer = new_slave_peer
1921 old_peer.peer = new_master_peer
1922 new_slave_peer.connect(self)
1923 new_master_peer.connect(old_peer)
1912
1913 if Port.is_compat(old_peer, new_1) and Port.is_compat(self, new_2):
1914 old_peer.peer = new_1
1915 new_1.peer = old_peer
1916 self.peer = new_2
1917 new_2.peer = self
1918 elif Port.is_compat(old_peer, new_2) and Port.is_compat(self, new_1):
1919 old_peer.peer = new_2
1920 new_2.peer = old_peer
1921 self.peer = new_1
1922 new_1.peer = self
1924 else:
1923 else:
1925 panic("Port %s has unknown role, "+\
1926 "cannot splice in new peers\n", self)
1924 fatal("Ports %s(%s) and %s(%s) can't be compatibly spliced with "
1925 "%s(%s) and %s(%s)", self, self.role,
1926 old_peer, old_peer.role, new_1, new_1.role,
1927 new_2, new_2.role)
1927
1928 def clone(self, simobj, memo):
1929 if self in memo:
1930 return memo[self]
1931 newRef = copy.copy(self)
1932 memo[self] = newRef
1933 newRef.simobj = simobj
1934 assert(isSimObject(newRef.simobj))

--- 233 unchanged lines hidden ---
1928
1929 def clone(self, simobj, memo):
1930 if self in memo:
1931 return memo[self]
1932 newRef = copy.copy(self)
1933 memo[self] = newRef
1934 newRef.simobj = simobj
1935 assert(isSimObject(newRef.simobj))

--- 233 unchanged lines hidden ---