Skip to content

Commit f1d7143

Browse files
Aleksa MajkicAleksa Majkic
Aleksa Majkic
authored and
Aleksa Majkic
committed
TraceLineParser method added.
1 parent 35e63ce commit f1d7143

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

TraceGenerator/TraceGenerator.cs

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using System.Text;
6+
using CacheSimulation;
67
using Org.BouncyCastle.Crypto.Digests;
78
using Org.BouncyCastle.Crypto.Prng;
89
using Org.BouncyCastle.Security;
@@ -125,5 +126,16 @@ public bool GenerateTraceFile(int ramSize, int dataBlockSize)
125126
return false;
126127
}
127128
}
129+
130+
public Instruction TraceLineParser(string line)
131+
{
132+
char[] charsToTrim = { ' ', '0' };
133+
134+
return line[0] == 'L'
135+
? new Instruction(MemoryRelatedInstructions.Load, line.Split('\t')[1].Trim(' ').Substring(2).Trim(charsToTrim))
136+
: line[0] == 'S'
137+
? new Instruction(MemoryRelatedInstructions.Store, line.Split('\t')[1].Substring(2).Trim(charsToTrim), line.Split(',')[2].Trim(' ').Substring(2).Trim(charsToTrim))
138+
: throw new Exception("Unknown instruction used in trace file.");
139+
}
128140
}
129141
}

TraceGenerator/TraceGenerator.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,11 @@
5151
<ItemGroup>
5252
<None Include="packages.config" />
5353
</ItemGroup>
54+
<ItemGroup>
55+
<ProjectReference Include="..\CacheSimulation\CacheSimulation.csproj">
56+
<Project>{2AC77101-3E57-41ED-8A57-0AB22305D194}</Project>
57+
<Name>CacheSimulation</Name>
58+
</ProjectReference>
59+
</ItemGroup>
5460
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5561
</Project>

0 commit comments

Comments
 (0)