# Path: chips/compiler/types.py
# def size_of(thing):
#     """ Given on object that supports the "type_" method return the size """
# 
#     type_ = thing.type_()
#     return type_size(type_)
# 
# Path: chips/compiler/register_map.py

# 
# Path: chips/compiler/exceptions.py
# class StopSim(Exception):
# 
#     """
#     A process has terminated
#     """
# 
#     pass
# 
# class BreakSim(Exception):
# 
#     """
#     A breakpoint has been reached
#     """
# 
#     pass
# 
# Path: chips/utils/gui_report.py
# class GuiReport(wx.Frame):
# 
#     def __init__(self, parent, title):
#         wx.Frame.__init__(self, parent, title=title, size=(1024,768))
#         self.parent = parent
# 
#         panel = wx.Panel(self, -1)
#         vsizer = wx.BoxSizer(wx.VERTICAL)
# 
#         report_window = wx.TextCtrl(panel,  -1, style=wx.TE_MULTILINE|wx.TE_RICH)
#         font1 = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL, False)
#         report_window.SetFont(font1)
#         report_window.SetEditable(False)
#         self.report_window = report_window
# 
#         vsizer.Add(report_window, 1, wx.EXPAND)
#         panel.SetSizer(vsizer)
# 
#         sizer=wx.BoxSizer(wx.HORIZONTAL)
#         sizer.Add(panel, 1, wx.EXPAND)
#         self.SetSizer(sizer)
# 
#         panel.Layout()
#         self.Layout()
#         self.Show()
# 
#     def report(self, text, highlight):
#         level = 255 - highlight * 255
#         bg = (level, 255, level)
#         self.report_window.SetDefaultStyle(wx.TextAttr(wx.BLACK, bg))
#         self.report_window.AppendText(text + "\n")


import os
import threading
import wx
import wx.aui
import wx.py.editwindow
import wx.stc as stc
import chips.compiler.profiler as profiler
from math import log
from chips.compiler.types import size_of
from chips.compiler.register_map import rregmap, frame
from chips.compiler.exceptions import StopSim, BreakSim
from chips_c import bits_to_float, bits_to_double
from chips.utils.gui_report import GuiReport
            display += "%s %s %s\n" % (
                type_,
                name,
                self.mem_location_as_value(
                    memory,
                    type_,
                    size,
                    frame_val + offset))
        self.locals_window.SetValue(display)

    def update_registers(self):
        model = self.instance.model
        registers = model.get_registers()
        display = ""
        for number in range(16):
            register = registers.get(number, 0)
            display += "%0.2d: %0.10u %s\n" % (
                number, register, rregmap.get(number, "reserved"))
        self.registers_window.SetValue(display)

    def update_globals(self):
        model = self.instance.model
        instruction = model.get_instruction()
        trace = instruction["trace"]
        global_scope = trace.global_scope
        memory = model.get_memory()

        display = ""
        for name, instance in global_scope.global_variables.iteritems():
            offset = instance.offset

# Path: chips/compiler/types.py
# def size_of(thing):
#     """ Given on object that supports the "type_" method return the size """
# 
#     type_ = thing.type_()
#     return type_size(type_)
# 
# Path: chips/compiler/register_map.py

# 
# Path: chips/compiler/exceptions.py
# class StopSim(Exception):
# 
#     """
#     A process has terminated
#     """
# 
#     pass
# 
# class BreakSim(Exception):
# 
#     """
#     A breakpoint has been reached
#     """
# 
#     pass
# 
# Path: chips/utils/gui_report.py
# class GuiReport(wx.Frame):
# 
#     def __init__(self, parent, title):
#         wx.Frame.__init__(self, parent, title=title, size=(1024,768))
#         self.parent = parent
# 
#         panel = wx.Panel(self, -1)
#         vsizer = wx.BoxSizer(wx.VERTICAL)
# 
#         report_window = wx.TextCtrl(panel,  -1, style=wx.TE_MULTILINE|wx.TE_RICH)
#         font1 = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL, False)
#         report_window.SetFont(font1)
#         report_window.SetEditable(False)
#         self.report_window = report_window
# 
#         vsizer.Add(report_window, 1, wx.EXPAND)
#         panel.SetSizer(vsizer)
# 
#         sizer=wx.BoxSizer(wx.HORIZONTAL)
#         sizer.Add(panel, 1, wx.EXPAND)
#         self.SetSizer(sizer)
# 
#         panel.Layout()
#         self.Layout()
#         self.Show()
# 
#     def report(self, text, highlight):
#         level = 255 - highlight * 255
#         bg = (level, 255, level)
#         self.report_window.SetDefaultStyle(wx.TextAttr(wx.BLACK, bg))
#         self.report_window.AppendText(text + "\n")


# Path: chips/utils/gui_instance.py
import os
import threading
import wx
import wx.aui
import wx.py.editwindow
import wx.stc as stc
import chips.compiler.profiler as profiler
from math import log
from chips.compiler.types import size_of
from chips.compiler.register_map import rregmap, frame
from chips.compiler.exceptions import StopSim, BreakSim
from chips_c import bits_to_float, bits_to_double
from chips.utils.gui_report import GuiReport

            display += "%s %s %s\n" % (
                type_,
                name,
                self.mem_location_as_value(
                    memory,
                    type_,
                    size,
                    frame_val + offset))
        self.locals_window.SetValue(display)

    def update_registers(self):
        model = self.instance.model
        registers = model.get_registers()
        display = ""
        for number in range(16):
            register = registers.get(number, 0)
            display += "%0.2d: %0.10u %s\n" % (
                number, register, rregmap.get(number, "reserved"))
        self.registers_window.SetValue(display)

    def update_globals(self):
        model = self.instance.model
        instruction = model.get_instruction()
        trace = instruction["trace"]
        global_scope = trace.global_scope
        memory = model.get_memory()

        display = ""
        for name, instance in global_scope.global_variables.iteritems():
            offset = instance.offset

            size = size_of(instance)