Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"visualstudiotoolsforunity.vstuc"
]
}
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
}
]
}
70 changes: 70 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.vs": true,
"**/.gitmodules": true,
"**/.vsconfig": true,
"**/*.booproj": true,
"**/*.pidb": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.pdf": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.wav": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"build/": true,
"Build/": true,
"Library/": true,
"library/": true,
"obj/": true,
"Obj/": true,
"Logs/": true,
"logs/": true,
"ProjectSettings/": true,
"UserSettings/": true,
"temp/": true,
"Temp/": true
},
"files.associations": {
"*.asset": "yaml",
"*.meta": "yaml",
"*.prefab": "yaml",
"*.unity": "yaml",
},
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.sln": "*.csproj",
},
"dotnet.defaultSolution": "Digital-Logic-Sim.sln"
}
26 changes: 22 additions & 4 deletions Assets/Scripts/Description/Helpers/ChipTypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ public static class ChipTypeHelper
{ ChipType.TriStateBuffer, "3-STATE BUFFER" },
// ---- Memory ----
{ ChipType.dev_Ram_8Bit, "dev.RAM-8" },
{ ChipType.Rom_256x2x8, $"ROM 256{mulSymbol}x2x8" },
{ ChipType.Rom_256x16, $"ROM 256{mulSymbol}16" },
{ ChipType.Rom_256x32, $"ROM 256{mulSymbol}32" },
// ---- Split / Merge ----
{ ChipType.Split_4To1Bit, "4-1BIT" },
{ ChipType.Split_8To1Bit, "8-1BIT" },
{ ChipType.Split_8To4Bit, "8-4BIT" },
{ ChipType.Split_16To1Bit, "16-1BIT" },
{ ChipType.Split_16To4Bit, "16-4BIT" },
{ ChipType.Split_16To8Bit, "16-8BIT" },
{ ChipType.Merge_4To8Bit, "4-8BIT" },
{ ChipType.Merge_1To8Bit, "1-8BIT" },
{ ChipType.Merge_1To4Bit, "1-4BIT" },
{ ChipType.Merge_1To16Bit, "1-16BIT" },
{ ChipType.Merge_4To16Bit, "4-16BIT" },
{ ChipType.Merge_8To16Bit, "8-16BIT" },

// ---- Displays -----
{ ChipType.DisplayRGB, "RGB DISPLAY" },
{ ChipType.DisplayDot, "DOT DISPLAY" },
{ ChipType.SevenSegmentDisplay, "7-SEGMENT" },
{ ChipType.DisplayLED, "LED" },
{ ChipType.DisplayRGBLED, "RGBLED" },

{ ChipType.Buzzer, "BUZZER" },

Expand All @@ -39,28 +48,32 @@ public static class ChipTypeHelper
{ ChipType.In_1Bit, "IN-1" },
{ ChipType.In_4Bit, "IN-4" },
{ ChipType.In_8Bit, "IN-8" },
{ ChipType.In_16Bit, "IN-16" },
{ ChipType.Out_1Bit, "OUT-1" },
{ ChipType.Out_4Bit, "OUT-4" },
{ ChipType.Out_8Bit, "OUT-8" },
{ ChipType.Out_16Bit, "OUT-16" },
{ ChipType.Key, "KEY" },
// ---- Buses ----
{ ChipType.Bus_1Bit, "BUS-1" },
{ ChipType.Bus_4Bit, "BUS-4" },
{ ChipType.Bus_8Bit, "BUS-8" },
{ ChipType.Bus_16Bit, "BUS-16" },
{ ChipType.BusTerminus_1Bit, "BUS-TERMINUS-1" },
{ ChipType.BusTerminus_4Bit, "BUS-TERMINUS-4" },
{ ChipType.BusTerminus_8Bit, "BUS-TERMINUS-8" }
{ ChipType.BusTerminus_8Bit, "BUS-TERMINUS-8" },
{ ChipType.BusTerminus_16Bit, "BUS-TERMINUS-16" }
};

public static string GetName(ChipType type) => Names[type];

public static bool IsBusType(ChipType type) => IsBusOriginType(type) || IsBusTerminusType(type);

public static bool IsBusOriginType(ChipType type) => type is ChipType.Bus_1Bit or ChipType.Bus_4Bit or ChipType.Bus_8Bit;
public static bool IsBusOriginType(ChipType type) => type is ChipType.Bus_1Bit or ChipType.Bus_4Bit or ChipType.Bus_8Bit or ChipType.Bus_16Bit;

public static bool IsBusTerminusType(ChipType type) => type is ChipType.BusTerminus_1Bit or ChipType.BusTerminus_4Bit or ChipType.BusTerminus_8Bit;
public static bool IsBusTerminusType(ChipType type) => type is ChipType.BusTerminus_1Bit or ChipType.BusTerminus_4Bit or ChipType.BusTerminus_8Bit or ChipType.BusTerminus_16Bit;

