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

Subversion Repositories openfire_core

Compare Revisions

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

Rev 3 → Rev 4

/trunk/utils/openfire_sim
0,0 → 1,47
+ +@PTX\`dhlp t +UEUEED$T$$uEEUEED$T$$uEEKU EED$T$$uEEU +E $,}u28D$$ &E $Dž1"ED$D$ +$Dž,E$htS,D$D$N$ED$D$ +88Dž&Ћ%!ЅLu 4DžuDž 4u9Dž48Dž 4u Džu Dž Džu3Dž48Dž  u348Dž Dž'Ћ%!ЅЃ Ѕt%u 4DžЃ Ѕt%t 4DžЃ Ѕt%y 4DžЃ Ѕt% 4DžЃ Ѕt%~ 4DžЃ Ѕt%x 4DžЃ!Ѕt +D$4$C$D$$$D$$$$4;uauDž4 u4 4~ +DD$$WE}u%D$$ DžDž9rtDD$D$D$ D$D$EE$u?D$D$D$ D$D$EE$Hu4D$D$ D$D$NE$u)D$ D$D$UE$uD$D$ZE$Dž0E$e[^_]ÐUWVS [ )Eu [^_]Ð&1֍G;}r [^_]Í'UWVS [v )EHt41G9}u@ [^_]ÐUSddtv'ЋuX[]USP[X[%02xabcdef123456789ABCDEF0xError! Breakpoint is not in Hex! %s +a +%s - OpenFire Instruction Set Simulator + + Usage: %s <-f rom_file> <-b breakpoint> <-c cycle_count> + where: + rom_file is a Microblaze text memory image from openfire_util.pl + breakpoint is a hex address (0x####) + cycle_count is the decimal number of cycles to run + +instr.romr-h--help-f-c-b-o-a +*** Could not open file %s. Giving up. *** +%xMEMORY OUT OF RANGE @ PC: 0x%x +MEMORY OUT OF RANGE @ PC: 0x +*** PC: Branching to + Writing to Register %2i + to Register %2i from DMEM addr 0x to DMem location wCould not open file %s. Giving up. +PH܁ + DxoЃoox΄ބ.>N^n~pGCC: (GNU) 4.0.2 20050725 (prerelease) (Debian 4.0.1-3)GCC: (GNU) 4.0.2 20050725 (prerelease) (Debian 4.0.1-3)GCC: (GNU) 3.3.6 (Debian 1:3.3.6-7)GCC: (GNU) 3.3.6 (Debian 1:3.3.6-7)GCC: (GNU) 4.0.2 20050725 (prerelease) (Debian 4.0.1-3)GCC: (GNU) 3.3.6 (Debian 1:3.3.6-7)GCC: (GNU) 4.0.2 20050725 (prerelease) (Debian 4.0.1-3)",/P ą$$f!y_IO_stdin_used…../sysdeps/i386/elf/start.S/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/glibc-2.3.5/csuGNU AS 2.16.1XąąjRweTintD`Ij[OV|/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csu/crti.S/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/glibc-2.3.5/csuGNU AS 2.16.1f</disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csu/crtn.S/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/glibc-2.3.5/csuGNU AS 2.16.1%% $ > $ > 4: ; I?  +&I%%T/ +../sysdeps/i386/elfstart.S01:"VWYX  +init.cr +/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csucrti.SP3,W#,:ą ,Wdd,,Wr +/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csucrtn.Sf init.cshort intGNU C 4.0.2 20050725 (prerelease) (Debian 4.0.1-3)long long intunsigned charlong long unsigned intshort unsigned int/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/glibc-2.3.5/csu_IO_stdin_used.symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.rel.plt.init.text.fini.rodata.eh_frame.ctors.dtors.jcr.dynamic.got.got.plt.data.bss.comment.debug_aranges.debug_pubnames.debug_info.debug_abbrev.debug_line.debug_str#(( 1HH7 ܁ ?Go$ToЃ0c l x up{,PP22 ``6dd6ll6tt6xx6@@7DD7H7 77S8xh9%9n<v<0>?'(F!9 (L(H܁Ѓ  +`dltx@D ! (/:ą dlt 0 hp)`7tC  /Yd? KxDd&3X C +*:J*\cDy~$d h   abi-note.S../sysdeps/i386/elf/start.Sinit.cinitfini.c/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csu/crti.Scall_gmon_startcrtstuff.c__CTOR_LIST____DTOR_LIST____JCR_LIST__p.0completed.1__do_global_dtors_auxframe_dummy__CTOR_END____DTOR_END____FRAME_END____JCR_END____do_global_ctors_aux/disk/hdc2/glibc/debian-build/glibc_2.3.5-6.build1/glibc-2.3.5/build-tree/i386-libc/csu/crtn.Sopenfire_sim.cHexPrintfeof@@GLIBC_2.0_DYNAMICstrcmp@@GLIBC_2.0_fp_hwfprintf@@GLIBC_2.0__fini_array_end__dso_handle__libc_csu_fini_init_startfgets@@GLIBC_2.0strlen@@GLIBC_2.0__fini_array_start__libc_csu_initmemcmp@@GLIBC_2.0__bss_startmainstring_to_hex__libc_start_main@@GLIBC_2.0__init_array_enddata_startprintf@@GLIBC_2.0_finifclose@@GLIBC_2.1exit@@GLIBC_2.0atoi@@GLIBC_2.0sscanf@@GLIBC_2.0_edata_GLOBAL_OFFSET_TABLE__endfopen@@GLIBC_2.1__init_array_start_IO_stdin_used__data_start_Jv_RegisterClassesprint_options__gmon_start__strcpy@@GLIBC_2.0 \ No newline at end of file
trunk/utils/openfire_sim Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/utils/openfire_bram.pl =================================================================== --- trunk/utils/openfire_bram.pl (nonexistent) +++ trunk/utils/openfire_bram.pl (revision 4) @@ -0,0 +1,163 @@ +#!/usr/bin/perl -w +############################################################ +# openfire_bram +# +# Initializes BRAMs with OpenFire code. +# +# Stephen Douglas Craven +# 1/17/2006 +# Configurable Computing Lab +# Virginia Tech +# +# History +# 1/17/2006 -- Added support for variable MB names +############################################################ + +# +# Globals +# +use vars qw/ %opt /; + +# +# Command line options processing +# +sub init() +{ + use Getopt::Std; + my $opt_string = 'o:n:t:f:b:hx:p:'; + getopts( "$opt_string", \%opt ) or usage(); + usage() if ($opt{h}); +} + +# +# Message about this program and how to use it +# +sub usage() +{ + print STDERR << "EOF"; + +This program creates a BMM file from an NCD and uses this to read and +write initial BRAM contents from a bitstream. + +NOTE: XDL and DATA2MEM must be installed and in the user's path. + +usage: $0 [-h] [-n NCD_FILE -o BMM_FILE] [-r ROM_FILE -b BITSTREAM] + + -h : this (help) message + -n NCD_FILE : NCD_FILE containing placed BRAMs (default = implementation/system.ncd) + -o BMM_FILE : BMM_FILE to create (default = implementation/openfire.bmm) + -t top-level module : name of the top-level OpenFire module (default = openfire) + -f ELF_FILE : ELF file to place in OpenFire memory (optional) + -b BITSTREAM : bitstream to update with BRAM contents (default = implementation/download.bit) + -x XDL_FILE : use specified XDL file (w/o flag, generates own from NCD_FILE) + -p # : number of processors in design; named top-level_module0, top-level_module1, etc. + (default = 1) + +example: $0 -n system.ncd -o system.bmm -f openfire.elf -b download.bit +example: $0 -o system.bmm -p 4 -t vtmb_ + +EOF +exit; +} + +init(); + +# Fill in Default Values +if($opt{t}) { + $top_level_name = $opt{t}; +} else { + $top_level_name = "openfire"; +} +if($opt{n}) { + $ncd_file = $opt{n}; +} else { + $ncd_file = "implementation/system.ncd"; +} +if($opt{o}) { + $output_bmm = $opt{o}; +} else { + $output_bmm = "implementation/openfire.bmm"; +} +if($opt{b}) { + $bitstream = $opt{b}; +} else { + $bitstream = "implementation/download.bit"; +} +if($opt{p}) { + $num_processors = $opt{p}; +} else { + $num_processors = 1; +} +# An XDL file is a textual representation of an NCD file +# An NCD file, after PAR< contains the physical locations of all components +# We need to know where PAR placed the OpenFire BRAMs, so we create and parse an XDL file +$xdl_file = $ncd_file; +$xdl_file =~ s/ncd/xdl/; +if($opt{x}) +{ + # If an XDL file is specified, check if its there + if(-r $opt{x}) + { + $xdl_file = $opt{x}; + } else { + print "ERROR! Specifiec XDL File $opt{x} cannot be read! Exiting \n"; + exit(0); + } +} elsif (-r $xdl_file) # if no XDL file given, search for default one +{ +} else { # can't find an XDL file, so create one + system("xdl -ncd2xdl $ncd_file $xdl_file"); +} + +# DATA2MEM needs a BMM File to describe the memory layout and BRAM physical locations +# We will make a BMM file using information from the XDL file +open(bmm_file, ">$output_bmm"); + +# Loop for each processor +for($count = 0; $count < $num_processors; $count++) +{ + $processor_name = $top_level_name.$count.'/'; + # Get BRAM locations by searching for all BRAMs linked to a specific OpenFire + # These BRAMs then get sorted to (hopefully) insure that the program is loaded correctly +# $brams = `grep inst $xdl_file | grep RAMB16 | grep $processor_name | sort +1 -n -t B`; + $brams = `grep inst $xdl_file | grep RAMB16 | grep $processor_name | grep -v "i.*_ila\/" | sort +1 -n -t B`; + + $i = 0; + # Loop over each BRAM discovered above + foreach $_ (split(/\n/, $brams)){ + # We need the name of the BRAM and its location + if(/inst \"($top_level_name[\w\d_\/]+)\".*RAMB16_([\w\d]+)/) { + $mem[$i] = $1; + $location[$i] = $2; + $i++; + } + } + $num_brams = $i; + + # Create BMM File for Data2mem + $size = 2048 * $i -1; # each BRAM is 2048 Bytes + printf bmm_file ("ADDRESS_SPACE lmb_bram_$count RAMB16 [0x00000000:0x0000%X]\n", $size); + print bmm_file " BUS_BLOCK\n"; + + $msb = 31; + for ($i = $num_brams - 1; $i >= 0; $i--) { + $lsb = $msb - 32 / $num_brams + 1; + print bmm_file " $mem[$i] [$msb:$lsb] PLACED = $location[$i];\n"; + $msb = $lsb - 1; + } + print bmm_file " END_BUS_BLOCK;\n"; + print bmm_file "END_ADDRESS_SPACE;\n"; +} + +close(bmm_file); + +# Test BMM File for Correctness +$error = `data2mem -bm $output_bmm`; +if(!$error and $opt{f}) { + # Populate BRAM with ELF contents + system("data2mem -bm ".$output_bmm." -bd ".$opt{f}." -bt ".$bitstream." -o b tmp666.bit"); + system("mv tmp666.bit ".$bitstream); +} elsif($error) { + print "$error"; + print "Error in BMM File! Sorry!\n"; +}
trunk/utils/openfire_bram.pl Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/utils/create_array.pl =================================================================== --- trunk/utils/create_array.pl (nonexistent) +++ trunk/utils/create_array.pl (revision 4) @@ -0,0 +1,219 @@ +#!/usr/bin/perl +############################################################################## +# create_array.pl +# +# Creates EDK input files needed to create an array of OpenFire processors. +# +# Stephen Douglas Craven +# modified 11/18/2005 +# Virginia Tech +# +# WARNING! This script may break with newer / older versions of the EDK. +# Works with 7.1. +# +############################################################################## + +# Globals +use vars qw/ %opt /; + +# Command line options processing +sub init() +{ + use Getopt::Std; + my $opt_string = 'hn:m:p:'; + getopts( "$opt_string", \%opt ) or usage(); + usage() if ($opt{h} or !$opt{n} or ($opt{n} < 1)); +} + +# Message about this program and how to use it +sub usage() +{ + print STDERR << "EOF"; + +This program modifies an EDK MHS file instantiating and connecting +the specified number of OpenFires in an array controlled by the MicroBlaze +master. Currently only unidirectional ring networks are supported. + +Also modifies a MSS file for the master MB. + +usage: $0 [-h] -n # <-d> <-o filename> + + -h : this (help) message + -n # : positive number of processors in the array (not counting master node) + -m MB_instance_name : instance name of master MicroBlaze (default = microblaze_0) + -p project_name : name of project (default = system) + +example: $0 -n 16 -m microblaze_0 -p system + +EOF +exit(0); +} + +############################################# +# Begin MHS file component declarations +# This script works by adding FSL links +# and OpenFires to existing MHS / MSS +# files. +############################################# +$fsl_bus1 = "BEGIN fsl_v20 + PARAMETER INSTANCE = "; +$fsl_bus2 =" PARAMETER HW_VER = 2.00.a + PARAMETER C_EXT_RESET_HIGH = 0 + PARAMETER C_FSL_DEPTH = 1 + PORT FSL_Clk = sys_clk_s + PORT SYS_Rst = sys_rst_s +END +"; + +$openfire_instance1 = "BEGIN openfire_top_syn + PARAMETER INSTANCE = "; +$openfire_instance2 = " BUS_INTERFACE SFSL = "; +$openfire_instance3 = " BUS_INTERFACE MFSL = "; +$openfire_instance4 = " PORT clock = sys_clk_s + PORT reset = sys_rst_s +END +"; + + +# Begin MSS file declarations +$mss_openfire = " + +BEGIN DRIVER + PARAMETER DRIVER_NAME = generic + PARAMETER DRIVER_VER = 1.00.a + PARAMETER HW_INSTANCE = openfire"; + +init(); + +# setup MHS filehandler +if($opt{p}) { + $outputfile = $opt{p}.".mhs"; +} else { + $outputfile = "system.mhs"; +} + +# setup master MB name +if($opt{m}) { + $master_mb = $opt{m}; +} else { + $master_mb = "microblaze_0"; +} + +# Open MHS file for appending first... write OpenFires and FSLs to end of file +open(mhs_file, ">>$outputfile") || die("Could not open file $outputfile!"); + +# Create Backup of file before we modify it +system("cp $outputfile create_array_bck.mhs"); + +# Add master Nodes's FSL buses +print mhs_file $fsl_bus1."fsl_MB_slave\n"; +print mhs_file $fsl_bus2."\n"; +print mhs_file $fsl_bus1."fsl_MB_master\n"; +print mhs_file $fsl_bus2."\n"; + +# Loop over the processors +for($i = 0; $i < $opt{n}; $i++) +{ + $node_num = "openfire".$i; + $node_num_prev = "openfire".($i-1); + $fsl_master = "fsl_".$node_num."_master\n"; + $fsl_slave = "fsl_".$node_num_prev."_master\n"; + # Add each processor to the MHS + print mhs_file $openfire_instance1.$node_num."\n"; + # Depending on the location of the processor in the ring network, + # connect its FSL links to different interfaces (OpenFire or MicroBlaze) + + # Both FSLs connect to Master + if($opt{n} == 1) { + print mhs_file $openfire_instance2."fsl_MB_master\n"; + print mhs_file $openfire_instance3."fsl_MB_slave\n"; + print mhs_file $openfire_instance4."\n"; + # No FSLs connect to master + } elsif(($i != 0) & ($i != ($opt{n}-1))) { + print mhs_file $openfire_instance2.$fsl_slave; + print mhs_file $openfire_instance3.$fsl_master; + print mhs_file $openfire_instance4."\n"; + print mhs_file $fsl_bus1.$fsl_master; + print mhs_file $fsl_bus2."\n"; + # Slave FSL connects to Master + } elsif($i == 0) { + print mhs_file $openfire_instance2."fsl_MB_master\n"; + print mhs_file $openfire_instance3.$fsl_master; + print mhs_file $openfire_instance4."\n"; + print mhs_file $fsl_bus1.$fsl_master; + print mhs_file $fsl_bus2."\n"; + # Master FSL connects to Master + } else { + print mhs_file $openfire_instance2.$fsl_slave; + print mhs_file $openfire_instance3."fsl_MB_slave\n"; + print mhs_file $openfire_instance4."\n"; + } +} +close(mhs_file); + +# Must add FSL interfaces to master MB +# Open file again for reading +open(mhs_file, $outputfile) || die("Could not open file $outputfile!"); + +# hopefully read in entire file +@lines=; + +# go ahead and close the file +close(mhs_file); + +$master_fsl_parameters = " PARAMETER C_FSL_LINKS = 1 + BUS_INTERFACE SFSL0 = fsl_MB_slave + BUS_INTERFACE MFSL0 = fsl_MB_master + "; + +# search for master MB to add FSL interfaces to it +# This could be improved +$master_found = 0; +$complete = 0; +$output = ""; +foreach $line (@lines) +{ + $_ = $line; + if(/$master_mb/) + { + $master_found = 1; + $output = $output.$line; + } elsif($master_found & /BUS_INTERFACE/) + { + $output = $output.$master_fsl_parameters.$line; + $master_found = 0; + $complete = 1; + }else{ + $output = $output.$line; + } +} +if(!$complete) +{ + die("Could not find the $master_mb instance!"); +} + +# Open file again for overwriting +open(mhs_file, ">$outputfile") || die("Could not open file $outputfile!"); +# We overwrite the entire file with our modified system that includes FSL interfaces for the MB +print mhs_file $output; +close(mhs_file); + +# find output MSS file +if($opt{p}) { + $outputfile = $opt{p}.".mss"; +} else { + $outputfile = "system.mss"; +} + +# Create backup +system("cp $outputfile create_array_bck.mss"); + +# write OpenFire drivers to MSS file +open(mss_file, ">>$outputfile") || die("Could not open file $outputfile!"); +print mss_file $mss_header; +for($i = 0; $i < $opt{n}; $i++) +{ + print mss_file $mss_openfire.$i."\n END\n"; +} +close(mss_file); +exit;
trunk/utils/create_array.pl Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/utils/openfire_util.pl =================================================================== --- trunk/utils/openfire_util.pl (nonexistent) +++ trunk/utils/openfire_util.pl (revision 4) @@ -0,0 +1,216 @@ +#!/usr/bin/perl +############################################################ +# openfire_util +# +# Provides compilation functions for OpenFire. +# +# Stephen Douglas Craven +# 1/17/2006 +# Configurable Computing Lab +# Virginia Tech +############################################################ + +# Globals +use vars qw/ %opt /; + +# Command line options processing +sub init() +{ + use Getopt::Std; + my $opt_string = 'hcmd:f:a:p:n:'; + getopts( "$opt_string", \%opt ) or usage(); + usage() if ($opt{h} or !$opt{f} or ($opt{d} and !$opt{a}) or $opt{C}); +} + +# Message about this program and how to use it +sub usage() +{ + print STDERR << "EOF"; + +This program compiles a MicroBlze C program and converts the resulting +ELF file into a memory image (.ROM file) for use by openfire_sim and +verilog simlulators. + +NOTE: XMD must be installed and in the user's path. + +usage: $0 [-h] -f file <-d data_file address> -p + + -h : this (help) message + -d data : optional data file -- MUST be paired with -a flag + -a address : optional hex address (0x####) for data file + -f file : MicroBlaze C file + -c : create a rom file (.rom) for openfire_sim and verilog sim + -p directory : XPS project directory: make -f system.make libs must be already run! + -m : use hardware multiplier + -n master_name : name of master MicroBlaze (default: microblaze_0) + +example: $0 -f file.c -d data.dat -a 0x1234 + +EOF +exit; +} + +init(); + +# Fill in default values +if($opt{n}) { + $microblaze_name = $opt{n}; +} else { + $microblaze_name = microblaze_0; +} + +# Parse path to file to get filename +$_ = $opt{f}; +@path = split(/\//); +@htap = reverse(@path); +$_ = $htap[0]; +($filename, $extension) = split(/\./); +# Make sure its a C file first +usage() if ($extension ne "c"); + +# If file doesn't exist, raise error +unless (-e $opt{f}) { + print STDERR $opt{f}." NOT Found!\n"; + exit; +} + +# Create GCC command to compile C program +# Requires that libraries are previously compiled +$gcc_command = "mb-gcc ".$opt{f}." -O2 -o of_executable.elf \\\n"; +$gcc_command = $gcc_command." -I".$opt{p}."/".$microblaze_name."/include/ -I".$opt{p}."/code/ \\\n"; +# If we have a HW multiplier, use it +if($opt{m}) { + $gcc_command = $gcc_command." -mno-xl-soft-mul \\\n"; +} +$gcc_command = $gcc_command." -L".$opt{p}."/".$microblaze_name."/lib/ -xl-mode-executable"; + +print $gcc_command."\n"; +# Compile code +system($gcc_command); + +# Make sure compilation succeeded +unless (-e "of_executable.elf") { + print STDERR "of_executable.elf NOT Found! Compilation Failed!\n"; + exit; +} + +# Stop here, unless user wants a ROM file as well for simulation +unless($opt{c}) {exit(0);} + +#################################################################################### +# A ROM file is a simple file showing the hex value of each memory location on +# a separate line. This is useful for Verilog simulators, which can read +# this format with a $readmemh. The openfire_sim C simulator also reads +# this format. +# +# Sample ROM file: +# A123B456 +# C321D654 +# and so on +#################################################################################### + +# If the user wants to add data to the ROM file, examine the file to determine size +if ($opt{d}) { + if (-e $opt{d}) + { + ( $dev, $ino, $mode, $nlink, + $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, + $blksize, $blocks ) = stat($opt{d}); + } else { + print STDERR "File ".$opt{d}." NOT Found!\n"; + exit; + } +} + +# We need the maximum memory size, so convert provided address from hex to decimal +# and add the size of the data file (found above) to that +if ($opt{a}) { + $max_mem = oct($opt{a}) + $size + 10; +} else { # no address / data file provided; base size of ROM file on executable + ( $dev, $ino, $mode, $nlink, + $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, + $blksize, $blocks ) = stat("of_executable.elf"); + $max_mem = $size/2; # guestimate on program size based on ELF size +} + +#################################################################################### +# The ROM file is created by loading the ELF file into the XMD MicroBlaze simulator. +# The memory of the simulator is then dumped into a text file. This is sort of +# a hack, but it is much easier than parsing the ELF file myself -- I am certain +# not to make mistakes about where text and data sections go. +#################################################################################### +# Create a TCL script for XMD +open(tcl_file, ">tmp666.tcl"); +print tcl_file "xconnect mb sim\n"; +print tcl_file "xdownload 0 of_executable.elf\n"; +print tcl_file "xdownload 0 -data ".$opt{d}." ".$opt{a}."\n" if $opt{d}; +print tcl_file "set hope [xrmem 0 0 ".$max_mem."]\n"; +print tcl_file "puts \$hope\n"; +close(tcl_file); + +# Execute the TCL script, capturing the output +$xmd_cmd = "xmd -tcl tmp666.tcl"; +$xmd_output = `$xmd_cmd`; + +# Parse the output to just capture the memory data +################################################################## +# WARNING! This is likely to change with different XMD versions! # +################################################################## +$flag = 0; +foreach $_ (split(/\n/, $xmd_output)){ + if ($flag){ + @output = split(/ /, $_); + } + if ( $_ =~/Setting PC/) {$flag = 1;} +} + +# Open a file to write results +binmode rom_file; +open(rom_file, ">$filename.rom"); + +# Print memory contents in hex +$count = 0; +foreach $number (@output) { + if ($number =~/\d/) { + $hex[$count] = sprintf("%X", $number); + if($number < 16) { + $hex[$count] = "0".$hex[$count]; + } + $count++; + } + if ($count == 4) { + $count = 0; + printf rom_file $hex[0].$hex[1].$hex[2].$hex[3]."\n"; + } +} +close(rom_file); + +# Remove the TCL script we created +system("rm tmp666.tcl"); +exit; + +# Stuff below is old for making COE coregen files +# Needs rework +if($opt{c} | $opt{C}) { + open(coe_file, ">$filename.coe"); + open(rom_file, "$filename.rom"); + print coe_file "memory_initialization_radix=16;\n"; + $reset = 1; + while(){ + if ($reset > 0) { + chomp($_); + print coe_file "memory_initialization_vector= $_"; + } + else { + chomp($_); + print coe_file ", ".$_; + } + $reset = 0; + } + print coe_file ";\n"; + close(coe_file); + close(rom_file); +} +
trunk/utils/openfire_util.pl Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property

powered by: WebSVN 2.1.0

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