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

Subversion Repositories ssbcc

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

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

Rev 9 Rev 11
Line 52... Line 52...
  argListParser.add_argument('-P', metavar='peripheral_name[="parameters"]', type=str, action='append', help='Add peripheral');
  argListParser.add_argument('-P', metavar='peripheral_name[="parameters"]', type=str, action='append', help='Add peripheral');
  argListParser.add_argument('-o', metavar='outCoreName', type=str, help='output core name');
  argListParser.add_argument('-o', metavar='outCoreName', type=str, help='output core name');
  argListParser.add_argument('-q', action='store_true', help='quiet');
  argListParser.add_argument('-q', action='store_true', help='quiet');
  argListParser.add_argument('--define-clog2', action='store_true', help='define clog2 instead of using built-in $clog2');
  argListParser.add_argument('--define-clog2', action='store_true', help='define clog2 instead of using built-in $clog2');
  argListParser.add_argument('--display-opcode', action='store_true', help='add 3-letter decode of opcode (for trace viewer)');
  argListParser.add_argument('--display-opcode', action='store_true', help='add 3-letter decode of opcode (for trace viewer)');
 
  argListParser.add_argument('--help-macro', metavar='macroName', type=str, help='Display usage message for the specified macro (passed on to the assembler)');
 
  argListParser.add_argument('--list-macros', action='store_true', help='list the built-in and user-defined macros (passed on to the assembler)');
  argListParser.add_argument('--rand-instr-mem', action='store_true', help='fill unused instruction memory with random values');
  argListParser.add_argument('--rand-instr-mem', action='store_true', help='fill unused instruction memory with random values');
  argListParser.add_argument('--synth-instr-mem', type=str, help='synthesis constraint for instruction memory');
  argListParser.add_argument('--synth-instr-mem', type=str, help='synthesis constraint for instruction memory');
  argListParser.add_argument('--verilator-tracing-on', action='store_true', help='show all signals in verilator waveform files');
  argListParser.add_argument('--verilator-tracing-on', action='store_true', help='show all signals in verilator waveform files');
  argListParser.add_argument('filename', metavar='filename', type=validateFile, help='SSBCC configuration file');
  argListParser.add_argument('filename', metavar='filename', type=validateFile, help='SSBCC configuration file');
  argList = argListParser.parse_args();
  argList = argListParser.parse_args();
Line 199... Line 201...
      config.ProcessCombine(loc,line);
      config.ProcessCombine(loc,line);
    # CONSTANTS
    # CONSTANTS
    elif re.match(r'\s*CONSTANT\b',line):
    elif re.match(r'\s*CONSTANT\b',line):
      if not config.Exists('architecture'):
      if not config.Exists('architecture'):
        raise SSBCCException('"CONSTANT"s cannot be defined before the "ARCHITECTURE" is defined at %s' % loc);
        raise SSBCCException('"CONSTANT"s cannot be defined before the "ARCHITECTURE" is defined at %s' % loc);
      cmd = re.findall(r'\s*CONSTANT\s+(C_\w+)\s+(-?[1-9]\d*|\w+)\s*$',line);
      cmd = re.findall(r'\s*CONSTANT\s+(C_\w+)\s+(0|-?[1-9]\d*|\w+)\s*$',line);
      if not cmd:
      if not cmd:
        raise SSBCCException('Malformed "CONSTANT" configuration command on %s: "%s"' % (loc,line,));
        raise SSBCCException('Malformed "CONSTANT" configuration command on %s: "%s"' % (loc,line,));
      cmd = cmd[0];
      cmd = cmd[0];
      config.AddConstant(cmd[0],cmd[1],loc);
      config.AddConstant(cmd[0],cmd[1],loc);
    # DATA_STACK
    # DATA_STACK
Line 377... Line 379...
 
 
  # Compute the command to invoke the compiler.
  # Compute the command to invoke the compiler.
  if not compiler:
  if not compiler:
    raise SSBCCException('ASSEMBLY configuration command is missing');
    raise SSBCCException('ASSEMBLY configuration command is missing');
  cmd = os.path.join(config.Get('corepath'), compiler[0]);
  cmd = os.path.join(config.Get('corepath'), compiler[0]);
 
  if argList.help_macro:
 
    cmd += ' --help-macro %s' % argList.help_macro
 
  if argList.list_macros:
 
    cmd += ' --list-macros'
  for name in config.constants:
  for name in config.constants:
    cmd += (' -C %s=%s' % (name,config.constants[name],));
    cmd += (' -C %s=%s' % (name,config.constants[name],));
  for name in config.defines:
  for name in config.defines:
    cmd += (' -D %s' % name);
    cmd += (' -D %s' % name);
  for ix in range(len(config.parameters)):
  for ix in range(len(config.parameters)):
Line 409... Line 415...
      cmd += ' -L %s' % pathString;
      cmd += ' -L %s' % pathString;
  cmd += ' ' + compiler[1];
  cmd += ' ' + compiler[1];
 
 
  # Invoke the compiler and exit if it failed.
  # Invoke the compiler and exit if it failed.
  if not argList.q:
  if not argList.q:
    print 'Invoking the assember with the following command:  ' + cmd;
    print 'Invoking the assembler with the following command:  ' + cmd;
  cmdStatus = os.system(cmd);
  cmdStatus = os.system(cmd);
  if cmdStatus != 0:
  if cmdStatus != 0:
    raise SSBCCException('Running the assembler');
    raise SSBCCException('Running the assembler');
 
 
  # Read the assembler output tables.
  # Read the assembler output tables.
  fpAssemberOutput = open(assemblerOutput,'r');
  fpAssemberOutput = open(assemblerOutput,'rt');
  ixLine = 0;
  ixLine = 0;
  programBody = list();
  programBody = list();
  programBodyLength = 0;
  programBodyLength = 0;
  for line in fpAssemberOutput:
  for line in fpAssemberOutput:
    ixLine = ixLine + 1;
    ixLine = ixLine + 1;
Line 507... Line 513...
  execfile(ssbccGenFile);
  execfile(ssbccGenFile);
 
 
  rawCoreName = os.path.join(config.Get('corepath'),genCoreName());
  rawCoreName = os.path.join(config.Get('corepath'),genCoreName());
  if not os.path.isfile(rawCoreName):
  if not os.path.isfile(rawCoreName):
    raise SSBCCException('Core "%s% missing for hdl = "%s"' % (rawCoreName,config.Get('hdl'),));
    raise SSBCCException('Core "%s% missing for hdl = "%s"' % (rawCoreName,config.Get('hdl'),));
  fpRawCore = open(rawCoreName,'r');
  fpRawCore = open(rawCoreName,'rt');
 
 
  outName = genOutName(config.Get('outCoreName'));
  outName = genOutName(config.Get('outCoreName'));
  fpOutCore = open(outName,'wt');
  fpOutCore = open(outName,'wt');
 
 
  memFileName = re.sub(r'\.v.*','.mem',outName);
  memFileName = re.sub(r'\.v.*','.mem',outName);

powered by: WebSVN 2.1.0

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