Commit d2c203d1 authored by Талибов Сэрхан Махмад Оглы's avatar Талибов Сэрхан Махмад Оглы
Browse files

Half of the second microservice is done (probably (forgot to stage in the previous commit))

1 merge request!12 of 4 services are donwe
Showing with 584 additions and 153 deletions
+584 -153
This diff is collapsed.
......@@ -2,7 +2,7 @@
"profiles": {
"Broker": {
"commandName": "Project",
"commandLineArgs": "--project -n"
"commandLineArgs": "--project -l C:/Users/Serha/Desktop/kal -n megakal -e"
}
}
}
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Broker")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d4074d08fff797ac9229867ba9a156476d67ecac")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+272b3d7e1e9abd8e8a16683e8f351ddb6cabeaea")]
[assembly: System.Reflection.AssemblyProductAttribute("Broker")]
[assembly: System.Reflection.AssemblyTitleAttribute("Broker")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
5f6ac5b105b355809a1aff441a26349831b2ecc8b139c18c49aa2f3331acbf81
3fc8fca2fbc47279f495dcc96014801f59410df4bdf9bea53c5ad64db1d36e55
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graph_verilog_generator", "Graph_verilog_generator\Graph_verilog_generator.csproj", "{68AA1BBD-6B31-40D4-BC74-5371E2242388}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68AA1BBD-6B31-40D4-BC74-5371E2242388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68AA1BBD-6B31-40D4-BC74-5371E2242388}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68AA1BBD-6B31-40D4-BC74-5371E2242388}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68AA1BBD-6B31-40D4-BC74-5371E2242388}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {21362C82-333C-4D3F-82C0-6662721FD81D}
EndGlobalSection
EndGlobal
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Shared\Graph.cs" Link="Graph.cs" />
<Compile Include="..\..\Shared\GraphCirculant.cs" Link="GraphCirculant.cs" />
<Compile Include="..\..\Shared\GraphMesh.cs" Link="GraphMesh.cs" />
<Compile Include="..\..\Shared\GraphTorus.cs" Link="GraphTorus.cs" />
<Compile Include="..\..\Shared\IRectangleLike.cs" Link="IRectangleLike.cs" />
<Compile Include="..\..\Shared\IRoundLike.cs" Link="IRoundLike.cs" />
<Compile Include="..\..\Shared\ProjectSettings.cs" Link="ProjectSettings.cs" />
<Compile Include="..\..\Shared\Settings.cs" Link="Settings.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="9.0.2" />
</ItemGroup>
</Project>
using System;
using System.Text.Json;
using System.Xml.Linq;
namespace HDLNoCGen
{
static class Program
{
static void Main(string[] args)
{
string location = "C:/Users/Serha/Desktop/kal";
string name = "kal";
string topology = "";
List<int> generators = new List<int>();
string queue_type = "pointer";
string queue_position = "front";
string arbiter_type = "round_robin";
string algorithm = "xy";
int info_width = 8;
int queue_length = 4;
bool create_verilog = false;
Graph graph = null;
router_options parameters = new router_options();
string graph_filename = "";
CancellationTokenSource GeneralPurposeCancellationTokenSource = new CancellationTokenSource();
CancellationToken GeneralPurposeCancellationToken = GeneralPurposeCancellationTokenSource.Token;
try
{
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-l":
case "--location":
location = args[++i];
break;
case "-n":
case "--name":
name = args[++i];
break;
case "c":
topology = "c";
break;
case "m":
topology = "m";
break;
case "t":
topology = "t";
break;
case "--queue_type":
queue_type = args[++i];
break;
case "--queue_position":
queue_position = args[++i];
break;
case "--arbiter_type":
arbiter_type = args[++i];
break;
case "--algorithm":
algorithm = args[++i];
break;
case "--info_width":
try
{
info_width = Convert.ToInt32(args[++i]);
}
catch (Exception e)
{
Console.WriteLine("--info_width must be a number");
Environment.Exit(1);
}
break;
case "--queue_length":
try
{
queue_length = Convert.ToInt32(args[++i]);
}
catch (Exception e)
{
Console.WriteLine("--queue_lenght must be a number");
Environment.Exit(1);
}
break;
case "-v":
case "--verilog":
create_verilog = true;
break;
default:
try
{
generators.Add(Convert.ToInt32(args[i]));
}
catch (Exception e)
{
Console.WriteLine($"Argument {args[i]} is invalid");
}
break;
}
}
}
catch (IndexOutOfRangeException e)
{
Console.WriteLine("No argument after an option that requires an argument");
Environment.Exit(1);
}
switch (topology)
{
case "c":
graph = new GraphCirculant();
break;
case "m":
graph = new GraphMesh();
break;
case "t":
graph = new GraphTorus();
break;
default:
Console.WriteLine($"Topology {topology} does not exit");
Environment.Exit(1);
break;
}
graph.InstallGenerators(generators, GeneralPurposeCancellationToken);
graph_filename += $"{info_width}_bit";
switch (graph.id())
{
case GraphType.Circulant:
graph_filename += "__circulant";
graph_filename += $"_{graph.node_count}_" + String.Join("_", graph.generators.Slice(0, graph.generators.Count - 1).Select(s => $"{s}"));
break;
case GraphType.Mesh:
graph_filename += "__mesh";
graph_filename += $"_{graph.node_count}_" + String.Join("_", graph.generators.Select(s => $"{s}"));
break;
case GraphType.Torus:
graph_filename += "__torus";
graph_filename += $"_{graph.node_count}_" + String.Join("_", graph.generators.Select(s => $"{s}"));
break;
default:
Console.WriteLine($"Graph type {graph.id} was not implemented into this switch statement.");
Environment.Exit(1);
break;
}
switch (queue_type)
{
case "index":
parameters.queue_type = RouterOptions.Queue_types.Index;
graph_filename += $"__indexQueue_{queue_length}_long";
break;
case "pointer":
parameters.queue_type = RouterOptions.Queue_types.Pointer;
graph_filename += $"__pointerQueue_{queue_length}_long";
break;
case "line":
parameters.queue_type = RouterOptions.Queue_types.Line;
graph_filename += $"__lineQueue_{queue_length}_long";
break;
default:
Console.WriteLine($"Queue type '{queue_length}' does not exist. It should be either 'index', 'pointer' or 'line'.");
Environment.Exit(1);
break;
}
switch (queue_position)
{
case "front":
parameters.queue_position = RouterOptions.Queue_position.Front;
graph_filename += "_front";
break;
case "rear":
parameters.queue_position = RouterOptions.Queue_position.Rear;
graph_filename += "_rear";
break;
default:
Console.WriteLine($"Queue position '{queue_position}' does not exist. It should be either 'front' or 'rear'.");
Environment.Exit(1);
break;
}
switch (arbiter_type)
{
case "round_robin":
parameters.arbiter_type = RouterOptions.Arbiter_types.Round_Robin;
graph_filename += "__arbRoundRobin";
break;
default:
Console.WriteLine($"Arbiter type '{queue_position}' does not exist. It should be either 'front' or 'rear'.");
Environment.Exit(1);
break;
}
switch (algorithm)
{
case "xy":
graph_filename += "__xy";
switch (graph.id())
{
case GraphType.Mesh:
parameters.algorithm = RouterOptions.Algorithm.XY;
break;
case GraphType.Torus:
parameters.algorithm = RouterOptions.Algorithm.XY;
break;
default:
Console.WriteLine($"Graph type {graph.id} was not implemented into this switch statement.");
Environment.Exit(1);
break;
}
break;
case "ga":
parameters.algorithm = RouterOptions.Algorithm.GA;
graph_filename += "__ga";
break;
default:
Console.WriteLine($"Algorithm '{algorithm}' does not exist. It should be either 'xy' or 'ga'.");
Environment.Exit(1);
break;
}
switch (graph.id())
{
case GraphType.Circulant:
parameters.packet_width = 1 + graph.get_bits(graph.node_count) + info_width;
break;
case GraphType.Mesh:
case GraphType.Torus:
parameters.packet_width = 1 + 2 * graph.get_bits(generators[1]) + info_width;
break;
}
parameters.queue_length = queue_length;
parameters.info_width = info_width;
graph.parameters = parameters;
string json = "";
switch (graph.id())
{
case GraphType.Circulant:
json = JsonSerializer.Serialize<GraphCirculant>(graph as GraphCirculant, new JsonSerializerOptions { WriteIndented = true });
break;
case GraphType.Mesh:
json = JsonSerializer.Serialize<GraphMesh>(graph as GraphMesh, new JsonSerializerOptions { WriteIndented = true });
break;
case GraphType.Torus:
json = JsonSerializer.Serialize<GraphTorus>(graph as GraphTorus, new JsonSerializerOptions { WriteIndented = true });
break;
}
using (StreamWriter sw = new StreamWriter($"{location}/{graph_filename}.json"))
{
sw.Write(json);
}
}
}
}
\ No newline at end of file
{
"profiles": {
"Graph_verilog_generator": {
"commandName": "Project",
"commandLineArgs": "m 3 3"
}
}
}
\ No newline at end of file
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Graph_verilog_generator/1.0.0": {
"dependencies": {
"System.Security.Cryptography.ProtectedData": "9.0.2"
},
"runtime": {
"Graph_verilog_generator.dll": {}
}
},
"System.Security.Cryptography.ProtectedData/9.0.2": {
"runtime": {
"lib/net8.0/System.Security.Cryptography.ProtectedData.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.225.6610"
}
}
}
}
},
"libraries": {
"Graph_verilog_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"System.Security.Cryptography.ProtectedData/9.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-+z9JWtU9di45tW/w6zpuJms4SnAAqKY2Usmmxs7MpOhxWoIeR2pKl1vEkaFbEx52ZfrMFcZXsFe+8WERMozzGg==",
"path": "system.security.cryptography.protecteddata/9.0.2",
"hashPath": "system.security.cryptography.protecteddata.9.0.2.nupkg.sha512"
}
}
}
\ No newline at end of file
File added
File added
File added
Supports Markdown
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