question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Composability of subcircuits

See original GitHub issue

Let’s say that I have a subcircuit for the main part of a buck converter, and I’ve parameterized it to accept an arbitrary inductor, diode, etc:


def buck_converter(
        nmos: Part,
        diode: Part,
        inductor: Part,
        cap_input: Part,
        cap_output: Part,
):
    @subcircuit
    def buck_impl(pwm: Net, v_in: Net, v_out: Net, gnd: Net):
        buck_inner_net = Net('buck_inner')

        nmos_inst = nmos.copy()
        nmos_inst['gate'] = pwm
        nmos_inst['drain'] = v_in
        nmos_inst['source'] = buck_inner_net

        inductor_inst = inductor.copy()
        inductor_inst['+'] = buck_inner_net
        inductor_inst['-'] = v_out

        diode_inst = diode.copy()
        diode_inst['-'] = buck_inner_net
        diode_inst['+'] = gnd

        cap_input_inst = cap_input.copy()
        cap_input_inst['+'] = v_in
        cap_input_inst['-'] = gnd
        cap_output_inst = cap_output.copy()
        cap_output_inst['+'] = v_in
        cap_output_inst['-'] = gnd

    return buck_impl

However, what if I want to replace the diode with synchronous rectification? What I’d like to be able to do is create another subcircuit that provides that functionality, and be able to pass it in as the diode parameter. As long as it has the same pin names, that should work.

However, I can’t do that, as the Circuit interface is nothing like the Part interface, and I can’t create a part with multiple components.

It seems to me that idea of a Circuit isn’t a very nice abstraction. It serves as a bag of parts and nets, a duplicate of the data that is already stored in the part and net graph. Why can’t that bag of parts and nets be built up as it is needed?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
matthuszaghcommented, Jan 15, 2020

Hi @flaviut, I’m curious if you’ve made any progress with this, as I’m also very interested in this functionality/think it’s a great idea.

2reactions
xesscorpcommented, May 9, 2019

The Circuit object didn’t come along until the latter part of SKiDL development. It was kind of a grab-bag of pieces. Re-thinking it as a type of Part makes sense.

I’m concerned about your mention of “non-backwards compatible”. To me, that means there would be current features of SKiDL that would not be available in a future version that used your ideas. I can’t really see why that would be. Maybe you mean something else.

I think getting the composability feature you want can be done with some tweaking of the Circuit object in the current version of SKiDL. However, a refactoring may lead to simplification and clearing of some of SKiDL’s underbrush. To that end, maybe I could make a branch where you could flesh-out some of your ideas and see where it leads.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Capacity of Neural Networks for Lifelong Learning of ...
The composability requirement constrains the model to ensure that, for each association as realized by a subcircuit, the excitation in the ...
Read more >
Capacity of Neural Networks for Lifelong Learning of ...
The composability requirement constrains the model to ensure that, for each association as realized by a subcircuit, the excitation in the triggering set...
Read more >
Low-Latency Hardware Private Circuits
Although several designs realizing such composable subcircuits – commonly referred to as gadgets – have been proposed, negligible research was conducted in ...
Read more >
Sequentially Composable Rational Proofs - Matteo Campanelli
In proving sequential composability it is useful to find a connection between the amount of work done by a dishonest prover and its...
Read more >
Capacity of Neural Networks for Lifelong Learning of ...
(4) Composable Subcircuits: A circuit acquired for a task should be of the form that its evaluation fits into a chain of evaluations...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found