Wired-0.2: Examples/UsingWired.hs
import Lava.Patterns
import Wired
import Libs.Nangate45.Wired
import qualified Libs.Nangate45.Lava as L
circ1 = and2_x1 ->- copy .>. and2_x1 ->- copy .>. and2_x1 ->- space 10000e-9
circ2 = rightwards $ circ1 =<< input
circ3 = rightwards $ do
(a,b) <- input
circ1 (a,b)
-- Same as circ2. Note that input can create several inputs in one go.
circ4 = upwards $ circ1 =<< input
circ5 = rightwards
$ input
>>= rotate 1 . guide 1 800e-9
>>= space 1000e-9
>>= circ1
-- In order to show the primary input nets, this definition has a guide
-- followed by some space to the left of circ1. Since the input is a pair of
-- signals, there are actually two guides beside each other. Each guide is
-- 800 nm wide, and is located on metal layer 1. By rotating the guides, they
-- get placed upwards instead of rigthwards.
circ6 = rightwards . (and2_x1 ->- copy .>. L.and2_x1 ->- space 4000e-9)
test1 = simulate circ1 (1,1)
-- A Wired circuit is simulated just like a Lava circuit.
test2 = renderWiredWithNets "circ" circ2
-- Draws a picture of the layout to the file circ.ps. The space in circ1 is
-- only to make the picture look smaller (it is always scaled to fit on an A4
-- page). Note that the low inputs are connected in a single net.
test3 = renderWiredWithNets "circ" circ4
-- Same circuit with upwards placement.
test4 = renderWiredWithNets "circ" $ rotate 1 circ2
-- circ3 rotated 1 step counter-clockwise. Try also flipX and flipY.
test5 = renderWiredWithNets "circ" circ5
test6 = renderWiredWithNets "circ" $ circ6 =<< input
-- Lava gates can be used happily together with Wired gates. They just don't
-- show up in the pictures.