Commit 676922b0 authored by Iulian Gheorghiu's avatar Iulian Gheorghiu

Fix an issue that ended in exit with string array out of range when the hex...

Fix an issue that ended in exit with string array out of range when the hex file does not have the size equal with a multiply of -b argument.
parent b6653641
No preview for this file type
......@@ -109,15 +109,25 @@ namespace IntelHexToVerilogMem
{
List<string> outRom = new List<string>();
int cntOutRomInt = 0;
//File.Delete(outputPath);
for (; cntOutRomInt < rom.Count; cntOutRomInt += Convert.ToInt32(outHexGroupLenBytes, 10))
{
int cntOutRomByteInt = Convert.ToInt32(outHexGroupLenBytes, 10);
string tmp = "";
for(;cntOutRomByteInt > 0; cntOutRomByteInt--)
{
tmp += rom[cntOutRomInt + cntOutRomByteInt - 1];
if (cntOutRomInt + cntOutRomByteInt - 1 < rom.Count)
{
tmp += rom[cntOutRomInt + cntOutRomByteInt - 1];
}
else
{
tmp += "00";
}
}
outRom.Add(tmp);
//File.AppendAllText(outputPath, tmp + "\n");
}
File.WriteAllLines(outputPath, outRom.ToArray());
Environment.Exit(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment