Ejemplo n.º 1
0
            m.d.comb += [
                vga_pads.red.eq(still.red),
                vga_pads.green.eq(still.green),
                vga_pads.blue.eq(still.blue),
            ]
        with m.Else():
            m.d.comb += [
                vga_pads.red.eq(test_pattern.red),
                vga_pads.green.eq(test_pattern.green),
                vga_pads.blue.eq(test_pattern.blue),
            ]

        m.submodules.uart = uart = UARTLoopback(
            uart_pads,
            clk_freq=12e6,
            baud_rate=115200,
        )
        m.d.comb += [
            leds.eq(uart.rx_data[0:2]),
        ]

        return m


if __name__ == '__main__':
    top = PixtolicTop(color_depth=4)
    platform = ICEBreakerPlatform()
    platform.add_resources(vga_pmod)
    products = platform.build(top, do_build=True, do_program=False)
    platform.toolchain_program(products, 'top')
Ejemplo n.º 2
0
    def elaborate(self, _platform):
        m = Module()

        with m.Switch(self.digit):
            for n, seg_val in enumerate([
                    0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110,
                    0b1101101, 0b1111101, 0b0000111, 0b1111111, 0b1101111,
                    0b1110111, 0b1111100, 0b0111001, 0b1011110, 0b1111001,
                    0b1110001
            ]):
                with m.Case(n):
                    m.d.sync += self.segments.eq(seg_val)

        return m


if __name__ == "__main__":
    # In this example, explicitly show the intermediate classes used to
    # execute build() to demonstrate that a user can inspect
    # each part of the build process (create files, execute, program,
    # and create a zip file if you have a BuildPlan instance).
    plat = ICEBreakerPlatform()
    plat.add_resources(seven_seg_pmod)

    # BuildPlan if do_build=False
    # BuildProducts if do_build=True and do_program=False
    # None otherwise.
    plan = plat.build(Top(), do_build=False, do_program=False)  # BuildPlan
    products = plan.execute()  # BuildProducts
    plat.toolchain_program(products, "top")  # Manally run the programmer.