#!/bin/bash # Copyright 2013, Sinclair R.F., Inc. NAME=UART_Rx cat < good 48 65 6c 6c 6f 20 57 6f 72 6c 63 12 0d 0a 00 EOF # Test +/-2.7% and 0% baud rates. cp tb_UART_Rx.s-normal tb_UART_Rx.s; for baud in 112089 115200 118310; do sed -e "s/115200/${baud}/" tb_${NAME}.9x8-good > tb_${NAME}.9x8; ../../../../../ssbcc -q -P monitor_stack tb_${NAME}.9x8 || { echo "${NAME} compile failed" > /dev/stderr; exit 1; } iverilog -o tb tb.v tb_${NAME}.v || { echo "${NAME} build failed" > /dev/stderr; exit 1; } ./tb > tb.out; if ! cmp -s tb.out good; then echo "${NAME} failed testing baud rate: ${baud}" > /dev/stderr; exit 1; fi done # Partial test for input FIFO. cp tb_UART_Rx.s-fifo tb_UART_Rx.s; sed -e "s/G_BAUD$/G_BAUD inFIFO=16/" tb_${NAME}.9x8-good > tb_${NAME}.9x8; ../../../../../ssbcc -q -P monitor_stack tb_${NAME}.9x8 || { echo "${NAME} compile failed" > /dev/stderr; exit 1; } iverilog -o tb tb.v tb_${NAME}.v || { echo "${NAME} build failed" > /dev/stderr; exit 1; } ./tb > tb.out if ! cmp tb.out good; then echo "${NAME} FIFO test failed" > /dev/stderr; exit 1; fi echo "Passed: ${NAME}"; exit 0;