Created
April 24, 2016 01:44
-
-
Save themattchan/649a9b1c3d9b51280fb1d27d036a4413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/runhaskell | |
{-# LANGUAGE FlexibleContexts #-} | |
module Lib where | |
import Diagrams.Prelude | |
import Diagrams.Backend.PGF.CmdLine | |
pipeline :: Diagram PGF | |
pipeline = foldr1 (|||) labelledBlocks | |
where | |
block name color = label name <> (rect 20 10 # fcA color) | |
label name = text name # bold | |
# fontSize (local 2) | |
# font "Computer Modern Teletype L" | |
# fc white | |
colours = map (`withOpacity` 0.75) | |
[ red, orange, green, blue, purple ] | |
stages = [ "IF", "ID", "EXE", "MEM", "WB" ] | |
labelledBlocks = zipWith block stages colours | |
draw :: Diagram PGF -> IO () | |
draw = defaultMain . pad 1.1 . scale 3 | |
main :: IO () | |
main = draw pipeline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment