From 72b1c7d819df14a60cf2836c5a19b6eb4e41ce73 Mon Sep 17 00:00:00 2001 From: megacz Date: Wed, 31 Dec 2008 22:22:59 -0800 Subject: [PATCH] add doc/CONVENTIONS --- doc/CONVENTIONS | 18 +++++++++ src/edu/berkeley/slipway/FakeBoard.java | 66 +++++++++++++++++++++++++------ 2 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 doc/CONVENTIONS diff --git a/doc/CONVENTIONS b/doc/CONVENTIONS new file mode 100644 index 0000000..1777f2f --- /dev/null +++ b/doc/CONVENTIONS @@ -0,0 +1,18 @@ + +- cartesian coordinates + + - always referred to as "col" and "row", not "x" and "y", since + the latter often have other meanings. + + - whenever they appear together, __col__ comes first; not row. + This is cartesian convention. + + - 0,0 is the "lower left" corner of the device when the + manufacturer specifies a canonical orientation. + + - the unit of measurement is the smallest regular resource + + - resources which occupy more than one unit are always addressed + by the lower-leftmost unit occupied. + + diff --git a/src/edu/berkeley/slipway/FakeBoard.java b/src/edu/berkeley/slipway/FakeBoard.java index dd36102..a9be38a 100644 --- a/src/edu/berkeley/slipway/FakeBoard.java +++ b/src/edu/berkeley/slipway/FakeBoard.java @@ -1,24 +1,68 @@ package edu.berkeley.slipway; -import edu.berkeley.obits.*; -import org.ibex.util.Log; import java.io.*; import java.util.*; -import gnu.io.*; +import com.ftdi.usb.*; +import com.atmel.fpslic.*; +import edu.berkeley.abits.*; +import org.ibex.util.*; -public class FakeBoard implements Board { +// FEATURE: more state checking (ie must have reset high before uart-mode, etc) - public FakeBoard() { - +/** + * Slipway board (Fpslic via FTDI USB-UART, running SlipwaySlave.c) + */ +public class FakeBoard extends FpslicDevice implements Board { + + private byte[][][] cache; + public FakeBoard(int width, int height) { + super(width, height); + cache = new byte[256][][]; + for(int i=0; i < cache.length; i++) { + cache[i] = new byte[256][]; + for(int j=0; j < cache.length; j++) { + cache[i][j] = new byte[256]; + } + } + } + + public void flush() { } + public void mode4(int z, int y, int x, int d) { + cache[z][y][x] = (byte)d; + } + public byte mode4(int z, int y, int x) { + return cache[z][y][x]; + } + + public void reset() throws IOException { } + + public OutputStream getConfigStream() throws IOException { + return new OutputStream() { + public void flush() { } + public void write(int b) { } + public void write(byte[] b, int x, int y) { } + }; } - public void reset() { - System.err.println("FakeBoard: reset()"); + public InputStream getInputStream() throws IOException { + return new InputStream() { + public int available() { return 0; } + public int read() { return -1; } + public int read(byte[] b, int x, int y) { return -1; } + }; } - public void boot(Reader r) throws Exception { + public OutputStream getOutputStream() throws IOException { + return new OutputStream() { + public void flush() { } + public void write(int b) { } + public void write(byte[] b, int x, int y) { } + }; } - public InputStream getInputStream() { throw new Error(); } - public OutputStream getOutputStream() { throw new Error(); } + + public void selfTest(SelfTestResultListener resultListener) throws Exception { } + + public Device getDevice() { return this; } } + -- 1.7.10.4