1 package edu.berkeley.slipway.util;
6 import com.atmel.fpslic.*;
7 import edu.berkeley.slipway.*;
8 import edu.berkeley.slipway.gui.*;
9 import static com.atmel.fpslic.FpslicConstants.*;
11 /** useful test structures */
12 public class ExperimentUtils {
15 * Creates a 2x2 cell frequency divider with top left corner at
16 * c, taking input from c.north() and providing output on the
17 * orthogonal axis at c.south(). Returns c.south().south() for
18 * easy daisy-chaining.
20 public static FpslicDevice.Cell divider(FpslicDevice.Cell c) {
21 FpslicDevice.Cell detect1 = c;
22 FpslicDevice.Cell detect2 = c.east();
25 detect1.ylut(LUT_SELF);
26 detect1.xlut(LUT_OTHER & (~LUT_Z));
33 detect2.ylut(LUT_OTHER);
34 detect2.xlut((~LUT_SELF) & LUT_Z);
40 detect1.south().yi(EAST);
41 detect1.south().xi(NE);
42 detect1.south().c(YLUT);
43 detect1.south().t(TMUX_FB);
44 detect1.south().f(false);
45 detect1.south().b(false);
46 detect1.south().ylut( (LUT_OTHER & (~LUT_SELF)) |
47 ((~LUT_OTHER) & LUT_Z)
49 detect1.south().xlut( (LUT_SELF & (~LUT_OTHER)) |
53 detect2.south().yi(WEST);
54 detect2.south().xi(NW);
55 detect2.south().c(YLUT);
56 detect2.south().t(TMUX_FB);
57 detect2.south().f(false);
58 detect2.south().b(false);
59 detect2.south().ylut( (LUT_OTHER & (LUT_SELF)) |
60 ((~LUT_OTHER) & LUT_Z)
62 detect2.south().xlut( (LUT_SELF & (~LUT_OTHER)) |
66 if (c.south().south()==null) return null;
67 if (c.south().south().south()==null) return null;
68 return c.south().south();
71 /** set up the scan cell */
72 public static void setupScanCell(FpslicDevice fpslic) {
73 fpslic.cell(23,15).h(3, true);
74 fpslic.cell(23,15).yi(L3);
75 fpslic.cell(23,15).ylut(0xAA);
76 fpslic.iob_right(15, true).enableOutput(WEST);
78 fpslic.cell(23,0).ylut(0x00);
79 fpslic.iob_right(0, true).enableOutput(WEST);