kansas-lava-cores-0.1.2.1: FPGA Cores Written in Kansas Lava.

Safe HaskellNone
LanguageHaskell2010

Hardware.KansasLava.Simulators.Polyester

Contents

Description

  • Remember to call init_board for your specific board.

Synopsis

The (abstract) Fake Fabric Monad

data Polyester a Source

Instances

Monad Polyester 
Functor Polyester 
MonadFix Polyester 
Applicative Polyester 
Spartan3e Polyester

board_init sets up the use of the clock. Always call board_init first. Required.

The Polyester non-proper morphisms

outPolyester :: (Eq a, Graphic g) => (a -> g) -> [a] -> Polyester () Source

Checks an input list for diffences between adjacent elements, and for changes, maps a graphical event onto the internal stepper. The idea is that sending a graphical event twice should be idempotent, but internally the system only writes events when things change.

outPolyesterEvents :: Graphic g => [Maybe g] -> Polyester () Source

Turn a list of graphical events into a Polyester, without processing.

outPolyesterCount :: Graphic g => (Integer -> g) -> [Maybe a] -> Polyester () Source

creates single graphical events, based on the number of Events, when the first real event is event 1, and there is a beginning of time event 0. Example of use: count the number of bytes send or recieved on a device.

writeSocketPolyester :: String -> [Maybe String] -> Polyester () Source

write a socket from a clocked list input. Example of use is emulating RS232 (which only used empty or singleton strings), for the inside of a list.

inPolyester Source

Arguments

:: a

initial a

-> (Char -> a -> a)

how to interpreate a key press

-> Polyester [a] 

Turn an observation of the keyboard into a list of values.

readSocketPolyester :: String -> Polyester [Maybe Word8] Source

readSocketPolyester reads from a socket. The stream is on-demand, and is not controlled by any clock inside the function. Typically would be read one cons per clock, but slower reading is acceptable. This does not make any attempt to register what is being observed on the screen; another process needs to do this.

Running the Fake Polyester

runPolyester :: ExecMode -> Integer -> Integer -> Polyester () -> IO () Source

runPolyester executes the Polyester, never returns, and ususally replaces reifyPolyester.

data ExecMode Source

Constructors

Fast

run as fast as possible, and do not display the clock

Friendly

run in friendly mode, with threadDelay to run slower, to be CPU friendly.

Instances

Support for building fake Boards

generic_init :: (Graphic g1, Graphic g2) => g1 -> (Integer -> g2) -> Polyester () Source

generic_init builds a generic board_init, including setting up the drawing of the board, and printing the (optional) clock.

Support for the (ANSI) Graphics

data ANSI a where Source

Constructors

REVERSE :: ANSI () -> ANSI () 
COLOR :: Color -> ANSI () -> ANSI () 
PRINT :: String -> ANSI () 
AT :: ANSI () -> (Int, Int) -> ANSI () 
BIND :: ANSI b -> (b -> ANSI a) -> ANSI a 
RETURN :: a -> ANSI a 

Instances

Monad ANSI 
Functor ANSI 
Applicative ANSI 
Graphic (ANSI a)

Rather than use a data-structure for each action, ANSI can be used instead. Not recommended, but harmless.

data Color :: *

ANSI colors: come in various intensities, which are controlled by ColorIntensity

Constructors

Black 
Red 
Green 
Yellow 
Blue 
Magenta 
Cyan 
White 

class Graphic g where Source

Methods

drawGraphic :: g -> ANSI () Source

Instances

Graphic (ANSI a)

Rather than use a data-structure for each action, ANSI can be used instead. Not recommended, but harmless.