Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / api / sam / src / sam-s10.py
# ========== Copyright Header Begin ==========================================
#
# OpenSPARC T2 Processor File: sam-s10.py
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
#
# The above named program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation.
#
# The above named program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this work; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ========== Copyright Header End ============================================
# ToDo
#
# Commandline options:
# -a for auto boot
# -p for number of running strands
# -m for mask of running strands (iso -p)
# -w for number of worker threads
cfg_cpu = '1c1t'
#cfg_cpu = '1c2t'
#cfg_cpu = '8c4t'
bin = [
#('nvram1-auto', 0x1f11000000)
('nvram1', 0x1f11000000)
, (cfg_cpu+'-md.bin', 0x1f12000000)
, (cfg_cpu+'-hv.bin', 0x1f12080000)
, ('reset.bin', 0xfff0000000)
, ('q.bin', 0xfff0010000)
, ('openboot.bin', 0xfff0080000)
, ('disk1', 0x1f40000000)
]
print
for (file,base) in bin:
print 'Loading %(base)s - %(file)s' % {'file':file, 'base':hex(base)}
sim.mem.load(file,base)
# Hack the guest console address to morf a RAM
# address into a I/O address.
guest_bin = 0x1f12080148
guest_old = 0x1f10000000
guest_new = 0x9f10000000
for i in range(0,64):
if sim.mem.x[guest_bin] == guest_old:
print
print 'Patching guest console UART address at',guest_bin
sim.mem.x[guest_bin] = guest_new
break
guest_bin += 0x50
print
def dec(x):
return '%d' % x
import os
def q():
os._exit(0)