Closed ghost closed 4 years ago
I have written a testbench c code for simulating UART. The two functions that is used in my testbench are:
void uart_init(int parity,unsigned short clk_counter) { CGREG |= (1 << CGUART); // don't clock gate UART UART->LCR = 0x83; //sets 8N1 and set DLAB to 1 UART->DLM = (clk_counter >> 8) & 0xFF; UART->DLL = clk_counter & 0xFF; UART->FCR = 0xA7; //enables 16byte FIFO and clear FIFOs UART->LCR = 0x03; //sets 8N1 and set DLAB to 0 }
and
void uart_putchar(unsigned char a) { while ((UART->LSR & 0x20) == 0); UART->THR = a; }
But there is a infinite loop when I started to simulations because of LSR&0x20 condition is not evaluated. How can I fix this issue?
I have written a testbench c code for simulating UART. The two functions that is used in my testbench are:
and
But there is a infinite loop when I started to simulations because of LSR&0x20 condition is not evaluated. How can I fix this issue?