add first round of tweaks to bridge_rx_tb
This commit is contained in:
parent
1a536080f1
commit
25b2ff0dd0
|
|
@ -1,25 +1,6 @@
|
|||
`default_nettype none
|
||||
`timescale 1ns/1ps
|
||||
|
||||
function [3:0] from_ascii_hex;
|
||||
// convert an ascii char encoding a hex value to
|
||||
// the corresponding hex value
|
||||
input [7:0] c;
|
||||
|
||||
if ((c >= 8'h30) && (c <= 8'h39)) from_ascii_hex = c - 8'h30;
|
||||
else if ((c >= 8'h41) && (c <= 8'h46)) from_ascii_hex = c - 8'h41 + 'd1;
|
||||
else from_ascii_hex = 0;
|
||||
endfunction
|
||||
|
||||
function is_ascii_hex;
|
||||
// checks if a byte is an ascii char encoding a hex digit
|
||||
input [7:0] c;
|
||||
|
||||
if ((c >= 8'h30) && (c <= 8'h39)) is_ascii_hex = 1; // 0-9
|
||||
else if ((c >= 8'h41) && (c <= 8'h46)) is_ascii_hex = 1; // A-F
|
||||
else is_ascii_hex = 0;
|
||||
endfunction
|
||||
|
||||
module bridge_rx (
|
||||
input wire clk,
|
||||
|
||||
|
|
@ -36,7 +17,26 @@ module bridge_rx (
|
|||
initial rw_o = 0;
|
||||
initial valid_o = 0;
|
||||
|
||||
reg [7:0] buffer [7:0]; // todo: see if sby will tolerate packed arrays?
|
||||
function [3:0] from_ascii_hex;
|
||||
// convert an ascii char encoding a hex value to
|
||||
// the corresponding hex value
|
||||
input [7:0] c;
|
||||
|
||||
if ((c >= 8'h30) && (c <= 8'h39)) from_ascii_hex = c - 8'h30;
|
||||
else if ((c >= 8'h41) && (c <= 8'h46)) from_ascii_hex = c - 8'h41 + 'd10;
|
||||
else from_ascii_hex = 0;
|
||||
endfunction
|
||||
|
||||
function is_ascii_hex;
|
||||
// checks if a byte is an ascii char encoding a hex digit
|
||||
input [7:0] c;
|
||||
|
||||
if ((c >= 8'h30) && (c <= 8'h39)) is_ascii_hex = 1; // 0-9
|
||||
else if ((c >= 8'h41) && (c <= 8'h46)) is_ascii_hex = 1; // A-F
|
||||
else is_ascii_hex = 0;
|
||||
endfunction
|
||||
|
||||
reg [7:0][7:0] buffer = 0; // todo: see if sby will tolerate packed arrays?
|
||||
|
||||
localparam IDLE = 0;
|
||||
localparam READ = 1;
|
||||
|
|
@ -68,17 +68,15 @@ module bridge_rx (
|
|||
if(state == READ) begin
|
||||
|
||||
// go to idle if anything doesn't make sense
|
||||
if(byte_num <= 3)
|
||||
if(byte_num < 4) begin
|
||||
if(!is_ascii_hex(data_i)) state <= IDLE;
|
||||
end
|
||||
|
||||
else if(byte_num == 4)
|
||||
if(data_i != CR) state <= IDLE;
|
||||
|
||||
else if(byte_num == 5) begin
|
||||
else if(byte_num == 4) begin
|
||||
state <= IDLE;
|
||||
|
||||
// put data on the bus if the last byte looks good
|
||||
if(data_i == LF) begin
|
||||
if((data_i == 8'h0D) || (data_i == 8'h0A)) begin
|
||||
addr_o <= (from_ascii_hex(buffer[0]) << 12) |
|
||||
(from_ascii_hex(buffer[1]) << 8) |
|
||||
(from_ascii_hex(buffer[2]) << 4) |
|
||||
|
|
@ -94,17 +92,15 @@ module bridge_rx (
|
|||
if(state == WRITE) begin
|
||||
|
||||
// go to idle if anything doesn't make sense
|
||||
if(byte_num <= 3)
|
||||
if(byte_num < 8) begin
|
||||
if(!is_ascii_hex(data_i)) state <= IDLE;
|
||||
end
|
||||
|
||||
else if(byte_num == 4)
|
||||
if(data_i != CR) state <= IDLE;
|
||||
|
||||
else if(byte_num == 5) begin
|
||||
else if(byte_num == 8) begin
|
||||
state <= IDLE;
|
||||
|
||||
// put data on the bus if the last byte looks good
|
||||
if(data_i == LF) begin
|
||||
if((data_i == 8'h0A) || (data_i == 8'h0D)) begin
|
||||
addr_o <= (from_ascii_hex(buffer[0]) << 12) |
|
||||
(from_ascii_hex(buffer[1]) << 8) |
|
||||
(from_ascii_hex(buffer[2]) << 4) |
|
||||
|
|
|
|||
|
|
@ -5,49 +5,40 @@
|
|||
`define HCP 5
|
||||
|
||||
`define SEND_MESSAGE(MESSAGE) \
|
||||
rx_valid = 1; \
|
||||
tb_brx_valid = 1; \
|
||||
for(int i=0; i < $size(MESSAGE); i++) begin \
|
||||
rx_data = MESSAGE[i]; \
|
||||
tb_brx_data = MESSAGE[i]; \
|
||||
#`CP; \
|
||||
end \
|
||||
rx_valid = 0; \
|
||||
tb_brx_valid = 0; \
|
||||
|
||||
module bridge_rx_tb;
|
||||
// https://www.youtube.com/watch?v=WCOAr-96bGc
|
||||
|
||||
//boilerplate
|
||||
logic clk;
|
||||
logic rst;
|
||||
string message;
|
||||
integer test_num;
|
||||
|
||||
// uart inputs and outputs
|
||||
logic rx;
|
||||
logic [7:0] rx_data;
|
||||
logic rx_valid;
|
||||
logic [7:0] tb_brx_data;
|
||||
logic tb_brx_valid;
|
||||
|
||||
// the parameter will all get filled out in manta's big instantiator thing hehehee
|
||||
parameter ADDR_WIDTH = 16; // $clog2( how much memory we need rounded up to the nearest 8 )
|
||||
parameter DATA_WIDTH = 16;
|
||||
|
||||
// request bus, gets connected to uart_rx (through a FSM)
|
||||
logic [ADDR_WIDTH-1:0] addr;
|
||||
logic [DATA_WIDTH-1:0] wdata;
|
||||
logic rw;
|
||||
logic valid;
|
||||
logic req_ready;
|
||||
logic [15:0] brx_tb_addr;
|
||||
logic [15:0] brx_tb_data;
|
||||
logic brx_tb_rw;
|
||||
logic brx_tb_valid;
|
||||
|
||||
bridge_rx bridge_rx_uut(
|
||||
.clk(clk),
|
||||
|
||||
// connect to uart_rx
|
||||
.rx_data(rx_data),
|
||||
.rx_valid(rx_valid),
|
||||
.data_i(tb_brx_data),
|
||||
.valid_i(tb_brx_valid),
|
||||
|
||||
.addr_o(addr),
|
||||
.wdata_o(wdata),
|
||||
.rw_o(rw),
|
||||
.valid_o(valid));
|
||||
.addr_o(brx_tb_addr),
|
||||
.data_o(brx_tb_data),
|
||||
.rw_o(brx_tb_rw),
|
||||
.valid_o(brx_tb_valid));
|
||||
|
||||
always begin
|
||||
#`HCP
|
||||
|
|
@ -60,144 +51,140 @@ initial begin
|
|||
|
||||
// setup and reset
|
||||
clk = 0;
|
||||
rst = 0;
|
||||
rx_data = 0;
|
||||
rx_valid = 0;
|
||||
req_ready = 1;
|
||||
tb_brx_data = 0;
|
||||
tb_brx_valid = 0;
|
||||
test_num = 0;
|
||||
#`CP
|
||||
rst = 1;
|
||||
#`CP
|
||||
rst = 0;
|
||||
#`HCP
|
||||
|
||||
/* ==== Test 1 Begin ==== */
|
||||
$display("\n=== test 1: transmit M12345678(CR)(LF) for baseline functionality ===");
|
||||
$display("\n=== test 1: transmit W12345678(CR)(LF) for baseline functionality ===");
|
||||
test_num = 1;
|
||||
message = {"M12345678", 8'h0D, 8'h0A};
|
||||
message = {"W12345678", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'h1234) else $error("incorrect addr!");
|
||||
assert(wdata == 16'h5678) else $error("incorrect data!");
|
||||
assert(rw == 1) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'h1234) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_data == 16'h5678) else $error("incorrect data!");
|
||||
assert(brx_tb_rw == 1) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 1 End ==== */
|
||||
|
||||
|
||||
/* ==== Test 2 Begin ==== */
|
||||
$display("\n=== test 2: transmit MDEADBEEF(CR)(LF) for proper state reset ===");
|
||||
$display("\n=== test 2: transmit WDEADBEEF(CR)(LF) for proper state reset ===");
|
||||
test_num = 2;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MDEADBEEF", 8'h0D, 8'h0A};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"WDEADBEEF", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'hDEAD) else $error("incorrect addr!");
|
||||
assert(wdata == 16'hBEEF) else $error("incorrect data!");
|
||||
assert(rw == 1) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'hDEAD) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_data == 16'hBEEF) else $error("incorrect data!");
|
||||
assert(brx_tb_rw == 1) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 2 End ==== */
|
||||
|
||||
|
||||
/* ==== Test 3 Begin ==== */
|
||||
$display("\n=== test 3: transmit MBABE(CR)(LF) for baseline functionality ===");
|
||||
$display("\n=== test 3: transmit RBABE(CR)(LF) for baseline functionality ===");
|
||||
test_num = 3;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MBABE", 8'h0D, 8'h0A};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"RBABE", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'hBABE) else $error("incorrect addr!");
|
||||
assert(rw == 0) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'hBABE) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_rw == 0) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 3 End ==== */
|
||||
|
||||
/* ==== Test 4 Begin ==== */
|
||||
$display("\n=== test 4: transmit M0000(CR) for EOL insensitivity ===");
|
||||
$display("\n=== test 4: transmit R0000(CR) for EOL insensitivity ===");
|
||||
test_num = 4;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"M0000", 8'h0D};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"R0000", 8'h0D};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'h0000) else $error("incorrect addr!");
|
||||
assert(rw == 0) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'h0000) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_rw == 0) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 4 End ==== */
|
||||
|
||||
/* ==== Test 5 Begin ==== */
|
||||
$display("\n=== test 5: transmit M1234(LF) for EOL insensitivity ===");
|
||||
$display("\n=== test 5: transmit R1234(LF) for EOL insensitivity ===");
|
||||
test_num = 5;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"M1234", 8'h0D};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"R1234", 8'h0D};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'h1234) else $error("incorrect addr!");
|
||||
assert(rw == 0) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'h1234) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_rw == 0) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 5 End ==== */
|
||||
|
||||
/* ==== Test 6 Begin ==== */
|
||||
$display("\n=== test 6: transmit MF00DBEEF(CR) for EOL insensitivity ===");
|
||||
$display("\n=== test 6: transmit WF00DBEEF(CR) for EOL insensitivity ===");
|
||||
test_num = 6;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MF00DBEEF", 8'h0D};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"WF00DBEEF", 8'h0D};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'hF00D) else $error("incorrect addr!");
|
||||
assert(wdata == 16'hBEEF) else $error("incorrect data!");
|
||||
assert(rw == 1) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'hF00D) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_data == 16'hBEEF) else $error("incorrect data!");
|
||||
assert(brx_tb_rw == 1) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 6 End ==== */
|
||||
|
||||
/* ==== Test 7 Begin ==== */
|
||||
$display("\n=== test 7: transmit MB0BACAFE(LF) for EOL insensitivity ===");
|
||||
$display("\n=== test 7: transmit WB0BACAFE(LF) for EOL insensitivity ===");
|
||||
test_num = 7;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MB0BACAFE", 8'h0D};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"WB0BACAFE", 8'h0D};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(addr == 16'hB0BA) else $error("incorrect addr!");
|
||||
assert(wdata == 16'hCAFE) else $error("incorrect data!");
|
||||
assert(rw == 1) else $error("incorrect rw!");
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
assert(brx_tb_addr == 16'hB0BA) else $error("incorrect brx_tb_addr!");
|
||||
assert(brx_tb_data == 16'hCAFE) else $error("incorrect data!");
|
||||
assert(brx_tb_rw == 1) else $error("incorrect brx_tb_rw!");
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 7 End ==== */
|
||||
|
||||
/* ==== Test 8 Begin ==== */
|
||||
$display("\n\nIntentionally bad messages:");
|
||||
$display("\n=== test 8: transmit MABC(CR)(LF) for message length ===");
|
||||
$display("\n=== test 8: transmit RABC(CR)(LF) for message length ===");
|
||||
test_num = 8;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABC", 8'h0D, 8'h0A};
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"RABC", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 8 End ==== */
|
||||
|
||||
/* ==== Test 9 Begin ==== */
|
||||
$display("\n=== test 9: transmit M12345(CR)(LF) for message length ===");
|
||||
$display("\n=== test 9: transmit R12345(CR)(LF) for message length ===");
|
||||
test_num = 9;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABC", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"RABC", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 9 End ==== */
|
||||
|
|
@ -205,74 +192,74 @@ initial begin
|
|||
/* ==== Test 10 Begin ==== */
|
||||
$display("\n=== test 10: transmit M(CR)(LF) for message length ===");
|
||||
test_num = 10;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABC", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"WABC", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 10 End ==== */
|
||||
|
||||
/* ==== Test 11 Begin ==== */
|
||||
$display("\n=== test 11: transmit M123456789101112131415161718191201222(CR)(LF) for message length ===");
|
||||
$display("\n=== test 11: transmit W123456789101112131415161718191201222(CR)(LF) for message length ===");
|
||||
test_num = 11;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABC", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"W123456789101112131415161718191201222", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 11 End ==== */
|
||||
|
||||
/* ==== Test 12 Begin ==== */
|
||||
$display("\n=== test 12: transmit MABCG(CR)(LF) for invalid characters ===");
|
||||
$display("\n=== test 12: transmit RABCG(CR)(LF) for invalid characters ===");
|
||||
test_num = 12;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABCG", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"RABCG", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 12 End ==== */
|
||||
|
||||
/* ==== Test 13 Begin ==== */
|
||||
$display("\n=== test 13: transmit MABC[]()##*@(CR)(LF) for invalid characters and message length ===");
|
||||
$display("\n=== test 13: transmit WABC[]()##*@(CR)(LF) for invalid characters and message length ===");
|
||||
test_num = 13;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"MABC[]()##*@", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"WABC[]()##*@", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 13 End ==== */
|
||||
|
||||
/* ==== Test 14 Begin ==== */
|
||||
$display("\n=== test 14: transmit M(CR)(LF) for message length ===");
|
||||
$display("\n=== test 14: transmit R(CR)(LF) for message length ===");
|
||||
test_num = 14;
|
||||
bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
bridge_rx_uut.bytes_received = 0;
|
||||
assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"M", 8'h0D, 8'h0A};
|
||||
// bridge_rx_uut.state = bridge_rx_uut.ACQUIRE;
|
||||
// bridge_rx_uut.bytes_received = 0;
|
||||
// assert(bridge_rx_uut.state != bridge_rx_uut.ERROR) else $error("in error state before transmission");
|
||||
message = {"R", 8'h0D, 8'h0A};
|
||||
`SEND_MESSAGE(message)
|
||||
|
||||
assert(valid == 0) else $error("valid asserted for bad message");
|
||||
assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
assert(brx_tb_valid == 0) else $error("brx_tb_valid asserted for bad message");
|
||||
// assert(bridge_rx_uut.state == bridge_rx_uut.ERROR) else $error("not in error state after transmission");
|
||||
|
||||
#(10*`CP);
|
||||
/* ==== Test 14 End ==== */
|
||||
|
|
|
|||
Loading…
Reference in New Issue