|
Message
From: cvs at opencores.org<cvs@o...>
Date: Thu Jul 26 18:57:02 CEST 2007
Subject: [cvs-checkins] MODIFIED: dmt_tx ...
Date: 00/07/07 26:18:57 Modified: dmt_tx/const_encoder/tb tb_const_enc.v Log: Added test for 2-bit constellation map. Revision Changes Path 1.4 dmt_tx/const_encoder/tb/tb_const_enc.v http://www.opencores.org/cvsweb.shtml/dmt_tx/const_encoder/tb/tb_const_enc.v.diff?r1=1.3&r2=1.4 (In the diff below, changes in quantity of whitespace are not shown.) Index: tb_const_enc.v =================================================================== RCS file: /cvsroot/dannori/dmt_tx/const_encoder/tb/tb_const_enc.v,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- tb_const_enc.v 25 Jul 2007 01:17:43 -0000 1.3 +++ tb_const_enc.v 26 Jul 2007 16:57:01 -0000 1.4 @@ -45,8 +45,8 @@ reg [CONFAW-1:0] addr_i; reg [CONFDW-1:0] conf_data_i; wire [CNUMW-1:0] carrier_num_o; -wire [CONSTW-1:0] x_o; -wire [CONSTW-1:0] y_o; +wire signed [CONSTW-1:0] x_o; +wire signed [CONSTW-1:0] y_o; // // instantiate the DUT @@ -67,6 +67,11 @@ .x_o(x_o), .y_o(y_o)); +// +// instantiate test data modules +// +const_map_2bit cm_2bit(); + initial begin clk = 0; @@ -132,6 +137,11 @@ check_config(USED_C_ADR, 4); check_config(F_BITS_ADR, 7); + // + // checking the constellation map + // + check_const_map(2); + #1000 $finish(); end // main test @@ -215,4 +225,45 @@ endtask +// +// check constellation map +// +// This task feeds in data direct to the constellation encoder module +// and checks the expected outcome. +// +// Given parameter is the bit size of the constellation map. +// +task check_const_map(input [3:0] bit); + integer len; + integer i; + begin + len = 1 << bit; + for(i=0; i<len; i=i+1) begin + $display("Testing %d bit constellation with input value %d", bit, i); + // feed input data + dut.bit_load <= bit; + dut.cin <= i; + + @ (posedge clk); + @ (negedge clk); + // compare output with expected result + case (bit) + 1: $display("%d bit is not support constellation size", bit); + 2: begin + if(cm_2bit.re[i] !== x_o) begin + $display("Input: %d --> x_o expected: %d got: %d", i, cm_2bit.re[i], x_o); + end + if(cm_2bit.im[i] !== y_o) begin + $display("Input: %d --> y_o expected: %d got: %d", i, cm_2bit.im[i], y_o); + end + end + default: $display("%d is not an implemented bit size", bit); + endcase + + end + + end +endtask +
+
endmodule
|
 |