<commit_before>#=======================================================================
# pisa_sim.py
#=======================================================================

import sys
sys.path.append('/Users/dmlockhart/vc/git-brg/parc/pymtl')
sys.path.append('/Users/dmlockhart/vc/hg-opensource/pypy')

import os
import elf

from   isa              import decode
from   utils            import State, Memory
from   rpython.rlib.jit import JitDriver

#-----------------------------------------------------------------------
# jit
#-----------------------------------------------------------------------

jitdriver = JitDriver( greens =['pc'],
                       reds   =['num_inst','state'],
                       virtualizables = ['state']
                     )

def jitpolicy(driver):
  from rpython.jit.codewriter.policy import JitPolicy
  return JitPolicy()

#-----------------------------------------------------------------------
# bootstrap code
#-----------------------------------------------------------------------
# TODO: HACKY! We are rewriting the binary here, should really fix the
#       compiler instead!

bootstrap_addr = 0x400
bootstrap_code = [
  #0x07, 0x00, 0x1d, 0x3c,   # lui r29, 0x0007
  #0xfc, 0xff, 0x1d, 0x34,   # ori r29, r0, 0xfffc
  #0x00, 0x04, 0x00, 0x08,   # j   0x1000
  0x3c1d0007,
  0x341dfffc,
  0x08000400,
]

rewrite_addr      = 0x1008
rewrite_code      = [
  #0x08, 0x04, 0x00, 0x08,   # j   0x1020
  0x08000408,
]

#-----------------------------------------------------------------------<commit_msg>[parc] added location info for JIT IR<commit_after>#=======================================================================
# pisa_sim.py
#=======================================================================

import sys
sys.path.append('/Users/dmlockhart/vc/git-brg/parc/pymtl')
sys.path.append('/Users/dmlockhart/vc/hg-opensource/pypy')

import os
import elf

from   isa              import decode
from   utils            import State, Memory
from   rpython.rlib.jit import JitDriver

#-----------------------------------------------------------------------
# jit
#-----------------------------------------------------------------------

# for debug printing in PYPYLOG
def get_location( pc ):
  # TODO: add the disassembly of the instruction here as well
  return "pc: %x" % pc

jitdriver = JitDriver( greens =['pc'],
                       reds   =['num_inst','state'],
                       virtualizables = ['state'],
                       get_printable_location=get_location,
                     )

def jitpolicy(driver):
  from rpython.jit.codewriter.policy import JitPolicy
  return JitPolicy()

#-----------------------------------------------------------------------
# bootstrap code
#-----------------------------------------------------------------------
# TODO: HACKY! We are rewriting the binary here, should really fix the
#       compiler instead!

bootstrap_addr = 0x400
bootstrap_code = [
  #0x07, 0x00, 0x1d, 0x3c,   # lui r29, 0x0007
  #0xfc, 0xff, 0x1d, 0x34,   # ori r29, r0, 0xfffc
  #0x00, 0x04, 0x00, 0x08,   # j   0x1000
  0x3c1d0007,
  0x341dfffc,
  0x08000400,
]

rewrite_addr      = 0x1008
rewrite_code      = [
  #0x08, 0x04, 0x00, 0x08,   # j   0x1020
  0x08000408,
]

#-----------------------------------------------------------------------
{'fraction_non_alphanumeric': 0.3742865725443076, 'fraction_numerical': 0.06007810153199159, 'mean_word_length': 1.4342105263157894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6048198', 'n_tokens_mistral': 1078, 'n_tokens_neox': 929, 'n_words': 215}