`include "router2.v" module rtrtest(); reg reset,clk; reg [3:0] from_parent,from_child_0,from_child_1; wire [3:0] to_parent,to_child_0,to_child_1; wire [7:0] data_parent,data_child_0,data_child_1; wire [7:0] state_output; router rooter(reset,clk, from_parent,from_child_0,from_child_1, to_parent,to_child_0,to_child_1, data_parent,data_child_0,data_child_1,state_output); always #1 clk = ~clk; initial begin from_parent = `idle; from_child_0 = `done_block; from_child_1 = `idle; reset = 1; clk = 0; #5; reset = 0; #15;// THIS HAS TO BE LONGER THAN A CLOCK TICK!!! reset = 1; #40; $monitor("%0d: head(out %b/in %b) c0(out %b/in %b) c1(out %b/in %b)", $time, from_parent,to_parent, from_child_0,to_child_0, from_child_1,to_child_1); /* // start upload from child 0 $display; #50 from_child_0 = `done_block; #50 assert(to_parent==`done_block); #50 from_parent = `start_transfer; #50 assert(to_child_0==`start_transfer); //#5000 // send address $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `byte_there; #50 assert(to_child_0==`byte_there); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `null; #50 assert(to_child_0==`null); // send size $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `byte_there; #50 assert(to_child_0==`byte_there); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `null; #50 assert(to_child_0==`null); // send a byte of data... $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `byte_there; #50 assert(to_child_0==`byte_there); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `null; #50 assert(to_child_0==`null); // clean up $display; #50 from_child_0 = `done_transfer; #50 assert(to_parent==`done_transfer); #50 from_parent = `done_transfer; #50 assert(to_child_0==`done_transfer); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `null; #50 assert(to_child_0==`null); $display("starting request_block test"); $display; #50 from_child_0 = `request_block; #50 assert(to_parent==`request_block); #50 from_parent = `ack_request; #50 assert(to_child_0==`ack_request); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; $display("Sending first byte"); //$display("foo"); //this is where I skipped the state number #50 assert(to_child_0==`byte_there); //$display("bar"); $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); //$display("byte acked"); #50 from_parent = `null; #50 assert(to_child_0==`null); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; #50 assert(to_child_0==`byte_there); $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_0==`null); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; #50 assert(to_child_0==`byte_there); $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_0==`null); $display; #50 from_child_0 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_0==`null); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); #50 from_parent = `done_transfer; #50 assert(to_child_0==`done_transfer); $display; #50 from_child_0 = `done_transfer; #50 assert(to_parent==`done_transfer); #50 from_parent = `null; #50 assert(to_child_0==`null); $display; #50 from_child_0 = `null; #50 assert(to_parent==`null); */ /* $display("starting child_1 test"); $display; #50 from_child_1 = `request_block; #50 assert(to_parent==`request_block); #50 from_parent = `ack_request; #50 assert(to_child_1==`ack_request); $display; #50 from_child_1 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; //$display("foo"); //this is where I skipped the state number #50 assert(to_child_1==`byte_there); //$display("bar"); $display; #50 from_child_1 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_1==`null); $display; #50 from_child_1 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; #50 assert(to_child_1==`byte_there); $display; #50 from_child_1 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_1==`null); $display; #50 from_child_1 = `null; #50 assert(to_parent==`null); #50 from_parent = `byte_there; #50 assert(to_child_1==`byte_there); $display; #50 from_child_1 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_1==`null); $display; #50 from_child_1 = `byte_there; #50 assert(to_parent==`byte_there); #50 from_parent = `null; #50 assert(to_child_1==`null); $display; #50 from_child_1 = `null; #50 assert(to_parent==`null); #50 from_parent = `done_transfer; #50 assert(to_child_1==`done_transfer); $display; #50 from_child_1 = `done_transfer; #50 assert(to_parent==`done_transfer); #50 from_parent = `null; #50 assert(to_child_1==`null); $display; #50 from_child_1 = `null; #50 assert(to_parent==`null); */ $display("Starting Contention test 0"); $display; #50 from_child_1 = `done_block; #10 from_child_0 = `request_block; #40 assert(to_parent == `done_block); #50 from_parent = `start_transfer; #50 assert(to_child_1 == `start_transfer); assert(to_child_0 == `null); /* #85 reset = 0; #15 reset = 1; #50 from_child_1 = `done_block; from_child_0 = `done_block; #50 assert(to_parent == `done_block); #50 from_parent = `start_transfer; #50 assert(to_child_0 == `start_transfer); assert(to_child_1 == `null); */ #50 $finish; end // initial begin task assert; input condition; if(!condition) begin $display("WARNING: Condition failed."); $finish; end // if (!condition) endtask // assert endmodule // rtrtest