def test_00(self):
        expected_result = (
            0x00, 0x11, 0x22, 0x33,
            0x44, 0x55, 0x66, 0x77,
            0x88, 0x99, 0xaa, 0xbb,
            0xcc, 0xdd, 0xee, 0xff)

        # Filter taps to expand the data to oversample by 8
        # Just using a RRC for some basic filter shape
        taps = filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
        
        src = blocks.vector_source_b(expected_result)
        frame = digital.simple_framer(4)
        unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
        expand = filter.interp_fir_filter_fff(8, taps)
        b2f = blocks.char_to_float()
        mult2 = blocks.multiply_const_ff(2)
        sub1 = blocks.add_const_ff(-1)
        op = digital.simple_correlator(4)
        dst = blocks.vector_sink_b()
        self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
        self.tb.connect(expand, op, dst)
        self.tb.run()
        result_data = dst.data()

        self.assertEqual(expected_result, result_data)
Esempio n. 2
0
    def test_00(self):
        expected_result = (
            0x00, 0x11, 0x22, 0x33,
            0x44, 0x55, 0x66, 0x77,
            0x88, 0x99, 0xaa, 0xbb,
            0xcc, 0xdd, 0xee, 0xff)

        # Filter taps to expand the data to oversample by 8
        # Just using a RRC for some basic filter shape
        taps = gr.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
        
        src = gr.vector_source_b(expected_result)
        frame = digital.simple_framer(4)
        unpack = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
        expand = gr.interp_fir_filter_fff(8, taps)
        b2f = gr.char_to_float()
        mult2 = gr.multiply_const_ff(2)
        sub1 = gr.add_const_ff(-1)
        op = digital.simple_correlator(4)
        dst = gr.vector_sink_b()
        self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
        self.tb.connect(expand, op, dst)
        self.tb.run()
        result_data = dst.data()

        self.assertEqual(expected_result, result_data)
Esempio n. 3
0
    def test_simple_framer_001 (self):
        src_data = (0x00, 0x11, 0x22, 0x33,
                    0x44, 0x55, 0x66, 0x77,
                    0x88, 0x99, 0xaa, 0xbb,
                    0xcc, 0xdd, 0xee, 0xff)

        expected_result = (
            0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x00, 0x00, 0x11, 0x22, 0x33, 0x55,
            0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44, 0x55, 0x66, 0x77, 0x55,
            0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55,
            0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55)

        src = gr.vector_source_b (src_data)
        op = digital.simple_framer (4)
        dst = gr.vector_sink_b ()
        self.tb.connect (src, op)
        self.tb.connect (op, dst)
        self.tb.run ()
        result_data = dst.data ()
        self.assertEqual (expected_result, result_data)
Esempio n. 4
0
    def test_simple_framer_001(self):
        src_data = (0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
                    0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff)

        expected_result = (0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc,
                           0x00, 0x00, 0x11, 0x22, 0x33, 0x55, 0xac, 0xdd,
                           0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44,
                           0x55, 0x66, 0x77, 0x55, 0xac, 0xdd, 0xa4, 0xe2,
                           0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa,
                           0xbb, 0x55, 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c,
                           0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55)

        src = blocks.vector_source_b(src_data)
        op = digital.simple_framer(4)
        dst = blocks.vector_sink_b()
        self.tb.connect(src, op)
        self.tb.connect(op, dst)
        self.tb.run()
        result_data = dst.data()
        self.assertEqual(expected_result, result_data)