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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [macros/] [9x8/] [push32.py] - Diff between revs 3 and 4

Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 17... Line 17...
  ad.AddMacro('.push32', 4, [ ['','singlevalue','symbol'] ]);
  ad.AddMacro('.push32', 4, [ ['','singlevalue','symbol'] ]);
 
 
  # Define the macro functionality.
  # Define the macro functionality.
  def emitFunction(ad,fp,argument):
  def emitFunction(ad,fp,argument):
    argument = argument[0];
    argument = argument[0];
    if argument['type'] == 'value':
    v = ad.Emit_IntegerValue(argument);
      v = argument['value'];
    if not (-2**31 <= v < 2**32):
    elif argument['type'] == 'symbol':
      raise asmDef.AsmException('Argument "%s" should be a 32-bit integer at %s' % (argument['value'],argument['loc'],));
      name = argument['value'];
    printString = argument['value'] if type(argument['value']) == str else '0x%04X' % (v % 2**32);
      if not ad.IsSymbol(name):
    for ix in range(4-1):
        raise asmDef.AsmException('Symbol "%s" not recognized at %s' % (argument['value'],argument['loc'],));
      ad.EmitPush(fp,v%0x100,'');
      ix = ad.symbols['list'].index(name);
      v >>= 8;
      v = ad.symbols['body'][ix];
    ad.EmitPush(fp,v%0x100,'.push32(%s)' % printString);
      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);
 
  ad.EmitFunction['.push32'] = emitFunction;
  ad.EmitFunction['.push32'] = emitFunction;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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