DMG-CPU Research

Databus Multiplexer

This module is an integration of two circuits called "DataLatch" (TopPart) and "DataBridge" (BottomPart). After the whole chip was cracked, it became obvious that it is one circuit, just separated into two parts to reduce the length of wires.

locator_datalatch locator_databridge

Please, if you want to understand correctly how this tricky circuit works, read the whole section carefully and take into account that this schematic was originally designed as two sections of the wiki, so the description is a bit "fragmented". The most correct and easiest to understand circuit is at the very end of the section.

Top Part

datalatch

TopPart is used for the following operations:

Top Part Bit

TopPart consists of 8 such chunks:

module1

module1_tran

Port Dir Description
a input DL_Control1. 1: Bus disable
b input DL_Control2 (x37). ALU Result -> DL
c input Result from ALU (Res[n])
clk input CLK2
Data inout External databus (D[n])
x inout Internal databus (DL[n])

It looks like a mixture of dynamic CMOS logic, NMOS and regular CMOS.

A gate capacitance is used as memory.

Same thing by Gekkio: https://github.com/Gekkio/gb-research/tree/main/sm83-cpu-core/io-cell

Top Part Circuit analysis

External data bus driven (external->internal):

datalatch_extbus_0 datalatch_extbus_1

Internal data bus driven (internal->external):

datalatch_intbus_0 datalatch_intbus_1

In all cases, both the internal and external data buses are precharged (value=0xff) during CLK2=0.

Top Part Logisim

The circuit is very low-level, with bidirectional signals and tristates made as FETs, so it is difficult to make an identical circuit in Logisim.

The closest approximation is following:

DataLatch

Bottom Part

databridge

The purpose of this circuit is put DV bus value into DL bus.

The DV value also goes "through" the DataBridge and is fed to the ALU input (Operand2).

bridge_comb

bridge_comb_tran

DataOut dv_bit dl_bit
0 0 z
0 1 z
1 0 0
1 1 z

Combined DataMux

If you combine the two circuits into one, then according to the latest data from our scientists, you should get something like this:

DataMux

Again, Logisim doesn't support such tinkery, so here's a schematic closer to reality:

datamux_tran