public static bool IsRomType(ChipType type) => type == ChipType.Rom_256x16;
public static bool IsRomType(ChipType type) => type is ChipType.Rom_256x2x8 or ChipType.Rom_256x16 or ChipType.Rom_256x32;

public static ChipType GetCorrespondingBusTerminusType(ChipType type)
{
Expand All @@ -69,6 +82,7 @@ public static ChipType GetCorrespondingBusTerminusType(ChipType type)
ChipType.Bus_1Bit => ChipType.BusTerminus_1Bit,
ChipType.Bus_4Bit => ChipType.BusTerminus_4Bit,
ChipType.Bus_8Bit => ChipType.BusTerminus_8Bit,
ChipType.Bus_16Bit => ChipType.BusTerminus_16Bit,
_ => throw new Exception("No corresponding bus terminus found for type: " + type)
};
}
Expand All @@ -82,6 +96,7 @@ public static ChipType GetPinType(bool isInput, PinBitCount numBits)
PinBitCount.Bit1 => ChipType.In_1Bit,
PinBitCount.Bit4 => ChipType.In_4Bit,
PinBitCount.Bit8 => ChipType.In_8Bit,
PinBitCount.Bit16 => ChipType.In_16Bit,
_ => throw new Exception("No input pin type found for bitcount: " + numBits)
};
}
Expand All @@ -91,6 +106,7 @@ public static ChipType GetPinType(bool isInput, PinBitCount numBits)
PinBitCount.Bit1 => ChipType.Out_1Bit,
PinBitCount.Bit4 => ChipType.Out_4Bit,
PinBitCount.Bit8 => ChipType.Out_8Bit,
PinBitCount.Bit16 => ChipType.Out_16Bit,
_ => throw new Exception("No output pin type found for bitcount: " + numBits)
};
}
Expand All @@ -105,6 +121,8 @@ public static (bool isInput, bool isOutput, PinBitCount numBits) IsInputOrOutput
ChipType.Out_4Bit => (false, true, PinBitCount.Bit4),
ChipType.In_8Bit => (true, false, PinBitCount.Bit8),
ChipType.Out_8Bit => (false, true, PinBitCount.Bit8),
ChipType.In_16Bit => (true, false, PinBitCount.Bit16),
ChipType.Out_16Bit => (false, true, PinBitCount.Bit16),
_ => (false, false, PinBitCount.Bit1)
};
}
Expand Down
14 changes: 13 additions & 1 deletion Assets/Scripts/Description/Types/SubTypes/ChipTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,40 @@ public enum ChipType

// ---- Memory ----
dev_Ram_8Bit,
Rom_256x2x8,
Rom_256x16,
Rom_256x32,

// ---- Displays ----
SevenSegmentDisplay,
DisplayRGB,
DisplayDot,
DisplayLED,
DisplayRGBLED,

// ---- Merge / Split ----
Merge_1To4Bit,
Merge_1To8Bit,
Merge_4To8Bit,
Merge_1To16Bit,
Merge_4To16Bit,
Merge_8To16Bit,
Split_4To1Bit,
Split_8To4Bit,
Split_8To1Bit,
Split_16To1Bit,
Split_16To4Bit,
Split_16To8Bit,

// ---- In / Out Pins ----
In_1Bit,
In_4Bit,
In_8Bit,
In_16Bit,
Out_1Bit,
Out_4Bit,
Out_8Bit,
Out_16Bit,

Key,

Expand All @@ -45,9 +56,10 @@ public enum ChipType
BusTerminus_4Bit,
Bus_8Bit,
BusTerminus_8Bit,
Bus_16Bit,
BusTerminus_16Bit,

// ---- Audio ----
Buzzer

}
}
3 changes: 2 additions & 1 deletion Assets/Scripts/Description/Types/SubTypes/PinDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum PinBitCount
{
Bit1 = 1,
Bit4 = 4,
Bit8 = 8
Bit8 = 8,
Bit16 = 16
}

public enum PinColour
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Game/Elements/DevPinInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public DevPinInstance(PinDescription pinDescription, bool isInput)
PinBitCount.Bit1 => new Vector2Int(1, 1),
PinBitCount.Bit4 => new Vector2Int(2, 2),
PinBitCount.Bit8 => new Vector2Int(4, 2),
PinBitCount.Bit16 => new Vector2Int(4, 4),
_ => throw new Exception("Bit count not implemented")
};
StateGridSize = BitCount switch
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Game/Elements/SubChipInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ public static float PinHeightFromBitCount(PinBitCount bitCount)
PinBitCount.Bit1 => DrawSettings.PinRadius * 2,
PinBitCount.Bit4 => DrawSettings.PinHeight4Bit,
PinBitCount.Bit8 => DrawSettings.PinHeight8Bit,
PinBitCount.Bit16 => DrawSettings.PinHeight16Bit,
_ => throw new Exception("Bit count not implemented " + bitCount)
};
}
Expand Down
Loading