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

Subversion Repositories tv80

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

/trunk/scripts/s80_convert.py
0,0 → 1,36
#!/usr/bin/env python
# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
import mem_image
import sys
 
ram_start = 0x8000
ram_end = 0xffff
rom_start = 0x0000
rom_end = 0x7fff
src_file = "tests/tvs80.ihx"
rom_file = "tests/tvs80_rom.vmem"
ram_file = "tests/tvs80_ram.vmem"
 
conv = mem_image.mem_image()
conv.load_ihex (src_file)
conv.save_vmem (rom_file, rom_start, rom_end)
conv.save_vmem (ram_file, ram_start, ram_end)
trunk/scripts/s80_convert.py Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/scripts/run =================================================================== --- trunk/scripts/run (revision 4) +++ trunk/scripts/run (revision 5) @@ -1,4 +1,23 @@ #!/usr/bin/env python +# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org) +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import sys, os
/trunk/scripts/ihex2mem.py
1,5 → 1,66
#!/usr/bin/env python
#
# Intel Hex to Verilog Memory format converter
#
# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
class mem_image:
def __init__ (self):
self.min = 100000
self.max = -1
self.map = {}
self.bcount = 0
 
def load_ihex (self, infile):
ifh = open (infile, 'r')
line = ifh.readline()
while (line != ''):
if (line[0] == ':'):
rlen = int(line[1:3], 16)
addr = int(line[3:7], 16)
rtyp = int(line[7:9], 16)
ptr = 9
for i in range (0, rlen):
laddr = addr + i
val = int(line[9+i*2:9+i*2+2], 16)
self.map[laddr] = val
self.bcount += 1
if (laddr > self.max): self.max = laddr
if (laddr < self.min): self.min = laddr
line = ifh.readline()
ifh.close()
 
def save_vmem (self, outfile, start=-1, stop=-1):
if (start == -1): start = self.min
if (stop == -1): stop = self.max
 
ofh = open (outfile, 'w')
for addr in range(start, stop+1):
if self.map.has_key (addr):
ofh.write ("@%02x %02x\n" % (addr, self.map[addr]))
ofh.close()
 
def ihex2mem (infile, outfile):
ifh = open (infile, 'r')
ofh = open (outfile, 'w')
30,8 → 91,11
infile = sys.argv[1]
outfile = sys.argv[2]
 
bc = ihex2mem (infile, outfile)
print "Converted %d bytes from %s to %s" % (bc, infile, outfile)
#bc = ihex2mem (infile, outfile)
conv = mem_image()
conv.load_ihex(infile)
conv.save_vmem(outfile)
print "Converted %d bytes from %s to %s" % (conv.bcount, infile, outfile)
if __name__ == '__main__':
cmdline()
/trunk/scripts/run2
0,0 → 1,38
#!/usr/bin/env python
# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
import sys, os
 
testname = sys.argv[1]
simulator = "cver"
 
filelist = " -f env/tb.vf"
testdef = " +incdir+env -l logs/%s.log +define+DUMPFILE_NAME=\\\"logs/%s.dump\\\" +define+ROM_FILE=\\\"tests/%s.vmem\\\" +define+RAM_FILE=\\\"tests/%s.vmem\\\"" % (testname, testname, testname+"_rom", testname+"_ram")
 
os.chdir ("tests")
os.system ("make %s.vmem" % testname)
os.chdir ("..")
 
command = simulator + filelist + testdef
 
print "command:",command
os.system (command)
 
trunk/scripts/run2 Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/scripts/mem_image.py =================================================================== --- trunk/scripts/mem_image.py (nonexistent) +++ trunk/scripts/mem_image.py (revision 5) @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org) +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +class mem_image: + def __init__ (self): + self.min = 100000 + self.max = -1 + self.map = {} + self.bcount = 0 + + def load_ihex (self, infile): + ifh = open (infile, 'r') + + line = ifh.readline() + while (line != ''): + if (line[0] == ':'): + rlen = int(line[1:3], 16) + addr = int(line[3:7], 16) + rtyp = int(line[7:9], 16) + ptr = 9 + for i in range (0, rlen): + laddr = addr + i + val = int(line[9+i*2:9+i*2+2], 16) + self.map[laddr] = val + self.bcount += 1 + if (laddr > self.max): self.max = laddr + if (laddr < self.min): self.min = laddr + + line = ifh.readline() + + ifh.close() + + def save_vmem (self, outfile, start=-1, stop=-1): + if (start == -1): start = self.min + if (stop == -1): stop = self.max + + ofh = open (outfile, 'w') + for addr in range(start, stop+1): + if self.map.has_key (addr): + ofh.write ("@%02x %02x\n" % (addr-start, self.map[addr])) + ofh.close() +

powered by: WebSVN 2.1.0

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