From cd65b27d77100adaab8a54edb715b340abe6f1bd Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Wed, 27 Jul 2016 18:01:28 +0100 Subject: [PATCH 1/2] Remove unused imports. These were hidden from the linter by try/except statements. --- .landscape.yml | 2 +- revelation/isa.py | 5 ----- revelation/machine.py | 5 +---- revelation/utils.py | 18 +++--------------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/.landscape.yml b/.landscape.yml index 80a1f07..d03ad55 100644 --- a/.landscape.yml +++ b/.landscape.yml @@ -2,4 +2,4 @@ pylint: disable: - too-many-arguments - unused-argument - - unused-import + diff --git a/revelation/isa.py b/revelation/isa.py index 459c4c6..679aae7 100644 --- a/revelation/isa.py +++ b/revelation/isa.py @@ -8,11 +8,6 @@ from pydgin.misc import create_risc_decoder -try: - from rpython.rlib.objectmodel import we_are_translated -except ImportError: - we_are_translated = lambda : False - reg_map = { 'r0' : 0, 'r1' : 1, 'r2' : 2, 'r3' : 3, diff --git a/revelation/machine.py b/revelation/machine.py index d1fb6fa..a58c697 100644 --- a/revelation/machine.py +++ b/revelation/machine.py @@ -1,14 +1,11 @@ from revelation.isa import reg_map from revelation.storage import MemoryMappedRegisterFile -try: - from rpython.rlib.rarithmetic import intmask -except ImportError: - intmask = lambda x : x RESET_ADDR = 0 PC_ADDRESS = 0xf0408 + class State(object): _virtualizable_ = ['num_insts'] diff --git a/revelation/utils.py b/revelation/utils.py index e47cdf3..6d225a4 100644 --- a/revelation/utils.py +++ b/revelation/utils.py @@ -4,18 +4,6 @@ import math -try: - from rpython.rlib.rarithmetic import r_uint, intmask - from rpython.rlib.objectmodel import specialize -except ImportError: - r_uint = lambda x : x - intmask = lambda x : x - class Specialize(object): - def argtype(self, fun, *args): - return lambda fun : fun - specialize = Specialize() - - def get_mmr_address(rn, m0m1): """Return address of an memory-mapped register and its size in bits. """ @@ -31,8 +19,8 @@ def get_mmr_address(rn, m0m1): def signed(value): if value & 0x8000000: twos_complement = ~value + 1 - return -intmask(trim_32(twos_complement)) - return intmask(value) + return -pydgin.utils.intmask(trim_32(twos_complement)) + return pydgin.utils.intmask(value) def reg_or_simm(state, inst, is16bit): @@ -74,7 +62,7 @@ def sext_24(value): return value -@specialize.argtype(0) +@pydgin.utils.specialize.argtype(0) def trim_32(value): return value & 0xffffffff From bf7f5b6a143e354d2ce144f69cdda5207ffc9484 Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Wed, 27 Jul 2016 18:02:08 +0100 Subject: [PATCH 2/2] Avoid attribute name clash. --- revelation/instruction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revelation/instruction.py b/revelation/instruction.py index 5e34316..fe6509b 100644 --- a/revelation/instruction.py +++ b/revelation/instruction.py @@ -1,7 +1,7 @@ class Instruction(object): - def __init__(self, bits, str): + def __init__(self, bits, name): self.bits = bits - self.str = str + self.name = name @property def rd(self):