package em.coremark
from em.lang import Math
import BenchAlgI
import Crc
import ListBench
import IdxComparator
import MatrixBench
import StateBench
import Utils
import ValComparator
module CoreBench: BenchAlgI
config TOTAL_DATA_SIZE: uint16 = 2000
config NUM_ALGS: uint8 = 3
end
def em$configure()
memSize = Math.floor(TOTAL_DATA_SIZE / NUM_ALGS)
ListBench.idxCompare ?= IdxComparator.compare
ListBench.valCompare ?= ValComparator.compare
ListBench.memSize ?= memSize
MatrixBench.memSize ?= memSize
StateBench.memSize ?= memSize
ValComparator.Bench0 ?= StateBench
ValComparator.Bench1 ?= MatrixBench
end
def em$construct()
Utils.bindSeedH(1, 0x0)
Utils.bindSeedH(2, 0x0)
Utils.bindSeedH(3, 0x66)
end
def dump()
ListBench.dump()
MatrixBench.dump()
StateBench.dump()
end
def kind()
return Utils.Kind.FINAL
end
def print()
ListBench.print()
MatrixBench.print()
StateBench.print()
end
def run(arg)
auto crc = ListBench.run(1)
Utils.setCrc(Utils.Kind.FINAL, Crc.add16(<int16>crc, Utils.getCrc(Utils.Kind.FINAL)))
crc = ListBench.run(-1)
Utils.setCrc(Utils.Kind.FINAL, Crc.add16(<int16>crc, Utils.getCrc(Utils.Kind.FINAL)))
Utils.bindCrc(Utils.Kind.LIST, Utils.getCrc(Utils.Kind.FINAL))
return Utils.getCrc(Utils.Kind.FINAL)
end
def setup()
ListBench.setup()
MatrixBench.setup()
StateBench.setup()
end