diff --git a/RTL/program3_tb.sv b/RTL/program3_tb.sv index a71a19c..f1b13ea 100644 --- a/RTL/program3_tb.sv +++ b/RTL/program3_tb.sv @@ -2,13 +2,13 @@ // testbench for programmable message decryption, space removal (Program #3) // CSE141L // runs program 2 (decrypt a message), but with corruption -module decrypt_depad_tb () ; -// DUT interface +module program3_tb () ; +// DUT interface logic clk = 1'b0 , // advances simulation step-by-step init = 1'b1 , // init (reset) command to DUT start = 1'b1 ; // req (start program) command to DUT wire done ; // done flag returned by DUT -// test bench parameters +// test bench parameters logic[3:0] pre_length ; // space char. bytes before first char. in message logic[7:0] message1[49] , // original raw message, in binary msg_padded1[80], // original message, plus pre- and post-padding w/ ASCII spaces @@ -21,16 +21,16 @@ module decrypt_depad_tb () ; // our original American Standard Code for Information Interchange message follows // note in practice your design should be able to handle ANY ASCII string that is // restricted to characters between space (0x20) and script f (0x9f) and shorter than -// 53 characters in length +// 53 characters in length // *** No more than 24 leading space characters, including preamble. *** -// string str1 = +// string str1 = // string str1 = "Mr. Watson, come here. I want to see you."; // sample program 1 input // string str1 = " Knowledge comes, but wisdom lingers. "; // alternative inputs // string str1 = " 01234546789abcdefghijklmnopqrstuvwxyz. "; // (make up your own, // string str1 = " A joke is a very serious thing."; // as well) string str1 = " Ajok "; // -// string str1 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; -// string str1 = "``@@```@@@````@@@@````@@@@@"; +// string str1 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; +// string str1 = "``@@```@@@````@@@@````@@@@@"; // string str1 = " Knowledge comes, but wisdom lingers. "; // // displayed encrypted string will go here: @@ -42,7 +42,7 @@ module decrypt_depad_tb () ; logic[5:0] flipper; // corruptor -- bit flip logic[79:0] flipped = 80'b0; // tracks which word got a bit flipped // the 8 possible maximal-length feedback tap patterns from which to choose - assign LFSR_ptrn[0] = 7'h60; // 110_0000 + assign LFSR_ptrn[0] = 7'h60; // 110_0000 assign LFSR_ptrn[1] = 7'h48; // 100_1000 assign LFSR_ptrn[2] = 7'h78; assign LFSR_ptrn[3] = 7'h72; @@ -83,7 +83,7 @@ module decrypt_depad_tb () ; // you may also pre-load desired constants, etc. into // your data_mem here -- the upper addresses are reserved for your use // dut.data_mem.DM[128]=8'hfe; //whatever constants you want - file_no = 1; // write to transcript + file_no = 1; // write to transcript // file_no = $fopen("msg_decoder_out.txt"); // create your output file #0ns strlen = str1.len; // length of string 1 (# characters between " ") if(strlen>52) strlen = 52; // clip message at 52 characters @@ -95,9 +95,9 @@ module decrypt_depad_tb () ; $fdisplay(file_no,"run encryption program; original message = "); $fdisplay(file_no,"%s",str1); // print original message in transcript window $fdisplay(file_no,"LFSR_ptrn = 0x%h, LFSR_init = 0x%h, pre_length: %d",lfsr_ptrn,LFSR_init,pre_length); - $fdisplay(file_no,"pt_no = %d",pt_no); - -// will subtract 0x20 from each preamble and messge character to fit into 7 bits + $fdisplay(file_no,"pt_no = %d",pt_no); + +// will subtract 0x20 from each preamble and messge character to fit into 7 bits for(int j=0; j<80; j++) // pre-fill message_padded with ASCII space characters msg_padded1[j] = 8'h20; // for(int l=0; l