function FIFO_Buffer_tb

%% Clear persistent variables.
clear FIFO_Buffer

SimulationTime=26;
%% Set up test vectors
wr=[ones(1,7),zeros(1,9),ones(1,9),zeros(1,1)];
wr_data=int8([77,65,84,76,65,66,0,zeros(1,9),83,73,77,85,76,73,78,75,0,0]);
rd=[zeros(1,7),ones(1,7),zeros(1,3),ones(1,9)];

%% Call function
[~,r_data,~]=arrayfun(@(in1,in2,in3) FIFO_Buffer(in1,in2,in3),wr,wr_data,rd);

%% Plot the resulting output vectors
subplot(2,1,1)
plot(1:SimulationTime,r_data,'--o',1:SimulationTime,wr_data,'--x')
legend('Data Read','Data Written','Location','NorthEastOutside');
title('FIFO Buffer for UART receiver: Data received');
xlabel('Clock Cycles');
ylabel('Data Read and Written from the Buffer');
grid on
axis tight

subplot(2,1,2)
plot(1:SimulationTime,rd,1:SimulationTime,wr)
legend('Read Signal','Write Signal','Location','NorthEastOutside');
title('FIFO Buffer for UART receiver: rd/wr Control Signals');
xlabel('Clock Cycles');
ylabel('Control Signals');
grid on
axis tight
ylim([-2 2]);



