update testcase grammar
[sbp.git] / tests / scl.g
1
2
3 data foo = bar;
4 type foo = bar;
5
6 type Bit     = 0 | 1
7 type Char    = Bit[16]
8 type Boolean = true    | false
9 type Int32   = Bit[32] | oob
10 type Int64   = Bit[64] | oob
11 type Pointer = Bit[64]
12 type CodeBag = Pointer
13 type Void   = token
14
15 ship Adder3 (a b c -> d e f)
16   input e : !
17   ...
18
19   (x->a) => 3->b
20
21 module latch32
22   input  data_in     : Int32
23   input  transparent : Boolean!
24   output data_out    : Int32
25   private
26     state keeper : Int32
27     data_out = keeper
28     transparent(true)  => keeper = data_in
29     transparent(false) => keeper = keeper
30
31 module flipflop<T>
32    input  dataIn  : T
33    input  clock   : Void!
34    output dataOut : T
35    private
36       state keeper : T
37       data_out = keeper
38       clock() => keeper := 
39
40 module join
41    input  in1 : Void!
42    input  in2 : Void!
43    output out : Void!
44    private
45
46 A single-clock synchronous system is therefore a system with only a single variable of event type.  A synchronous sytem with mu
47
48
49 // how do you specify the initial state of keeper nodes?  
50
51 fleet
52   Adder3[1..3]
53
54
55 Type   ::= Boolean
56
57
58
59 Action  = Action ","  Action
60         | Value  "->" Port+
61         
62
63 Identifier  ::=  Id  |  "(" Sym ")"
64
65 Definition  ::=  Identifier "=" Body      /ws
66
67 Grammar     ::=  
68
69 clock
70 random number generator
71 register
72 fifo
73 compare
74
75 clear-read port
76
77 // positioning of elements on the screen (psuedo-comment?)
78 // subcircuits
79 // ports (in, out)
80
81 Parameter   ::=  Identifier   (":" Type)?
82
83
84 andgate {a b}->{c d} = 
85   input a, b
86   output c, d
87
88
89 module fifo <in>
90   
91
92 latch (input, hold) =
93   old = case 
94   out = case
95     
96
97
98 and, xor, 2:1mux, 4:1mux
99
100 leds, graphs, clock
101
102 charing
103
104 rs-latch
105 dq-flipflop
106
107 parameterization (?)