Professional Documents
Culture Documents
Hardware Interface Design Patterns: Ahmet Selman Bozkır - Hacettepe Univ
Hardware Interface Design Patterns: Ahmet Selman Bozkır - Hacettepe Univ
Hardware Interface Design Patterns: Ahmet Selman Bozkır - Hacettepe Univ
Applicability
This pattern is applicable to all serial devices that
involve DMA (direct memory access) transfers to and
from the device.
Transmit Buffer (TXBUF): Write only buffer in which bytes meant for transmission
should be written.
Receive Buffer (RXBUF): Read only buffer in which received bytes are stored.
Hardware Device Design Pattern
class Serial_Device
{
enum Register_Offsets {
STAT_REG_OFFSET = 0, ACT_REG_OFFSET = 0,
TXBUF_OFFSET = 1, RXBUF_OFFSET = 2
};
enum Status_Register_Bits {
TX_EMPTY, RX_DATA, TX_UNDERRUN, RX_OVERRUN
};
Attaining Synchronization
Loosing Synchronization
Synchronizer Design Pattern
Attaining Synchronization
1. System starts up in "Searching For Sync" state. In this state, the incoming
data stream is being analyzed bit by bit, looking for the occurrence of the
sync pattern.
2. As a soon as a first sync pattern is detected, the system transitions to the
"Confirming Sync Pattern" state.
3. Now the system checks if the sync pattern is repeating as expected. This
check is made according to the specified periodicity.
4. If the sync pattern is repeating, the system transitions to the "In Sync" state.
(If the sync pattern was not found, the system would have transitioned back
to the "Searching For Sync" state)
5. At this point, the system is considered to be synchronized.
Loosing Synchronization
1. When the system is synchronized, it is in the "In Sync" state. In this state,
the system is constantly monitoring the periodic occurrence of the sync
pattern.
2. If an expected sync pattern is found to be missing, the system transitions to
the "Confirming Sync Loss". The system is still in a synchronized state. The
main purpose of the "Confirming Sync Loss" state is to check if the loss of
sync was an isolated event or it represents complete loss of sync.
3. In the "Confirming Sync Loss" state, the system looks for the sync pattern at
the expected time interval. If the sync pattern is seen again, the system
transitions back to the "In Sync" state.
4. In this case, the sync pattern is not detected for a preconfigured number of
times.
5. The system is now in sync loss state. The system is transitioned to the
"Searching For Sync" state.
Synchronizer Design Pattern
Synchronizer Design Pattern
So what?