phanrahan / magma

magma circuits
Other
241 stars 23 forks source link

Clean up naming conventions and interfaces for defining, instancing, and wiring up circuits #24

Closed leonardt closed 6 years ago

leonardt commented 7 years ago

Begin with two abstract inputs:

I0 = In(Array(2, Bit))
I1 = In(Array(2, Bit))

Pattern 1: DefineName(args) defines a circuit, which can be instanced and wired up normally

Add2 = DefineAdd(width=2)
add2 = Add2(**instance_args)
add2_O = add2(I0, I1)

Pattern 2: Name(args) defines or retrieves a cached definition of the circuit and instances it

add2 = Add(2, **instance_args) 
add2_O = add2(I0, I1)

Pattern 3: name(args) infers the widths of the inputs, defines or retrieves a cached definition of the circuit, instances it, wires up inputs, and returns output

add2_O = add(I0, I1, **instance_args)
leonardt commented 7 years ago

@phanrahan Updated the top issue here to reflect our discussion this morning w.r.t. the naming conventions and interface for defining/instancing/wiring up circuits. Let me know if there's anything I missed or messed up.

leonardt commented 6 years ago

I believe this is mostly done in mantle, and #73 covers the coreir primitive so I will close this for now. We can open up more specific issues related to this.