OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [tools/] [PythonAssembler/] [pasm.py] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
# PATLPP Assembler
2
 
3
import sys
4
 
5
if (len(sys.argv) < 2):
6
        print 'Usage: pasm <input file> [output file]'
7
        exit()
8
 
9
infilename = sys.argv[1]
10
if (len(sys.argv) > 2): outfilename = sys.argv[2]
11
else: outfilename = "out.v"
12
 
13
infile = open(sys.argv[1])
14
pc = 0
15
labels = dict()
16
 
17
for line in infile:
18
        line = line.strip()
19
 
20
        if line.startswith(('IN(','OUT(','BYP(','CSA(','CSC(','JMP(','RST(','ADD(','SUB(','MOV(','SRAP2R(')):
21
                pc += 1
22
        elif line.startswith('#:'):
23
                print "// ", line
24
                label = line[2:]
25
                label = label.strip(' ')
26
                labels[label] = pc
27
 
28
print "// labels: ", labels
29
execfile(sys.argv[1], labels)

powered by: WebSVN 2.1.0

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