move multiplier out of Alu3.ship, add correct test
[fleet.git] / tests / multiply.test
1 #ship alu3    : Alu3
2 #ship lut3    : Lut3
3 #ship bitfifo : BitFifo
4 #ship debug   : Debug
5 #ship fifo    : Fifo
6 #ship rotator : Rotator
7
8 #expect -66848683
9 #expect 18682
10
11 // 0:  100100100111110000000
12 // sel 011110100001001000000
13 // 1:  111000101000011000011
14 // r:  111000100110111000000
15
16 bitfifo.in:
17   literal 10000;
18   deliver;      // deliver a junk word
19   load repeat counter with 37; deliver; // deliver it 37 times (once per bit)
20   literal 0;
21   load repeat counter with 38; deliver; // deliver it 37 times
22
23 // insert bits in lsb order
24 bitfifo.inOp:
25   literal BitFifo.inOp[lsbFirst,take=37];
26   [*] deliver;
27
28 // toss out 37 bits, take one, repeat.  sign extend the result
29 bitfifo.outOp:
30   literal BitFifo.outOp[drop=37,take=1,signExtend];
31   [*] deliver;
32
33 bitfifo.out:        [*] wait, take, sendto lut3.in2;
34 lut3.in2:           load repeat counter with 4; notify bitfifo.out;
35                     load repeat counter with 63;
36                     take, deliver, notify bitfifo.out;
37                     load repeat counter with 11;
38                     take, deliver, notify bitfifo.out;
39
40 // mux on second input
41 lut3.inLut:         literal 226;
42                     [*] deliver;
43
44 lut3.in1:           literal 18683;
45                     load repeat counter with 37; deliver;
46                     literal 0;
47                     load repeat counter with 37; deliver;
48
49 lut3.in3:           literal 12000;
50                     load repeat counter with 37; deliver;
51                     literal 0;
52                     load repeat counter with 37; deliver;
53
54 lut3.out:           [*] wait, take, sendto alu3.in2;
55
56 alu3.in1:      literal 0; deliver; [*] take, deliver;
57 alu3.in2:      notify lut3.out; [*] take, deliver, notify lut3.out;
58 alu3.in3:      literal 0; deliver; [*] take, deliver;
59 alu3.outBits:  [*] take, sendto debug.in;
60
61 alu3.out1:     [*] take, sendto alu3.in1;
62 alu3.out2:     [*] take, sendto alu3.in3;
63
64 debug.in:      [*] take, deliver;
65