def setUp (self):
     self.tb = gr.top_block ()
     self.c = phy(slow_rate=True)
     self.dqcsk_mapper = ieee802_15_4.dqcsk_mapper_fc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqcsk_demapper = ieee802_15_4.dqcsk_demapper_cf(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)   
     self.dqpsk_mapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=True)
     self.dqpsk_demapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=False) 
     self.qpsk_mapper = ieee802_15_4.qpsk_mapper_if() 
     self.qpsk_demapper = ieee802_15_4.qpsk_demapper_fi() 
     self.preamble_sfd_prefixer_I = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_I = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.preamble_sfd_prefixer_Q = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_Q = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.interleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.interleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.deinterleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.deinterleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.codeword_mapper_I = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_mapper_Q = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_I = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_Q = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.demux = blocks.deinterleave(gr.sizeof_char*1,1)
     self.mux = blocks.interleave(gr.sizeof_char*1,1)
     self.zeropadding = ieee802_15_4.zeropadding_b(self.c.padded_zeros)
     self.zeropadding_removal = ieee802_15_4.zeropadding_removal_b(self.c.phy_packetsize_bytes*8+len(self.c.PHR), self.c.padded_zeros)
     self.phr_prefixer = ieee802_15_4.phr_prefixer(self.c.PHR)
     self.phr_removal = ieee802_15_4.phr_removal(self.c.PHR)
     self.fragmentation = ieee802_15_4.fragmentation(self.c.phy_packetsize_bytes)
 def setUp (self):
     self.tb = gr.top_block ()
     self.c = phy(slow_rate=True)
     self.dqcsk_mapper = ieee802_15_4.dqcsk_mapper_fc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqcsk_demapper = ieee802_15_4.dqcsk_demapper_cc(self.c.chirp_seq, self.c.time_gap_1, self.c.time_gap_2, c.n_sub, self.c.n_subchirps)
     self.dqpsk_mapper = ieee802_15_4.dqpsk_mapper_ff(framelen=self.c.nsym_frame, forward=True)
     self.dqpsk_demapper = ieee802_15_4.dqpsk_soft_demapper_cc(framelen=self.c.nsym_frame)
     self.qpsk_mapper = ieee802_15_4.qpsk_mapper_if() 
     self.qpsk_demapper = ieee802_15_4.qpsk_demapper_fi() 
     self.preamble_sfd_prefixer_I = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_I = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.preamble_sfd_prefixer_Q = ieee802_15_4.preamble_sfd_prefixer_ii(self.c.preamble, self.c.SFD, self.c.nsym_frame)
     self.preamble_sfd_removal_Q = blocks.keep_m_in_n(gr.sizeof_int, self.c.nsym_frame - len(self.c.preamble) - len(self.c.SFD), self.c.nsym_frame, len(self.c.preamble)+len(self.c.SFD))
     self.interleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.interleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=True)
     self.deinterleaver_I = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.deinterleaver_Q = ieee802_15_4.interleaver_ii(self.c.intlv_seq, forward=False)
     self.codeword_mapper_I = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_mapper_Q = ieee802_15_4.codeword_mapper_bi(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_I = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.codeword_demapper_Q = ieee802_15_4.codeword_demapper_ib(self.c.bits_per_symbol, self.c.codewords)
     self.demux = blocks.deinterleave(gr.sizeof_char*1,1)
     self.mux = blocks.interleave(gr.sizeof_char*1,1)
     self.zeropadding = ieee802_15_4.zeropadding_b(self.c.padded_zeros)
     self.zeropadding_removal = ieee802_15_4.zeropadding_removal_b(self.c.phy_packetsize_bytes*8+len(self.c.PHR), self.c.padded_zeros)
     self.phr_prefixer = ieee802_15_4.phr_prefixer(self.c.PHR)
     self.phr_removal = ieee802_15_4.phr_removal(self.c.PHR)
     self.fragmentation = ieee802_15_4.fragmentation(self.c.phy_packetsize_bytes)
Beispiel #3
0
 def test_002_t(self):
     # set up fg
     cfg = phy()
     angle_in = (np.exp(1j * 0), np.exp(1j * np.pi / 2), np.exp(1j * np.pi),
                 np.exp(1j * -np.pi / 2))
     data_in = np.concatenate((cfg.chirp_seq.copy(), cfg.time_gap_1))
     for i in range(4):
         data_in[i * c.n_sub:(i + 1) *
                 c.n_sub] = data_in[i * c.n_sub:(i + 1) *
                                    c.n_sub] * angle_in[i]
     self.src = blocks.vector_source_c(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_demapper_cc(cfg.chirp_seq,
                                                 cfg.time_gap_1,
                                                 cfg.time_gap_2, c.n_sub,
                                                 cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run()
     # check data
     data_out = self.snk.data()
     refval = np.dot(cfg.chirp_seq[:c.n_sub],
                     np.conj(cfg.chirp_seq[:c.n_sub]))
     ref = [angle_in[i] * refval for i in range(len(angle_in))]
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
Beispiel #4
0
 def test_001_t(self):
     # set up fg
     cfg = phy()
     data_in = np.concatenate(
         (cfg.chirp_seq, cfg.time_gap_1, cfg.chirp_seq, cfg.time_gap_2,
          cfg.chirp_seq, cfg.time_gap_1))
     self.src = blocks.vector_source_c(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_demapper_cc(cfg.chirp_seq,
                                                 cfg.time_gap_1,
                                                 cfg.time_gap_2, c.n_sub,
                                                 cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run()
     refval = np.dot(cfg.chirp_seq[:c.n_sub],
                     np.conj(cfg.chirp_seq[:c.n_sub]))
     # check data
     ref = [refval for i in range(12)]
     data_out = self.snk.data()
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     # f,axarr = plt.subplots(2)
     # axarr[0].plot(np.real(ref))
     # axarr[1].plot(np.real(data_out))
     # plt.show()
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
 def test_003_t (self):
     # set up fg
     cfg = phy()
     data_in = np.pi/2*np.random.randint(-1,3,(1000,))
     self.src = blocks.vector_source_f(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_mapper_fc(cfg.chirp_seq, cfg.time_gap_1, cfg.time_gap_2, c.n_sub, cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run ()
     # check data
     data_out = self.snk.data()
     
     ref = np.array([])
     seq = cfg.chirp_seq.copy()
     lensub = c.n_sub
     nseq = len(data_in)/cfg.n_subchirps
     len_t1 = len(cfg.time_gap_1)
     len_t2 = len(cfg.time_gap_2)
     seq_ctr = 0
     for i in range(nseq):
         for k in range(cfg.n_subchirps):
             ref = np.concatenate((ref, seq[k*lensub:(k+1)*lensub]*np.exp(1j*data_in[i*cfg.n_subchirps+k])))
         if seq_ctr % 2 == 0:
             ref = np.concatenate((ref, cfg.time_gap_1))
         else:
             ref = np.concatenate((ref, cfg.time_gap_2))
         seq_ctr = (seq_ctr+1) % 2
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
Beispiel #6
0
    def test_003_t(self):
        # set up fg
        cfg = phy()
        data_in = np.pi / 2 * np.random.randint(-1, 3, (1000, ))
        self.src = blocks.vector_source_f(data_in)
        self.dqcsk = ie802_15_4.dqcsk_mapper_fc(cfg.chirp_seq, cfg.time_gap_1,
                                                cfg.time_gap_2, c.n_sub,
                                                cfg.n_subchirps, 1000)
        self.snk = blocks.vector_sink_c(1)
        self.tb.connect(self.src, self.dqcsk, self.snk)
        self.tb.run()
        # check data
        data_out = self.snk.data()

        ref = np.array([])
        seq = cfg.chirp_seq.copy()
        lensub = c.n_sub
        nseq = len(data_in) / cfg.n_subchirps
        len_t1 = len(cfg.time_gap_1)
        len_t2 = len(cfg.time_gap_2)
        seq_ctr = 0
        for i in range(nseq):
            for k in range(cfg.n_subchirps):
                ref = np.concatenate(
                    (ref, seq[k * lensub:(k + 1) * lensub] *
                     np.exp(1j * data_in[i * cfg.n_subchirps + k])))
            if seq_ctr % 2 == 0:
                ref = np.concatenate((ref, cfg.time_gap_1))
            else:
                ref = np.concatenate((ref, cfg.time_gap_2))
            seq_ctr = (seq_ctr + 1) % 2
        # print "ref:", ref[:10]
        # print "data:", data_out[:10]
        self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
Beispiel #7
0
    def test_001_t(self):
        # set up fg
        cfg = phy(slow_rate=False)
        data_in = range(541)  # some random prime number
        self.src = blocks.vector_source_f(data_in)
        self.intlv = ieee802_15_4.deinterleaver_ff(intlv_seq=())
        self.snk = blocks.vector_sink_f(1)
        self.tb.connect(self.src, self.intlv, self.snk)
        self.tb.run()

        # check data
        data_out = self.snk.data()
        self.assertFloatTuplesAlmostEqual(data_in, data_out)
    def test_001_t (self):
        # set up fg
        cfg = phy(slow_rate=False)
        data_in = range(541) # some random prime number
        self.src = blocks.vector_source_f(data_in)
        self.intlv = ieee802_15_4.deinterleaver_ff(intlv_seq=())
        self.snk = blocks.vector_sink_f(1)
        self.tb.connect(self.src, self.intlv, self.snk)
        self.tb.run ()

        # check data
        data_out = self.snk.data()
        self.assertFloatTuplesAlmostEqual(data_in, data_out) 
    def test_004_t (self):
        # set up fg
        cfg = phy(slow_rate=True)
        data_in = range(3*len(cfg.intlv_seq)) # some random prime number
        self.src = blocks.vector_source_i(data_in)
        self.intlv = ieee802_15_4.interleaver_ii(intlv_seq=cfg.intlv_seq,forward=True)
        self.deintlv = ieee802_15_4.interleaver_ii(intlv_seq=cfg.intlv_seq,forward=False)
        self.snk = blocks.vector_sink_i(1)
        self.tb.connect(self.src, self.intlv, self.deintlv, self.snk)
        self.tb.run ()

        # check data
        data_out = self.snk.data()
        self.assertFloatTuplesAlmostEqual(data_in, data_out)         
 def test_001_t (self):
     # set up fg
     cfg = phy()
     data1 = range(cfg.nsym_frame-len(cfg.preamble)-len(cfg.SFD))
     data2 = range(cfg.nsym_frame-len(cfg.preamble)-len(cfg.SFD), 2*(cfg.nsym_frame-len(cfg.preamble)-len(cfg.SFD)))
     data_in = np.concatenate((data1, data2))
     self.src = blocks.vector_source_i(data_in)
     self.prefixer = ieee802_15_4.preamble_sfd_prefixer_ii(cfg.preamble, cfg.SFD, cfg.nsym_frame)
     self.snk = blocks.vector_sink_i(1)
     self.tb.connect(self.src, self.prefixer, self.snk)
     self.tb.run ()
     # check data
     data_out = self.snk.data()
     ref = np.concatenate((cfg.preamble, cfg.SFD, data1, cfg.preamble, cfg.SFD, data2))
     self.assertFloatTuplesAlmostEqual(data_out, ref)
 def test_001_t(self):
     # set up fg
     cfg = phy()
     cw = cfg.codewords
     data_in = np.concatenate((cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]))
     self.src = blocks.vector_source_f(data_in)
     self.enc = ieee802_15_4.codeword_soft_demapper_fb(bits_per_cw=cfg.bits_per_symbol, codewords=cw)
     self.snk = blocks.vector_sink_b(1)
     self.tb.connect(self.src, self.enc, self.snk)
     self.tb.run()
     # check data
     bits = (0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1)
     data_out = self.snk.data()
     print "data_out:", data_out
     print "ref:", bits
     self.assertFloatTuplesAlmostEqual(data_out, bits)
Beispiel #12
0
    def test_004_t(self):
        # set up fg
        cfg = phy(slow_rate=True)
        data_in = range(3 * len(cfg.intlv_seq))  # some random prime number
        self.src = blocks.vector_source_i(data_in)
        self.intlv = ieee802_15_4.interleaver_ii(intlv_seq=cfg.intlv_seq,
                                                 forward=True)
        self.deintlv = ieee802_15_4.interleaver_ii(intlv_seq=cfg.intlv_seq,
                                                   forward=False)
        self.snk = blocks.vector_sink_i(1)
        self.tb.connect(self.src, self.intlv, self.deintlv, self.snk)
        self.tb.run()

        # check data
        data_out = self.snk.data()
        self.assertFloatTuplesAlmostEqual(data_in, data_out)
Beispiel #13
0
 def test_001_t (self):
     # set up fg
     cfg = phy()
     cw = cfg.codewords
     data_in = np.concatenate((cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]))
     self.src = blocks.vector_source_i(data_in)
     self.enc = ieee802_15_4.codeword_demapper_ib(bits_per_cw=cfg.bits_per_symbol,codewords=cw)
     self.snk = blocks.vector_sink_b(1)
     self.tb.connect(self.src, self.enc, self.snk)
     self.tb.run()
     # check data
     bits = (0,0,0, 0,0,1, 0,1,0, 0,1,1, 1,0,0, 1,0,1, 1,1,0, 1,1,1)
     data_out = self.snk.data()
     print("data_out:", data_out)
     print("ref:", bits)
     self.assertFloatTuplesAlmostEqual(data_out, bits)
 def test_002_t (self):
     # set up fg
     cfg = phy()
     data_in = [0, np.pi/2, np.pi, -np.pi/2]
     self.src = blocks.vector_source_f(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_mapper_fc(cfg.chirp_seq, cfg.time_gap_1, cfg.time_gap_2, c.n_sub, cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run ()
     # check data
     data_out = self.snk.data()
     ref = np.concatenate((cfg.chirp_seq.copy(), cfg.time_gap_1))
     for i in range(4):
     	ref[i*c.n_sub:(i+1)*c.n_sub] = ref[i*c.n_sub:(i+1)*c.n_sub]*np.exp(1j*data_in[i])
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
Beispiel #15
0
    def test_002_t(self):
        # set up fg
        cfg = phy(slow_rate=True)
        data_in = range(3 * len(cfg.intlv_seq))
        self.src = blocks.vector_source_f(data_in)
        self.intlv = ieee802_15_4.deinterleaver_ff(intlv_seq=cfg.intlv_seq)
        self.snk = blocks.vector_sink_f(1)
        self.tb.connect(self.src, self.intlv, self.snk)
        self.tb.run()

        # check data
        data_out = self.snk.data()
        ref = []
        for n in range(3):
            for i in range(len(cfg.intlv_seq)):
                ref.append(data_in[n * len(cfg.intlv_seq) + cfg.intlv_seq[i]])
        self.assertFloatTuplesAlmostEqual(ref, data_out)
    def test_002_t (self):
		# set up fg
		cfg = phy(slow_rate=True)
		data_in = range(3*len(cfg.intlv_seq))
		self.src = blocks.vector_source_f(data_in)
		self.intlv = ieee802_15_4.deinterleaver_ff(intlv_seq=cfg.intlv_seq)
		self.snk = blocks.vector_sink_f(1)
		self.tb.connect(self.src, self.intlv, self.snk)
		self.tb.run ()

		# check data
		data_out = self.snk.data()
		ref = []
		for n in range(3):
			for i in range(len(cfg.intlv_seq)):
				ref.append(data_in[n*len(cfg.intlv_seq)+cfg.intlv_seq[i]])       
		self.assertFloatTuplesAlmostEqual(ref, data_out)              
Beispiel #17
0
 def test_002_t (self):
     # set up fg
     cfg = phy()
     data_in = [0, np.pi/2, np.pi, -np.pi/2]
     self.src = blocks.vector_source_f(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_mapper_fc(cfg.chirp_seq, cfg.time_gap_1, cfg.time_gap_2, c.n_sub, cfg.n_subchirps, 4)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run ()
     # check data
     data_out = self.snk.data()
     ref = np.concatenate((cfg.chirp_seq.copy(), cfg.time_gap_1))
     for i in range(4):
     	ref[i*c.n_sub:(i+1)*c.n_sub] = ref[i*c.n_sub:(i+1)*c.n_sub]*np.exp(1j*data_in[i])
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
 def test_002_t (self):
     # set up fg
     cfg = phy()
     angle_in = (np.exp(1j*0), np.exp(1j*np.pi/2), np.exp(1j*np.pi), np.exp(1j*-np.pi/2))
     data_in = np.concatenate((cfg.chirp_seq.copy(), cfg.time_gap_1))
     for i in range(4):
     	data_in[i*c.n_sub:(i+1)*c.n_sub] = data_in[i*c.n_sub:(i+1)*c.n_sub]*angle_in[i]        
     self.src = blocks.vector_source_c(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_demapper_cc(cfg.chirp_seq, cfg.time_gap_1, cfg.time_gap_2, c.n_sub, cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run ()
     # check data
     data_out = self.snk.data()
     refval = np.dot(cfg.chirp_seq[:c.n_sub], np.conj(cfg.chirp_seq[:c.n_sub]))
     ref = [angle_in[i]*refval for i in range(len(angle_in))]
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     self.assertComplexTuplesAlmostEqual(data_out, ref, 5)
 def test_001_t (self):
     # set up fg
     cfg = phy()
     data_in = np.concatenate((cfg.chirp_seq, cfg.time_gap_1, cfg.chirp_seq, cfg.time_gap_2, cfg.chirp_seq, cfg.time_gap_1))
     self.src = blocks.vector_source_c(data_in)
     self.dqcsk = ieee802_15_4.dqcsk_demapper_cc(cfg.chirp_seq, cfg.time_gap_1, cfg.time_gap_2, c.n_sub, cfg.n_subchirps)
     self.snk = blocks.vector_sink_c(1)
     self.tb.connect(self.src, self.dqcsk, self.snk)
     self.tb.run ()
     # check data
     ref = [1 for i in range(12)]
     data_out = self.snk.data()
     # print "ref:", ref[:10]
     # print "data:", data_out[:10]
     # f,axarr = plt.subplots(2)
     # axarr[0].plot(np.real(ref))
     # axarr[1].plot(np.real(data_out))
     # plt.show()
     self.assertComplexTuplesAlmostEqual(data_out, ref)
 def test_001_t(self):
     # set up fg
     cfg = phy()
     bits = (0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1)
     cw = cfg.codewords
     self.src = blocks.vector_source_b(bits)
     self.enc = ieee802_15_4.codeword_mapper_bi(bits_per_cw=cfg.bits_per_symbol, codewords=cw)
     self.snk = blocks.vector_sink_i(1)
     self.snk2 = blocks.vector_sink_b(1)
     self.tb.connect(self.src, self.enc, self.snk)
     self.tb.connect(self.src, self.snk2)
     self.tb.run()
     # check data
     data = self.snk.data()
     print "len data:", len(self.snk2.data())
     print "rx data:", data
     ref = np.concatenate((cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]))
     print "ref:", ref
     self.assertFloatTuplesAlmostEqual(data, ref)
Beispiel #21
0
 def test_001_t(self):
     # set up fg
     cfg = phy()
     bits = (0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0,
             1, 1, 1)
     cw = cfg.codewords
     self.src = blocks.vector_source_b(bits)
     self.enc = ieee802_15_4.codeword_mapper_bi(
         bits_per_cw=cfg.bits_per_symbol, codewords=cw)
     self.snk = blocks.vector_sink_i(1)
     self.snk2 = blocks.vector_sink_b(1)
     self.tb.connect(self.src, self.enc, self.snk)
     self.tb.connect(self.src, self.snk2)
     self.tb.run()
     # check data
     data = self.snk.data()
     print "len data:", len(self.snk2.data())
     print "rx data:", data
     ref = np.concatenate(
         (cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]))
     print "ref:", ref
     self.assertFloatTuplesAlmostEqual(data, ref)