Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions Assets/Scripts/Description/Helpers/ChipTypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ 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" },
Expand Down Expand Up @@ -82,6 +84,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 +94,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 +109,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
2 changes: 2 additions & 0 deletions Assets/Scripts/Description/Types/SubTypes/ChipTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ public enum ChipType
In_1Bit,
In_4Bit,
In_8Bit,
In_16Bit,
Out_1Bit,
Out_4Bit,
Out_8Bit,
Out_16Bit,

Key,

Expand Down
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(8, 2),
_ => 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
2 changes: 2 additions & 0 deletions Assets/Scripts/Game/Project/BuiltinChipCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public static ChipDescription[] CreateAllBuiltinChipDescriptions()
CreateInputOrOutputPin(ChipType.Out_4Bit),
CreateInputOrOutputPin(ChipType.In_8Bit),
CreateInputOrOutputPin(ChipType.Out_8Bit),
CreateInputOrOutputPin(ChipType.In_16Bit),
CreateInputOrOutputPin(ChipType.Out_16Bit),
CreateInputKeyChip(),
// ---- Basic Chips ----
CreateNand(),
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/Game/Project/BuiltinCollectionCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ public static ChipCollection[] CreateDefaultChipCollections()
ChipType.In_1Bit,
ChipType.In_4Bit,
ChipType.In_8Bit,
ChipType.In_16Bit,
ChipType.Out_1Bit,
ChipType.Out_4Bit,
ChipType.Out_8Bit
ChipType.Out_8Bit,
ChipType.Out_16Bit
),
CreateChipCollection("MERGE/SPLIT",
ChipType.Merge_1To4Bit,
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Graphics/DrawSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static class DrawSettings
public const float PinHeight1Bit = 0.185f;
public const float PinHeight4Bit = 0.3f;
public const float PinHeight8Bit = 0.43f;
public const float PinHeight16Bit = 0.43f; // Same visual height as 8-bit; bits shown in 8x2 grid
public const float PinRadius = PinHeight1Bit / 2;

public const FontType FontBold = FontType.JetbrainsMonoBold;
Expand Down