added SR latch

This commit is contained in:
Redo 2019-09-18 22:41:29 -05:00
parent 46f8d92ed2
commit d309581199
2 changed files with 20 additions and 1 deletions
bricks/memory
scripts

18
bricks/memory/SRLatch.cs Normal file

@ -0,0 +1,18 @@
datablock fxDTSBrickData(LogicGate_SRLatch_Data : LogicGate_DFlipFlop_Data)
{
subCategory = "Memory";
uiName = "SR Latch";
iconName = $LuaLogic::Path @ "icons/D FlipFlop";
logicUIName = "SR Latch";
logicUIDesc = "Q becomes 0 if R is on, else 1 when S is on";
logicUpdate = "return function(gate) if gate.ports[1].state then gate.ports[3]:setstate(false) elseif gate.ports[2].state then gate.ports[3]:setstate(true) end end";
logicPortUIName[0] = "R";
logicPortCauseUpdate[0] = true;
logicPortUIName[1] = "S";
logicPortCauseUpdate[1] = true;
logicPortUIName[2] = "Q";
};
lualogic_registergatedefinition("LogicGate_SRLatch_Data");

@ -38,7 +38,8 @@ exec($LuaLogic::Path @ "bricks/bus/8BitDFlipFlop.cs");
//Memory
exec($LuaLogic::Path @ "bricks/memory/DFlipFlop.cs");
exec($LuaLogic::Path @ "bricks/memory/SRLatch.cs");
exec($LuaLogic::Path @ "bricks/memory/DFlipflopGridMemory2.cs");
//Special
exec($LuaLogic::Path @ "bricks/special/EventGate.cs");
exec($LuaLogic::Path @ "bricks/special/EventGate.cs");