I have a very basic question regarding LPC2418 UART. The UART has got different registers with the same addresses. So while loading the data from the test bench, will it not load into all the registers?

1) For example,RBR(receiver buffer register) and THR(transmit holding register) have the address 32'hE000C000.And I know that you can only read from RBR and only write into THR. So if(addr = 32'hE000C000) data = 32'h10100010; wont the above code write into both THR and RBR?

2)Same case applies even for IIR(interrupt id reg) and FCR(FIFO control register) as they share the same address E000C008 and there is no signal to distinguish between the two registers like we could have used a sel signal of a mux to select either IIR or FCR,but there isnt one.


1 Answer 1


For example 1:

The way registers like that work is that the hardware handles register reads, and register writes differently.

Basically, there are actually two registers in the physical chip. When you read from the address, it retrieves the contents of register A. When you write to the address, it writes into register B.

You should note that the hardware documentation states the following:

UART1 Receiver Buffer Register (U1RBR - 0xE001 0000, when DLAB = 0 Read Only)
UART1 Transmitter Holding Register (U1THR - 0xE001 0000, when DLAB = 0 Write Only)

(Emphasis mine)

For example 2:

I believe that which register is available is a function of the current execution context. When the execution is within the interrupt handler, reads to 0xE000C000 access the IIR register (which is read-only, incidentally).

During normal execution, (or possibly when any non-UART interrupts are firing), read/writes are to the FCR register.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.