# -*- coding: utf-8 -*-
########################################################################
# ips.py.in - Defines the default instructions per second value.
#
# This file is a .in file purely to provide the default version of
# ips.py which can be appended to by running bin/teco-pi-demo -b on
# the target hardware to provide a better local IPS value.
#
# Copyright © 2017 by Warren Young
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS LISTED ABOVE BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
# OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the names of the authors above
# shall not be used in advertising or otherwise to promote the sale,
# use or other dealings in this Software without prior written
# authorization from those authors.
########################################################################

# Approximate IPS rate for a PDP-8/I based on one fact:
#
# 1. The core cycle time of a PDP-8/I is 1.5 µs.
#
# ...and one assumption:
#
# 2. PDP-8 systems execute instructions at varying rates from roughly 1
#    core cycle time up to many core cycle times.  Most of the core
#    PDP-8 instructions not involving I/O take 1-2 cycles, with I/O
#    taking longer, so we assume that the average for typical real
#    world PDP-8 code will average to 2 cycles per instruction.
#
# Thus, this value is the inverted cycle time divided by 2.
pdp8i = 333333

# A Raspberry Pi B+ running pidp8i-sim unthrottled executes PDP-8 code
# faster than a real PDP-8/I by the factor given, so that running the
# teco-pi-demo benchmkark (-b) it shows a factor of about 1.0.  This
# gives us the lowest possible IPS value short of throttling the sim,
# underclocking the Pi, or starving the simulator of CPU power.
raspberry_pi_b_plus = pdp8i * 5.6

# Initial value; teco-pi-demo -b appends overrides for this
current = raspberry_pi_b_plus

# Benchmark results:
