{
	"info":
	{
		"descr": "JSON contains all the information about the PSG cells. All dimensions and coordinates in lambda.",
		"url": "https://github.com/emu-russia/VDP-PSG/blob/main/cells.md"
	},

	"map":
	{
		"row_names": [ "A", "B", "C", "D", "E", "F", "G", "H" ],

		"rows":
		[
			[
				"not", "nand", "nand", "comp_weak", "comp_weak", "comp_weak",
				"nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", 
				"not", "nand", "nand", "comp_weak", "comp_weak", "comp_weak", 
				"nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", 
				"not", "nand", "nand", "comp_weak", "comp_weak", "comp_weak", 
				"nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", 
				"not", "nand", "nand", "comp_weak", "comp_weak", "comp_weak", 
				"nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3", "nand3"
			],

			[
				"notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "comp_strong",
				"notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "comp_strong",
				"notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "comp_strong",
				"notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "notif0", "or", "dlatch", "comp_strong", "not_strong"
			],

			[
				"dlatch", "and", "and", "comp_strong", "dlatch", "and", "dlatch", "dlatch", "and", "dlatch", "dlatch", "and", "dlatch", "dlatch", "and", "or", "not",
				"dlatch", "and", "or", "dlatch", "and", "or", "dlatch", "and", "or", "comp_strong",
				"not", "aoi21", "and3", "not", "aoi21", "and3", "or", "not", "and", "and", "not", "aoi21", "and3", "and", "and",
				"not", "aoi21", "and3", "not", "aoi21", "and3", "and", "and", "not", "aoi21", "and3",
				"and3", "aoi21", "not", "and3", "aoi21", "not",     "not", "not",     "not", "not", "not", "nor", "nor", "nor", "nor"
			],

			[
				"dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch",
				"comp_strong", "comp_strong", "comp_strong",
				"dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch", "dlatch",
				"comp_strong", "comp_strong", "comp_strong",
				"and", "and", "and", "and", "dlatch", "dlatch", "dlatch", "comp_strong"
			],

			[
				"aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a", "aon2222", "cgi2a",
				"not", "nand", "sr_bit", "not", "nand", "sr_bit", "not", "nand", "sr_bit", "not", "nand", "sr_bit",     "nor4", "not", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit"
			],

			[
				"sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit",
				"sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit",
				"sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit",
				"sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit", "sr_bit",
				"nor", "and", "cnt_bit", "and", "cnt_bit", "and", "cnt_bit", "and", "cnt_bit", "nor3", "nor4", "not"
			],

			[
				"and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha", "and", "ha",
				"xor",
				"lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit", "lfsr_bit",
				"nand", "nand", "nand4"
			],

			[
				"not", "clkgen", "comp_dff",
				"sr_bit", "not", "and", "nor", "sr_bit", "cnt_bit", "slatch_inv", "not", "nand",
				"buf", "not", "buf", "nand", "not", "buf", "buf", 
				"rs", "nor", "comp_dff", "sr_bit", "comp_dff", "not", "not_strong", "nor4",
				"rs", "comp_dff", "nor", "not", "nand", "not_strong", "not_strong", "nand", "nor4", "and", "not", "sr_bit", "aon22",
				"not", "nand", "and", "not", "nand", "and", "not", "nand", "and", "nand", "and"
			]
		],

		"placement":
		[
			[
				"e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", 
				"e", "e", "e", "e", "e", "e", "e", "e"
			],

			[
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e"
			],

			[
				"r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r",
				"r", "r", "r", "r", "r", "r", "r", "r", "r", "r",
				"r", "r", "r", "r", "r", "r", "r", "r", "rf", "rf", "r", "r", "r", "rf", "rf",
				"r", "r", "r", "r", "r", "r", "rf", "rf", "r", "r", "r",
				"rf", "rf", "rf", "rf", "rf", "rf",    "r", "r",    "rf", "rf", "rf", "r",    "rf", "rf", "rf"
			],

			[
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e"
			],

			[
				"r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r",
				"r", "rf", "rf", "r", "rf", "rf", "r", "rf", "rf", "r", "rf", "rf",      "rf", "r", "rf", "rf", "rf", "rf", "rf"
			],

			[
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "e", "e", "e", "e", "e", "e", "e", "e", "e",
				"e", "ef", "e", "ef", "e", "ef", "ef", "e", "e", "ef", "ef", "e"
			],

			[
				"r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r",
				"r",
				"r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r",
				"rf", "rf", "rf"
			],

			[
				"e", "e", "e",
				"ef", "e", "ef", "ef", "ef", "e", "e", "e", "ef",
				"e", "e", "e", "ef", "e", "e", "e", 
				"e", "ef", "e", "ef", "e", "e", "e", "ef",
				"e", "e", "ef", "e", "ef", "e", "ef", "e", "ef", "e", "ef", "e", "e",
				"ef", "ef", "ef", "e", "ef", "ef", "e", "ef", "ef", "ef", "ef"
			]
		],

		"group_notes": "Значения в разделе `placement` означают следующее: e - нормальное положение ячейки, GND снизу; r - ячейка повернута на 180 градусов, GND сверху; f - ячейка флипнута слева-направо (горизонтально), расположение GND указывается первой операцией (e/r)."
	},

	"cells":
	{
		"not":
		{
			"notes": "писюн",
			"type": "CellNot",
			"width": 9.33,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 2.94, "y": 28.07, "name": "a" },
				{ "type": "output", "x": 8.31, "y": 15.25, "name": "x" }
			]
		},

		"nand":
		{
			"notes": "писюн с вывернутым яйцом",
			"type": "CellLogic",
			"width": 12.53,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 8.88, "y": 28.77, "name": "a" },
				{ "type": "input", "x": 6.5, "y": 28.67, "name": "b" },
				{ "type": "output", "x": 1.74, "y": 17.34, "name": "x" }
			]
		},

		"nor":
		{
			"notes": "флипнутый снизу-вверх nand",
			"type": "CellLogic",
			"width": 12.53,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 8.87, "y": 26.77, "name": "a" },
				{ "type": "input", "x": 6.52, "y": 26.68, "name": "b" },
				{ "type": "output", "x": 1.74, "y": 13.98, "name": "x" }
			]
		},

		"comp_weak":
		{
			"notes": "Слабый комплементарный буфер. писюн в шляпе.",
			"type": "CellBuffer",
			"width": 13.61,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 3.49, "y": 28.7, "name": "a" },
				{ "type": "output", "x": 7.39, "y": 16.03, "name": "nx" },
				{ "type": "output", "x": 12.06, "y": 16.13, "name": "x" }
			]
		},

		"nand3":
		{
			"notes": "кочерга",
			"type": "CellLogic",
			"width": 16.26,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 12.21, "y": 28.66, "name": "a" },
				{ "type": "input", "x": 9.88, "y": 28.57, "name": "b" },
				{ "type": "input", "x": 7.6, "y": 28.65, "name": "c" },
				{ "type": "output", "x": 1.6, "y": 16.23, "name": "x" }
			]
		},

		"nor3":
		{
			"notes": "флипнутая кочерга",
			"type": "CellLogic",
			"width": 16.26,
			"height": 30,
			"ports":
			[
				{ "type": "input", "x": 2.71, "y": 27.49, "name": "a" },
				{ "type": "input", "x": 7.35, "y": 27.39, "name": "b" },
				{ "type": "input", "x": 9.66, "y": 27.39, "name": "c" },
				{ "type": "output", "x": 14.61, "y": 15.39, "name": "x" }
			]
		},

		"dlatch":
		{
			"type": "CellLatch",
			"width": 31.2,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 27.14, "y": 1.71, "name": "a" },
				{ "type": "input", "x": 21.51, "y": 1.86, "name": "c1" },
				{ "type": "input", "x": 21.58, "y": 27.05, "name": "nc1" },
				{ "type": "output", "x": 1.36, "y": 14.08, "name": "q" }
			]
		},

		"comp_strong":
		{
			"notes": "Поскольку шнуровка для комплемента находится снаружи ячеек, для превращения одиночного `Enable` в два комплементарных сигнала используется этот комплементарный буфер.",
			"type": "CellBuffer",
			"width": 16,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 12.85, "y": 5.33, "name": "a" },
				{ "type": "input", "x": 1.53, "y": 14.41, "name": "x" },
				{ "type": "output", "x": 6.05, "y": 26.71, "name": "nx" }
			]
		},


		"or":
		{
			"notes": "чел",
			"type": "CellLogic",
			"width": 16.46,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 13.53, "y": 2.32, "name": "a" },
				{ "type": "input", "x": 11.05, "y": 2.33, "name": "b" },
				{ "type": "output", "x": 1.47, "y": 14.08, "name": "x" }
			]
		},

		"and":
		{
			"notes": "флипнутый чел",
			"type": "CellLogic",
			"width": 16.46,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 2.69, "y": 26.87, "name": "a" },
				{ "type": "input", "x": 5.01, "y": 26.95, "name": "b" },
				{ "type": "output", "x": 14.29, "y": 15.75, "name": "x" }
			]
		},

		"notif0":
		{
			"type": "CellBusSupp",
			"width": 16.53,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 10.27, "y": 4.24, "name": "a" },
				{ "type": "input", "x": 1.57, "y": 4.24, "name": "b" },
				{ "type": "output", "x": 14.97, "y": 14.54, "name": "x" }
			]
		},

		"cgi2a":
		{
			"notes": "Генератор переноса инвертирующий с одним инверсным входом",
			"type": "CellAdder",
			"width": 28,
			"height": 29
		},

		"sr_bit":
		{
			"type": "CellLatch",
			"width": 20.87,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 19.68, "y": 14.48, "name": "in" },
				{ "type": "input", "x": 15.38, "y": 26.98, "name": "c1" },
				{ "type": "input", "x": 15.01, "y": 2.48, "name": "nc1" },
				{ "type": "input", "x": 10.29, "y": 27.16, "name": "c2" },
				{ "type": "input", "x": 10.47, "y": 2.43, "name": "nc2" },
				{ "type": "output", "x": 1.65, "y": 14.8, "name": "out" }
			]
		},

		"comp_dff":
		{
			"notes": "ещё такая. Комплементарный Posedge? DFF",
			"type": "CellFlipFlop",
			"width": 42.5,
			"height": 29
		},

		"lfsr_bit":
		{
			"notes": "Используется для шумового канала. Ячейка представляет собой регистр сдвига с обратной связью. Выход замешивается на вход с тремя дополнительными замесами через операцию aoi.",
			"type": "CellLatch",
			"width": 37.5,
			"height": 29
		},

		"buf":
		{
			"notes": "Обычный супер-буфер",
			"type": "CellBuffer",
			"width": 17,
			"height": 29
		},

		"clkgen":
		{
			"notes": "Расщепитель одиночной фазы CLK на 4 комплемента (CLK Distribution).",
			"type": "CellOther",
			"width": 210,
			"height": 29
		},

		"aoi21":
		{
			"notes": "2-AND into 2-NOR gate",
			"type": "CellLogic",
			"width": 17.42,
			"height": 30
		},

		"oai21":
		{
			"notes": "2-OR into 2-NAND gate",
			"type": "CellLogic",
			"width": 17.42,
			"height": 30
		},		

		"and3":
		{
			"notes": "длинный чел",
			"type": "CellLogic",
			"width": 21,
			"height": 30
		},

		"or3":
		{
			"notes": "флипнутый длинный чел",
			"type": "CellLogic",
			"width": 21,
			"height": 30
		},

		"cnt_bit":
		{
			"notes": "Разряд счётчика. В PSG carry_out не используется, т.к. все счётчики 1-разрядные.",
			"type": "CellAdder",
			"width": 62,
			"height": 29,
			"ports":
			[
				{ "type": "input", "x": 4.54, "y": 5.71, "name": "cin" },
				{ "type": "input", "x": 18.84, "y": 26.2, "name": "r" },
				{ "type": "input", "x": 29.74, "y": 26.8, "name": "c1" },
				{ "type": "input", "x": 30.34, "y": 2.1, "name": "nc1" },
				{ "type": "input", "x": 40.24, "y": 26.5, "name": "c2" },
				{ "type": "input", "x": 40.54, "y": 2.2, "name": "nc2" },
				{ "type": "output", "x": 59.0, "y": 5.1, "name": "cout" },
				{ "type": "output", "x": 60.0, "y": 16.5, "name": "s" }
			]
		},

		"aon22":
		{
			"notes": "В единственном экземпляре в правом нижнем углу.",
			"type": "CellLogic",
			"width": 23,
			"height": 29
		},

		"not_strong":
		{
			"notes": "Используется два спаренных инвертора для дополнительного драйва сигнала. Мощный писюн",
			"type": "CellNot",
			"width": 9.3,
			"height": 29
		},

		"ha":
		{
			"notes": "Half Adder. Встречается в ряду G.",
			"type": "CellAdder",
			"width": 36.5,
			"height": 29
		},

		"xor":
		{
			"notes": "В единственном экземпляре, по середине ряда G.",
			"type": "CellLogic",
			"width": 25,
			"height": 29
		},

		"slatch_inv":
		{
			"notes": "Значение хранится на затворе выходного инвертора. Вход Enable в комплементарной логике (\"dual-rails\").",
			"type": "CellLatch",
			"width": 15.5,
			"height": 29
		},

		"rs":
		{
			"notes": "В двух экземплярах, ряд H.",
			"type": "CellFlipFlop",
			"width": 30,
			"height": 29
		},

		"aon2222":
		{
			"notes": "Раньше входила в cgi2a, после разбора стало понятно что это отдельная ячейка.",
			"type": "CellLogic",
			"width": 45.4,
			"height": 29
		},

		"nand4":
		{
			"type": "CellLogic",
			"width": 14.0,
			"height": 29
		},

		"nor4":
		{
			"type": "CellLogic",
			"width": 14.0,
			"height": 29
		}
	}
}
