comp = block(size=p(4, 4), nodesep=(6, 2)) ps_comp = block(size=p(6, 6), nodesep=(2, 3)) bus_cap = cap(length=0.4, width=0.6, inset=0, type='Stealth') bus = path(style=(None, bus_cap), line_width=0.3, double=True, border_width=0.06) bus_text = text(font="\\scriptsize", margin=p(0, 0.5)) functor = part("Tuple fmap") functor['split'] = comp("split", size=(4, 4)) functor['f1'] = comp(r"$\times 2$", size=(4, 3)).right(functor['split']).aligny( functor['split'].w(1), prev().s(0)) functor['f2'] = comp(r"$\times 2$", size=(4, 3)).below(functor['f1']) functor['concat'] = comp("ccat", size=(4, 4)).right(functor['f1']).aligny( functor['split'].p) prod2split = bus(functor['split'].w(0.5) - p(4, 0), functor['split'].w(0.5)) fig << prod2split fig << bus_text("(u16, u16)").align(prod2split.pos(0.5), prev().s(0.5, 0.2)) for i in range(2): conn = bus(functor['split'].e(i * 2 + 1), functor[f'f{i+1}'].w(0.5) - (2, 0), functor[f'f{i+1}'].w(0.5), routedef='-|') fig << bus_text("u16").align(conn.pos(0), prev().s(-0.4, 0.1))
color="black!40", style=('', bus_cap), shorten=p(0.2, 0.2), line_width=0.3, border_width=0.06, double=True) bus_text = text(font="\\footnotesize", margin=p(0.5, 0.35)) gear = block(size=p(6, 4), nodesep=p(2, 2)) fig['drv'] = gear('drv', size=p(6, 2)) fig['riscv'] = gear('riscv').right(fig['drv'], 3) fig['register_file'] = gear('register_file').below(fig['riscv']) fig << bus(fig['drv'].e(1), fig['riscv'].w(1)) fig << bus_text("instruction").align(fig[-1].pos(0), prev().s()) fig << bus( fig['riscv'].e(1), poffx(7), fig['register_file'].e(3), routedef='|-') fig << bus_text("reg_file_rd_req").align(fig[-1].pos(0), prev().s()) fig << bus( fig['riscv'].e(3), poffx(5), fig['register_file'].e(1), routedef='|-') fig << bus_text("reg_file_wr_req").align(fig[-1].pos(0), prev().s()) fig << bus( fig['register_file'].w(0.5), poffx(-3), fig['riscv'].w(3), routedef='|-') fig << bus_text("reg_rd_data").align(fig[-1].pos(1.0), prev().s(1.1)) fig << text( r"\textasciitilde", font="\\Huge").align(fig[-1].s(0.54), prev().n(0.5))
group_margin=[p(1, 3), p(1, 2)]) comp = block(size=p(6, 4), nodesep=(6, 2)) ps_comp = block(size=p(6, 6), nodesep=(2, 3)) bus_cap = cap(length=0.4, width=0.6, inset=0, type='Stealth') bus = path(style=(None, bus_cap), line_width=0.3, double=True, border_width=0.06) bus_text = text(font="\\scriptsize", margin=p(0, 0.5)) functor = part("stereo_echo") functor['split'] = comp("Split", size=(4, 6)) functor['f1'] = comp("echo", size=(4, 4)).right(functor['split']).aligny( functor['split'].w(2), prev().s(0)) functor['f2'] = comp("echo", size=(4, 4)).below(functor['f1']) functor['concat'] = comp("Concat", size=(4, 6)).right(functor['f1']).aligny( functor['split'].p) producer = comp("Producer").left(functor['split'], 1).aligny(functor['split'].e(0.5), prev().e(0.5)) prod2split = bus(functor['split'].w(0.5), poffx(-6), style=(bus_cap, None)) fig << prod2split fig << bus_text("(i16, i16)").align(prod2split.pos(0.9), prev().s(0, 0.2)) for i in range(2): conn = bus(functor['split'].e(i * 4 + 1),
group_margin=[p(1, 3), p(1, 2)]) comp = block(size=p(6, 4), nodesep=(6, 2)) ps_comp = block(size=p(6, 6), nodesep=(2, 3)) bus_cap = cap(length=0.4, width=0.6, inset=0, type='Stealth') bus = path(style=(None, bus_cap), line_width=0.3, double=True, border_width=0.06) bus_text = text(font="\\scriptsize", margin=p(0, 0.5)) functor = part("Union Functor") functor['demux'] = comp("Demux", size=(4, 6)) functor['f1'] = comp("u16 - 1", size=(4, 4)).right(functor['demux']).aligny( functor['demux'].w(2), prev().s(0)) functor['f2'] = comp("q8.8 - 1", size=(4, 4)).below(functor['f1']) functor['mux'] = comp("Mux", size=(4, 6)).right(functor['f1']).aligny(functor['demux'].p) producer = comp("Producer").left(functor['demux']).aligny( functor['demux'].e(0.5), prev().e(0.5)) fig << producer prod2demux = bus(producer.e(0.5), functor['demux'].w(0.5)) fig << prod2demux fig << bus_text("u16 $|$ (u8, u8)").align(prod2demux.pos(0.5), prev().s(0.5, 0.2))
comp = block(size=p(4, 4), nodesep=(5, 2)) ps_comp = block(size=p(6, 6), nodesep=(2, 3)) bus_cap = cap(length=0.4, width=0.6, inset=0, type='Stealth') bus = path(style=(None, bus_cap), line_width=0.3, double=True, border_width=0.06) bus_text = text(font="\\scriptsize", margin=p(0, 0.5)) functor = part("Queue fmap") functor['split'] = comp("split", size=(4, 4)) functor['f1'] = comp(r"$\times 2$", size=(4, 3)).right(functor['split']).aligny( functor['split'].w(1), prev().s(0)) functor['concat'] = comp("concat", size=(4, 4)).right(functor['f1']).aligny( functor['split'].p) prod2split = bus(functor['split'].w(0.5) - p(4, 0), functor['split'].w(0.5)) fig << prod2split fig << bus_text("[u16]").align(prod2split.pos(0.5), prev().s(0.5, 0.2)) conn = bus(functor['split'].e(1), functor[f'f1'].w(0.5) - (2, 0), functor[f'f1'].w(0.5), routedef='-|') fig << bus_text("u16").align(conn.pos(0), prev().s(-0.4, 0.1)) fig << conn
echo['add'] = add_block() echo['decouple'] = block(r"decouple \\ (FIFO)", size=p(5, 4)).align(echo['add'].p + p(15, 3)) echo['dout'] = bus(echo['add'].e(0.5), prectx(echo['decouple'].n(1.0) + p(1, 1)), echo['decouple'].e(0.5), shorten=p(0.2, 0.2), routedef='|-') echo['prefill'] = block("prefill", size=p(5, 4)).left(echo['decouple'], 2) echo += bus(echo['decouple'].w(0.5), echo['prefill'].e(0.5)) echo['mul'] = mul_block().align(echo['prefill'].w(0.5) - p(4, 0), cur().e(0.5)) echo += bus(echo['prefill'].w(0.5), echo['mul'].e(0.5)) echo += bus_text("feedback").align(echo[-1].pos(0), prev().s(1.0)) echo += bus(echo['mul'].w(0.5), echo['add'].s(0.5), routedef='-|') echo += bus(echo['mul'].s(0.5), poffy(2), poffx(-6.5), routedef='-|', style=(bus_cap, None)) echo += bus_text("feedback_gain").align(echo[-1].pos(1), prev().s()) fig << make_external(echo['add'].w(0.5), direction='i') fig << bus_text("samples").aligny(echo['add'].w(0.5), prev().s()).alignx(echo.w(), prev().s())