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

Subversion Repositories ssbcc

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

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

Rev 9 Rev 11
Line 8... Line 8...
#
#
################################################################################
################################################################################
 
 
# global modules
# global modules
import argparse
import argparse
 
import os
import re
import re
import sys
import sys
 
 
# User defined modules
# User defined modules
import asmDef
import asmDef
Line 50... Line 51...
  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');
  argListParser.add_argument('-R', metavar='PORT=index', action='append', help='Strobe-only output port names');
  argListParser.add_argument('-R', metavar='PORT=index', action='append', help='Strobe-only output port names');
  argListParser.add_argument('-S', metavar='MEMORY=length', action='append', help='Memory length');
  argListParser.add_argument('-S', metavar='MEMORY=length', action='append', help='Memory length');
 
  argListParser.add_argument('--help-macro', metavar='macroName', type=str, help='Display usage message for the specified macro');
  argListParser.add_argument('-i', action='store_true', help='enable/require interrupt');
  argListParser.add_argument('-i', action='store_true', help='enable/require interrupt');
 
  argListParser.add_argument('--list-macros', action='store_true', help='list the built-in and user-defined macros');
  argListParser.add_argument('-o', metavar='outfile', type=argparse.FileType('w'), required =True, help='output metafile');
  argListParser.add_argument('-o', metavar='outfile', type=argparse.FileType('w'), required =True, help='output metafile');
  argListParser.add_argument('-s', metavar='STACK_NAME=length', action='append', help='Stack length');
  argListParser.add_argument('-s', metavar='STACK_NAME=length', action='append', help='Stack length');
  argListParser.add_argument('filename', metavar='filename', nargs='+', type=validateFile, help='required list of files');
  argListParser.add_argument('filename', metavar='filename', nargs='+', type=validateFile, help='required list of files');
  argList = argListParser.parse_args();
  argList = argListParser.parse_args();
 
 
Line 158... Line 161...
  # Add paths for the ".macro" directive.
  # Add paths for the ".macro" directive.
  if argList.M:
  if argList.M:
    for path in argList.M:
    for path in argList.M:
      ad.AddMacroSearchPath(path);
      ad.AddMacroSearchPath(path);
 
 
 
  ##############################################################################
 
  #
 
  # Terminating help messages
 
  #
 
  ##############################################################################
 
 
 
  # If asked, print the usage for the specified macro.
 
  if argList.help_macro:
 
    macroName = argList.help_macro
 
    if macroName[0] != '.':
 
      macroName = '.%s' % macroName
 
    if macroName not in ad.macros['list']:
 
      try:
 
        ad.AddUserMacro(macroName[1:])
 
      except:
 
        pass
 
    if macroName in ad.macros['list']:
 
      ix = ad.macros['list'].index(macroName)
 
      if ad.macros['doc'][ix]:
 
        print '\n%s usage message:' % macroName
 
        print ad.macros['doc'][ix]
 
      else:
 
        print '\nNo usage message for %s\n' % macroName
 
    else:
 
      print 'Macro "%s" not recognized or malformed' % macroName
 
    print 'Assembler terminated by "--help-macro" option'
 
    sys.exit(1)
 
 
 
  # If asked, list the available macros.
 
  if argList.list_macros:
 
    print '\nBuilt-in macros\n'
 
    tmp = [name for name in ad.macros['builtIn']]
 
    tmp.sort()
 
    for name in tmp:
 
      print name
 
    for testPath in ad.macroSearchPaths:
 
      if not os.path.isdir(testPath):
 
        continue
 
      for testName in os.listdir(testPath):
 
        if not re.match(r'.*\.py$',testName):
 
          continue;
 
        fullFile = os.path.join(testPath,testName);
 
        if not os.path.isfile(fullFile):
 
          continue
 
        try:
 
          execfile(fullFile)
 
          exec('%s(ad)' % testName[:-3])
 
        except:
 
          pass
 
    print '\nUser-defined macros\n'
 
    tmp = [name for name in ad.macros['list'] if name not in ad.macros['builtIn']]
 
    tmp.sort()
 
    for name in tmp:
 
      print name
 
    print
 
    print 'Assembler terminated by "--list-macros" option'
 
    sys.exit(1)
 
 
  ################################################################################
  ################################################################################
  #
  #
  # Stage 1:  Parse the files.
  # Stage 1:  Parse the files.
  #
  #
  # Read the entire file, doing the following while reading the file:
  # Read the entire file, doing the following while reading the file:

powered by: WebSVN 2.1.0

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