Wired-0.1: Examples/UsingWired.hs
import Wired
import Libs.Simple130nm.Wired
import qualified Libs.Simple130nm.Lava as L
circ1 = and2 ->- copy .>. and2 ->- copy .>. and2 ->- space 10000 {-nanometers-}
circ2 = rightwards $ circ1 (low,low)
circ3 = rightwards $ input "in" >>= circ1
circ3' = rightwards $ do
(a,b) <- input "in"
circ1 (a,b)
-- Same as circ3. Note that input can create several inputs in one go.
circ4 = upwards $ input "in" >>= circ1
circ5 = rightwards
$ input "in"
>>= (rotate 3 . guideE 1 2000 {-nanometers-})
>>= space 1000 {-nanometers-}
>>= 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
-- 2000 units wide, and is located on metal layer 1. By rotating the guides,
-- they get placed downwards instead of rigthwards.
circ6 = rightwards . (and2 >=> copy .>. L.and2 >=> space 4000)
test1 = simulate (stripLayout . circ1) (1,1)
-- A Wired circuit is easily converted to 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" circ3
-- Here each input is a separate net. Single-point nets are not drawn, so only
-- the intermediate signal is shown.
test4 = renderWiredWithNets "circ" circ4
-- Same circuit with upwards placement.
test5 = renderWiredWithNets "circ" $ rotate 1 circ3
-- circ3 rotated 1 step counter-clockwise. Try also flipX and flipY.
test6 = renderWiredWithNets "circ" circ5
test7 = renderWiredWithNets "circ" $ circ6 (low,low)
-- Lava gates can be used happily together with Wired gates. They just don't
-- show up in the pictures.