OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /ssbcc/trunk/macros/9x8
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

/pushByte.py
29,4 → 29,5
printValue = argument[0]['value'] if type(argument[0]['value']) == str else '0x%X' % argument[0]['value'];
printIx = argument[1]['value'] if type(argument[1]['value']) == str else '0x%X' % argument[1]['value'];
ad.EmitPush(fp,v,'.pushByte(%s,%s)' % (printValue,printIx,));
 
ad.EmitFunction['.pushByte'] = emitFunction;
/push32.py
19,24 → 19,13
# Define the macro functionality.
def emitFunction(ad,fp,argument):
argument = argument[0];
if argument['type'] == 'value':
v = argument['value'];
elif argument['type'] == 'symbol':
name = argument['value'];
if not ad.IsSymbol(name):
raise asmDef.AsmException('Symbol "%s" not recognized at %s' % (argument['value'],argument['loc'],));
ix = ad.symbols['list'].index(name);
v = ad.symbols['body'][ix];
if len(v) != 1:
raise asmDef.AsmException('Argument can only be one value at %s' % argument['loc']);
v = v[0];
else:
raise asmDef.AsmException('Argument "%s" of type "%s" not recognized at %s' % (argument['value'],argument['type'],argument['loc'],));
if type(v) != int:
raise Exception('Program Bug -- value should be an "int"');
ad.EmitPush(fp,v%0x100,''); v >>= 8;
ad.EmitPush(fp,v%0x100,''); v >>= 8;
ad.EmitPush(fp,v%0x100,''); v >>= 8;
printValue = argument['value'] if type(argument['value']) == str else '0x%08X' % argument['value'];
ad.EmitPush(fp,v%0x100,'.push32(%s)' % printValue);
v = ad.Emit_IntegerValue(argument);
if not (-2**31 <= v < 2**32):
raise asmDef.AsmException('Argument "%s" should be a 32-bit integer at %s' % (argument['value'],argument['loc'],));
printString = argument['value'] if type(argument['value']) == str else '0x%04X' % (v % 2**32);
for ix in range(4-1):
ad.EmitPush(fp,v%0x100,'');
v >>= 8;
ad.EmitPush(fp,v%0x100,'.push32(%s)' % printString);
 
ad.EmitFunction['.push32'] = emitFunction;
/push24.py
0,0 → 1,31
# Copyright 2014, Sinclair R.F., Inc.
 
def push24(ad):
"""
User-defined macro to push a 24 bit value onto the data stack so that the LSB
is deepest in the data stack and the MSB is at the top of the data stack.
Usage:
.push24(v)
where
v is a 24-bit value, a constant, or an evaluated expression\n
The effect is to push v%0x100, int(v/2**8)%0x100, and int(v/2**16)%0x100 onto
the data stack.\n
( - u_LSB u u_MSB )
"""
 
# Add the macro to the list of recognized macros.
ad.AddMacro('.push24', 3, [ ['','singlevalue','symbol'] ]);
 
# Define the macro functionality.
def emitFunction(ad,fp,argument):
argument = argument[0];
v = ad.Emit_IntegerValue(argument);
if not (-2**23 <= v < 2**24):
raise asmDef.AsmException('Argument "%s" should be a 24-bit integer at %s' % (argument['value'],argument['loc'],));
printString = argument['value'] if type(argument['value']) == str else '0x%04X' % (v % 2**24);
for ix in range(3-1):
ad.EmitPush(fp,v%0x100,'');
v >>= 8;
ad.EmitPush(fp,v%0x100,'.push24(%s)' % printString);
 
ad.EmitFunction['.push24'] = emitFunction;
/push16.py
9,7 → 9,7
where
v is a 16-bit value, a constant, or an evaluated expression\n
The effect is to push v%0x100 and int(v/2**8)%0x100 onto the data stack.\n
( - u_LSB u u u_MSB )
( - u_LSB u_MSB )
"""
 
# Add the macro to the list of recognized macros.
18,22 → 18,12
# Define the macro functionality.
def emitFunction(ad,fp,argument):
argument = argument[0];
if argument['type'] == 'value':
v = argument['value'];
elif argument['type'] == 'symbol':
name = argument['value'];
if not ad.IsSymbol(name):
raise asmDef.AsmException('Symbol "%s" not recognized at %s' % (argument['value'],argument['loc'],));
ix = ad.symbols['list'].index(name);
v = ad.symbols['body'][ix];
if len(v) != 1:
raise asmDef.AsmException('Argument can only be one value at %s' % argument['loc']);
v = v[0];
else:
raise asmDef.AsmException('Argument "%s" of type "%s" not recognized at %s' % (argument['value'],argument['type'],argument['loc'],));
if type(v) != int:
raise Exception('Program Bug -- value should be an "int"');
ad.EmitPush(fp,v%0x100,''); v >>= 8;
printValue = argument['value'] if type(argument['value']) == str else '0x%08X' % argument['value'];
ad.EmitPush(fp,v%0x100,'.push16(%s)' % printValue);
v = ad.Emit_IntegerValue(argument);
if not (-2**15 <= v < 2**16):
raise asmDef.AsmException('Argument "%s" should be a 16-bit integer at %s' % (argument['value'],argument['loc'],));
printString = argument['value'] if type(argument['value']) == str else '0x%04X' % (v % 2**16);
ad.EmitPush(fp,v%0x100,'');
v >>= 8;
ad.EmitPush(fp,v%0x100,'.push16(%s)' % printString);
 
ad.EmitFunction['.push16'] = emitFunction;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.