3. (15 pts.) Simple Loopback System¹: Consider a simple "loopback" system as in Fig. 1. In such a setup, a PC can send a message which is returned(looped) back to PC by the processor. Such a loopback test is helpful to test if the processor is alive or not. A PC (not shown) interfaces with PicoBlaze processor using an RS232 (serial)connection. Let us examine the case when the PC acts as a transmitter. In this case the data arrives serially on RS232_RX line. But we know that PicoBlaze accepts only byte-size data. So we need to convert the serial data into parallel(8-bit) data. In such a case, a UART (Universal Asynchronous Receiver Transmitter) block can help. UART_RX does the serial-to-parallel conversion i.e.,the data arriving on RS232_RX line is buffered in a 16-byte buffer. Whenever data is presented on rx_data output, UART_RXnew

will assert data_present_validates rx data. Thei.e., data_present = '1' in other words data_present"Input Port Logic" block consists of glue logic that connects UART_RX to the IN_PORT. After PicoBlaze reads the data, it can request the next data item by asserting read_from_uart signal. Now, let us consider the case when PicoBlaze acts as a transmitter i.e., PC is the receiver. In this case, Pico Blaze puts out 8-bit data while PC is expecting serial data. Again, UART (UART_TX in Fig. 1) comes to our rescue! The output bus with id=3 is connected to UART_TX. Output Port Logic block interfaces PicoBlaze with leds and UART TX. In this system, we can also manually provide 8-bit data via 8 switches (switches bus in Fig. 1). Pico Blaze can write 8-bit data to drive 8 leds (leds bus in Fig. 1). Recall that PicoBlaze can accept up to 256 input ports each of which can addressed by 8-bit PORT_ID bus. Similarly, it can drive up to 256 ports and the address of the port being driven appears on PORT_ID_bus. In Fig. 1, for example, the id of the input port, switches, is 0. Similarly, the rx_data has id of 2. The port ids are shown in bold font in the Fig.1. The high-level views of UART in transmit and received modes are shown in Fig. 2.2 a) (2 pts.) Explain under what condition(s) should the following signals be asserted? i. read from uart ii.write_to_uart b) (4 pts.) cold_start: Write code to output a message “Welcome to Loopback!"to the serial port. You need encode the message in ASCII format. For ASCIItable see Caution: UART_TX buffer size is only 16bytes!! c) (4 pts.) led_echo: Write code to read switches and write it, inverted, to theLEDs. d) (5 pts.) rs232_echo: Write code to check if a byte has been received byUART_RX. If so, send it back to PC via UART_TX.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7

Fig: 8

Fig: 9

Fig: 10

Fig: 11

Fig: 12

Fig: 13