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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [asm] - Diff between revs 3 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 9
Line 42... Line 42...
    except:
    except:
      raise asmDef.AsmException('Error opening "%s"' % filename);
      raise asmDef.AsmException('Error opening "%s"' % filename);
 
 
  argListParser = argparse.ArgumentParser(description='SSBCC 9x8 assembler');
  argListParser = argparse.ArgumentParser(description='SSBCC 9x8 assembler');
  argListParser.add_argument('-C', metavar='CONSTANT=value', action='append', help='Constant definition');
  argListParser.add_argument('-C', metavar='CONSTANT=value', action='append', help='Constant definition');
 
  argListParser.add_argument('-D', metavar='define', type=str, action='append', help='Define symbol (must start with "D_")');
  argListParser.add_argument('-G', metavar='parametername', action='append', help='parameter names');
  argListParser.add_argument('-G', metavar='parametername', action='append', help='parameter names');
  argListParser.add_argument('-I', metavar='PORT=index', action='append', help='Input port names');
  argListParser.add_argument('-I', metavar='PORT=index', action='append', help='Input port names');
  argListParser.add_argument('-L', metavar='librarypath', action='append', help='Library search path');
  argListParser.add_argument('-L', metavar='librarypath', action='append', help='Library search path');
  argListParser.add_argument('-M', metavar='macropath', action='append', help='Macro search path');
  argListParser.add_argument('-M', metavar='macropath', action='append', help='Macro search path');
  argListParser.add_argument('-O', metavar='PORT=index', action='append', help='Output port names');
  argListParser.add_argument('-O', metavar='PORT=index', action='append', help='Output port names');
Line 62... Line 63...
  ad = asmDef_9x8();
  ad = asmDef_9x8();
 
 
  # Record the constants in the program symbol table.
  # Record the constants in the program symbol table.
  if argList.C:
  if argList.C:
    for constant in argList.C:
    for constant in argList.C:
      a=re.findall(r'^(C_\w+)=(\w+)$',constant);
      a=re.findall(r'^(C_\w+)=(-?[1-9]\d*|\w+)$',constant);
      if not a:
      if not a:
        raise asmDef.AsmException('Malformed -C argument: "%s"' % constant);
        raise asmDef.AsmException('Malformed -C argument: "%s"' % constant);
      a = list(a[0]);
      a = list(a[0]);
      try:
      try:
        a[1] = eval(a[1]);
        a[1] = eval(a[1]);
Line 74... Line 75...
        raise asmDef.AsmException('Cannot evaluate "%s"' % a[1]);
        raise asmDef.AsmException('Cannot evaluate "%s"' % a[1]);
      if ad.IsSymbol(a[0]):
      if ad.IsSymbol(a[0]):
        raise asmDef.AsmException('Command line constant "%s" already defined' % a[0]);
        raise asmDef.AsmException('Command line constant "%s" already defined' % a[0]);
      ad.AddSymbol(a[0], 'constant', body=[a[1]]);
      ad.AddSymbol(a[0], 'constant', body=[a[1]]);
 
 
 
  # Record the defines.
 
  if argList.D:
 
    for name in argList.D:
 
      if not re.match('D_',name):
 
        raise SSBCCException('Bad define name "%s" should start with "D_"' % name);
 
      ad.AddSymbol(name, 'define');
 
 
  # Record the input names and values in the appropriate record type
  # Record the input names and values in the appropriate record type
  if argList.G:
  if argList.G:
    for parameter in argList.G:
    for parameter in argList.G:
      a = re.findall(r'^([LG]_\w+)$',parameter);
      a = re.findall(r'^([LG]_\w+)$',parameter);
      if not a:
      if not a:

powered by: WebSVN 2.1.0

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