summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergiusz 'q3k' Bazański <q3k@q3k.org>2014-01-05 22:44:56 +0100
committerSergiusz 'q3k' Bazański <q3k@q3k.org>2014-01-05 22:44:56 +0100
commit5d207884e0216dbe916e835df368d194e76116cc (patch)
tree55335248de2db24adb21f5b0897c8bd16831c06d
parentec6c4a0f90d9eb10b6c036b27245a05ae1d38ee6 (diff)
downloadaamux-dumper-5d207884e0216dbe916e835df368d194e76116cc.tar.gz
aamux-dumper-5d207884e0216dbe916e835df368d194e76116cc.tar.bz2
aamux-dumper-5d207884e0216dbe916e835df368d194e76116cc.zip
Dumps!
-rw-r--r--README3
-rw-r--r--aamux_controller.ucf56
-rw-r--r--aamux_controller.v73
-rw-r--r--dump.py23
-rw-r--r--dumps/dump-block-00.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-01.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-02.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-03.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-04.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-05.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-06.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-07.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-08.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-09.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-10.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-11.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-12.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-13.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-14.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-15.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-16.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-17.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-18.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-19.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-20.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-21.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-22.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-23.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-24.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-25.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-26.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-27.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-28.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-29.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-30.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-31.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-32.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-33.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-34.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-35.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-36.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-37.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-38.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-39.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-40.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-41.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-42.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-43.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-44.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-45.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-46.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-47.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-48.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-49.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-50.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-51.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-52.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-53.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-54.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-55.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-56.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-57.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-58.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-59.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-60.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-61.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-62.binbin0 -> 65536 bytes
-rw-r--r--dumps/dump-block-63.binbin0 -> 65536 bytes
-rw-r--r--sevenseg.v67
-rw-r--r--uart.v102
70 files changed, 289 insertions, 35 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..0eb693b
--- /dev/null
+++ b/README
@@ -0,0 +1,3 @@
+A tool to dump AAMux FWH BIOS flashes.
+
+And some Toshiba R100 dumps in dumps/*.bin (a „block” is 64kbytes, from 0x00000 to 0x3fffff.
diff --git a/aamux_controller.ucf b/aamux_controller.ucf
index 67c1583..5c10066 100644
--- a/aamux_controller.ucf
+++ b/aamux_controller.ucf
@@ -1,6 +1,5 @@
# PlanAhead Generated physical constraints
-
NET "address[10]" LOC = D5;
NET "address[9]" LOC = D6;
NET "address[8]" LOC = E7;
@@ -33,4 +32,57 @@ NET "leds[6]" LOC = P12;
NET "leds[7]" LOC = P11;
NET "reset" LOC = L14;
NET "uart_signal_tx" LOC = B14;
-NET "uart_signal_rx" LOC = A13; \ No newline at end of file
+NET "uart_signal_rx" LOC = A13;
+
+NET "segments[0]" LOC = E14;
+NET "segments[1]" LOC = G13;
+NET "segments[2]" LOC = N15;
+NET "segments[3]" LOC = P15;
+NET "segments[4]" LOC = R16;
+NET "segments[5]" LOC = F13;
+NET "segments[6]" LOC = N16;
+
+NET "segments_anodes[0]" LOC = E13;
+NET "segments_anodes[1]" LOC = F14;
+NET "segments_anodes[2]" LOC = G14;
+NET "segments_anodes[3]" LOC = D14;
+#pin2ucf - Sun Jan 05 22:13:31 2014
+#The following constraints were newly added
+NET "address<3>" LOC = B5;
+NET "address<4>" LOC = B4;
+NET "address<5>" LOC = D10;
+NET "address<6>" LOC = D8;
+NET "address<7>" LOC = D7;
+NET "address<8>" LOC = E7;
+NET "address<9>" LOC = D6;
+NET "data<0>" LOC = A5;
+NET "data<1>" LOC = A4;
+NET "data<2>" LOC = A3;
+NET "data<3>" LOC = C9;
+NET "segments_anodes<0>" LOC = E13;
+NET "data<4>" LOC = C8;
+NET "segments_anodes<1>" LOC = F14;
+NET "data<5>" LOC = C7;
+NET "segments_anodes<2>" LOC = G14;
+NET "data<6>" LOC = C6;
+NET "segments_anodes<3>" LOC = D14;
+NET "data<7>" LOC = C5;
+NET "segments<0>" LOC = E14;
+NET "segments<1>" LOC = G13;
+NET "segments<2>" LOC = N15;
+NET "segments<3>" LOC = P15;
+NET "leds<0>" LOC = K12;
+NET "segments<4>" LOC = R16;
+NET "leds<1>" LOC = P14;
+NET "segments<5>" LOC = F13;
+NET "leds<2>" LOC = L12;
+NET "segments<6>" LOC = N16;
+NET "leds<3>" LOC = N14;
+NET "leds<4>" LOC = P13;
+NET "leds<5>" LOC = N12;
+NET "leds<6>" LOC = P12;
+NET "address<10>" LOC = D5;
+NET "leds<7>" LOC = P11;
+NET "address<0>" LOC = A8;
+NET "address<1>" LOC = A7;
+NET "address<2>" LOC = B6;
diff --git a/aamux_controller.v b/aamux_controller.v
index 1e06a09..8408f99 100644
--- a/aamux_controller.v
+++ b/aamux_controller.v
@@ -4,6 +4,7 @@
`timescale 1ns / 1ps
`include "uart.v"
+`include "sevenseg.v"
module aamux_controller(
// To the BIOS chip
@@ -22,7 +23,11 @@ module aamux_controller(
// UART TX&RX
output uart_signal_tx,
- input uart_signal_rx
+ input uart_signal_rx,
+
+ // Seven-segment display
+ output [6:0] segments,
+ output [3:0] segments_anodes
);
/// Clocks
@@ -35,30 +40,49 @@ module aamux_controller(
/// UART
reg uart_latch;
+ wire uart_received;
+ reg uart_received_clear;
+ wire [7:0] uart_rx;
wire uart_transmitted;
uart_controller uart(
.tx_data_in (data),
.tx_data_latch (uart_latch),
- .tx_clock (uart_clock),
+ .clock (uart_clock),
.reset (reset),
.tx_transmitted (uart_transmitted),
- .tx_signal (uart_signal));
+ .tx_signal (uart_signal_tx),
+ .rx_present (uart_received),
+ .rx_present_clear (uart_received_clear),
+ .rx_data (uart_rx),
+ .rx_signal (uart_signal_rx));
+
+ /// Seven-segment display
+ reg [15:0] to_display;
+ sevenseg display (
+ .value (to_display),
+ .segments (segments),
+ .anodes (segments_anodes),
+ .sys_clock (sys_clock),
+ .reset (reset));
/// State machine
reg [2:0] state;
- `define ASSERT_ROW 0
- `define ROW_LATCH 1
- `define ASSERT_COL 2
- `define COL_LATCH 3
- `define WAITING 4
- `define OUTPUT 5
- `define OUTPUT_WAIT 6
-
+ `define WAIT_CMD 0
+ `define ASSERT_ROW 1
+ `define ROW_LATCH 2
+ `define ASSERT_COL 3
+ `define COL_LATCH 4
+ `define WAITING 5
+ `define OUTPUT 6
+ `define OUTPUT_WAIT 7
+ //assign leds = (1 << state);
+ assign leds = uart_received;
+ /// Address from which we will be reading, and
+ // how many bytes are left
reg [21:0] read_address;
- assign leds = read_address[21:14];
-
+ reg [16:0] bytes_left;
/// sys_clock division into clock and uart_clock
always @(posedge sys_clock) begin
@@ -74,12 +98,25 @@ module aamux_controller(
/// Main state machine code
always @(posedge clock) begin
if (reset) begin
- state <= `ASSERT_ROW;
+ // Reset state
+ state <= `WAIT_CMD;
read_address <= 0;
+ bytes_left <= 0;
rowcol <= 1;
uart_latch <= 0;
+ to_display <= 16'hDEAD;
+ uart_received_clear <= 0;
end else begin
case (state)
+ `WAIT_CMD: begin
+ if (uart_received) begin
+ state <= `ASSERT_ROW;
+ read_address <= uart_rx * 65536;
+ bytes_left <= 'h10000;
+ uart_received_clear <= 1;
+ end else
+ to_display <= 16'hDEAD;
+ end
`ASSERT_ROW: begin
address <= read_address[10:0];
state <= `ROW_LATCH;
@@ -112,8 +149,14 @@ module aamux_controller(
`OUTPUT_WAIT: begin
if (!uart_transmitted) begin
uart_latch <= 0;
- state <= `ASSERT_ROW;
+ to_display <= bytes_left;
read_address <= read_address + 1;
+ bytes_left <= bytes_left - 1;
+ if (bytes_left - 1 == 0) begin
+ uart_received_clear <= 0;
+ state <= `WAIT_CMD;
+ end else
+ state <= `ASSERT_ROW;
end
end
endcase
diff --git a/dump.py b/dump.py
new file mode 100644
index 0000000..5790130
--- /dev/null
+++ b/dump.py
@@ -0,0 +1,23 @@
+import serial
+import sys
+
+if len(sys.argv) < 2:
+ sys.stderr.write("Usage: {} /dev/ttySERIAL\n".format(sys.argv[0]))
+ sys.exit(1)
+
+s = serial.Serial(sys.argv[1], 115200)
+
+def dump_block(block):
+ s.write(chr(block))
+ d = ""
+ while True:
+ d += s.read(1024)
+ print "[i] Receiving block {}, {} bytes received...".format(block, len(d))
+ if len(d) == 65536:
+ return d
+
+for i in range(64):
+ data = dump_block(i)
+ f = open("dumps/dump-block-%02i.bin" % i, "w")
+ f.write(data)
+ f.close()
diff --git a/dumps/dump-block-00.bin b/dumps/dump-block-00.bin
new file mode 100644
index 0000000..b9cc53f
--- /dev/null
+++ b/dumps/dump-block-00.bin
Binary files differ
diff --git a/dumps/dump-block-01.bin b/dumps/dump-block-01.bin
new file mode 100644
index 0000000..02dc4b6
--- /dev/null
+++ b/dumps/dump-block-01.bin
Binary files differ
diff --git a/dumps/dump-block-02.bin b/dumps/dump-block-02.bin
new file mode 100644
index 0000000..e167e53
--- /dev/null
+++ b/dumps/dump-block-02.bin
Binary files differ
diff --git a/dumps/dump-block-03.bin b/dumps/dump-block-03.bin
new file mode 100644
index 0000000..08c79df
--- /dev/null
+++ b/dumps/dump-block-03.bin
Binary files differ
diff --git a/dumps/dump-block-04.bin b/dumps/dump-block-04.bin
new file mode 100644
index 0000000..87e289f
--- /dev/null
+++ b/dumps/dump-block-04.bin
Binary files differ
diff --git a/dumps/dump-block-05.bin b/dumps/dump-block-05.bin
new file mode 100644
index 0000000..6c5e006
--- /dev/null
+++ b/dumps/dump-block-05.bin
Binary files differ
diff --git a/dumps/dump-block-06.bin b/dumps/dump-block-06.bin
new file mode 100644
index 0000000..58ccb64
--- /dev/null
+++ b/dumps/dump-block-06.bin
Binary files differ
diff --git a/dumps/dump-block-07.bin b/dumps/dump-block-07.bin
new file mode 100644
index 0000000..e685472
--- /dev/null
+++ b/dumps/dump-block-07.bin
Binary files differ
diff --git a/dumps/dump-block-08.bin b/dumps/dump-block-08.bin
new file mode 100644
index 0000000..537a0e2
--- /dev/null
+++ b/dumps/dump-block-08.bin
Binary files differ
diff --git a/dumps/dump-block-09.bin b/dumps/dump-block-09.bin
new file mode 100644
index 0000000..eb5a95f
--- /dev/null
+++ b/dumps/dump-block-09.bin
Binary files differ
diff --git a/dumps/dump-block-10.bin b/dumps/dump-block-10.bin
new file mode 100644
index 0000000..ef08bbe
--- /dev/null
+++ b/dumps/dump-block-10.bin
Binary files differ
diff --git a/dumps/dump-block-11.bin b/dumps/dump-block-11.bin
new file mode 100644
index 0000000..673ef7f
--- /dev/null
+++ b/dumps/dump-block-11.bin
Binary files differ
diff --git a/dumps/dump-block-12.bin b/dumps/dump-block-12.bin
new file mode 100644
index 0000000..a56e974
--- /dev/null
+++ b/dumps/dump-block-12.bin
Binary files differ
diff --git a/dumps/dump-block-13.bin b/dumps/dump-block-13.bin
new file mode 100644
index 0000000..4f47237
--- /dev/null
+++ b/dumps/dump-block-13.bin
Binary files differ
diff --git a/dumps/dump-block-14.bin b/dumps/dump-block-14.bin
new file mode 100644
index 0000000..9ba6d82
--- /dev/null
+++ b/dumps/dump-block-14.bin
Binary files differ
diff --git a/dumps/dump-block-15.bin b/dumps/dump-block-15.bin
new file mode 100644
index 0000000..a37c112
--- /dev/null
+++ b/dumps/dump-block-15.bin
Binary files differ
diff --git a/dumps/dump-block-16.bin b/dumps/dump-block-16.bin
new file mode 100644
index 0000000..6f498f1
--- /dev/null
+++ b/dumps/dump-block-16.bin
Binary files differ
diff --git a/dumps/dump-block-17.bin b/dumps/dump-block-17.bin
new file mode 100644
index 0000000..d6e4f48
--- /dev/null
+++ b/dumps/dump-block-17.bin
Binary files differ
diff --git a/dumps/dump-block-18.bin b/dumps/dump-block-18.bin
new file mode 100644
index 0000000..aed7b2f
--- /dev/null
+++ b/dumps/dump-block-18.bin
Binary files differ
diff --git a/dumps/dump-block-19.bin b/dumps/dump-block-19.bin
new file mode 100644
index 0000000..46184c1
--- /dev/null
+++ b/dumps/dump-block-19.bin
Binary files differ
diff --git a/dumps/dump-block-20.bin b/dumps/dump-block-20.bin
new file mode 100644
index 0000000..e9cc660
--- /dev/null
+++ b/dumps/dump-block-20.bin
Binary files differ
diff --git a/dumps/dump-block-21.bin b/dumps/dump-block-21.bin
new file mode 100644
index 0000000..88c774f
--- /dev/null
+++ b/dumps/dump-block-21.bin
Binary files differ
diff --git a/dumps/dump-block-22.bin b/dumps/dump-block-22.bin
new file mode 100644
index 0000000..cab95a4
--- /dev/null
+++ b/dumps/dump-block-22.bin
Binary files differ
diff --git a/dumps/dump-block-23.bin b/dumps/dump-block-23.bin
new file mode 100644
index 0000000..79398f7
--- /dev/null
+++ b/dumps/dump-block-23.bin
Binary files differ
diff --git a/dumps/dump-block-24.bin b/dumps/dump-block-24.bin
new file mode 100644
index 0000000..384933a
--- /dev/null
+++ b/dumps/dump-block-24.bin
Binary files differ
diff --git a/dumps/dump-block-25.bin b/dumps/dump-block-25.bin
new file mode 100644
index 0000000..5ac6c40
--- /dev/null
+++ b/dumps/dump-block-25.bin
Binary files differ
diff --git a/dumps/dump-block-26.bin b/dumps/dump-block-26.bin
new file mode 100644
index 0000000..f0c2f2a
--- /dev/null
+++ b/dumps/dump-block-26.bin
Binary files differ
diff --git a/dumps/dump-block-27.bin b/dumps/dump-block-27.bin
new file mode 100644
index 0000000..5572dc5
--- /dev/null
+++ b/dumps/dump-block-27.bin
Binary files differ
diff --git a/dumps/dump-block-28.bin b/dumps/dump-block-28.bin
new file mode 100644
index 0000000..9a8f514
--- /dev/null
+++ b/dumps/dump-block-28.bin
Binary files differ
diff --git a/dumps/dump-block-29.bin b/dumps/dump-block-29.bin
new file mode 100644
index 0000000..88c774f
--- /dev/null
+++ b/dumps/dump-block-29.bin
Binary files differ
diff --git a/dumps/dump-block-30.bin b/dumps/dump-block-30.bin
new file mode 100644
index 0000000..0743dfa
--- /dev/null
+++ b/dumps/dump-block-30.bin
Binary files differ
diff --git a/dumps/dump-block-31.bin b/dumps/dump-block-31.bin
new file mode 100644
index 0000000..c864cbc
--- /dev/null
+++ b/dumps/dump-block-31.bin
Binary files differ
diff --git a/dumps/dump-block-32.bin b/dumps/dump-block-32.bin
new file mode 100644
index 0000000..965e903
--- /dev/null
+++ b/dumps/dump-block-32.bin
Binary files differ
diff --git a/dumps/dump-block-33.bin b/dumps/dump-block-33.bin
new file mode 100644
index 0000000..b578a79
--- /dev/null
+++ b/dumps/dump-block-33.bin
Binary files differ
diff --git a/dumps/dump-block-34.bin b/dumps/dump-block-34.bin
new file mode 100644
index 0000000..bb54858
--- /dev/null
+++ b/dumps/dump-block-34.bin
Binary files differ
diff --git a/dumps/dump-block-35.bin b/dumps/dump-block-35.bin
new file mode 100644
index 0000000..7742584
--- /dev/null
+++ b/dumps/dump-block-35.bin
Binary files differ
diff --git a/dumps/dump-block-36.bin b/dumps/dump-block-36.bin
new file mode 100644
index 0000000..ff80366
--- /dev/null
+++ b/dumps/dump-block-36.bin
Binary files differ
diff --git a/dumps/dump-block-37.bin b/dumps/dump-block-37.bin
new file mode 100644
index 0000000..181658c
--- /dev/null
+++ b/dumps/dump-block-37.bin
Binary files differ
diff --git a/dumps/dump-block-38.bin b/dumps/dump-block-38.bin
new file mode 100644
index 0000000..a5348a1
--- /dev/null
+++ b/dumps/dump-block-38.bin
Binary files differ
diff --git a/dumps/dump-block-39.bin b/dumps/dump-block-39.bin
new file mode 100644
index 0000000..812138e
--- /dev/null
+++ b/dumps/dump-block-39.bin
Binary files differ
diff --git a/dumps/dump-block-40.bin b/dumps/dump-block-40.bin
new file mode 100644
index 0000000..116d85d
--- /dev/null
+++ b/dumps/dump-block-40.bin
Binary files differ
diff --git a/dumps/dump-block-41.bin b/dumps/dump-block-41.bin
new file mode 100644
index 0000000..7c3b9cd
--- /dev/null
+++ b/dumps/dump-block-41.bin
Binary files differ
diff --git a/dumps/dump-block-42.bin b/dumps/dump-block-42.bin
new file mode 100644
index 0000000..deacd54
--- /dev/null
+++ b/dumps/dump-block-42.bin
Binary files differ
diff --git a/dumps/dump-block-43.bin b/dumps/dump-block-43.bin
new file mode 100644
index 0000000..81f01e2
--- /dev/null
+++ b/dumps/dump-block-43.bin
Binary files differ
diff --git a/dumps/dump-block-44.bin b/dumps/dump-block-44.bin
new file mode 100644
index 0000000..5218148
--- /dev/null
+++ b/dumps/dump-block-44.bin
Binary files differ
diff --git a/dumps/dump-block-45.bin b/dumps/dump-block-45.bin
new file mode 100644
index 0000000..336ca03
--- /dev/null
+++ b/dumps/dump-block-45.bin
Binary files differ
diff --git a/dumps/dump-block-46.bin b/dumps/dump-block-46.bin
new file mode 100644
index 0000000..1cb38d4
--- /dev/null
+++ b/dumps/dump-block-46.bin
Binary files differ
diff --git a/dumps/dump-block-47.bin b/dumps/dump-block-47.bin
new file mode 100644
index 0000000..6731da3
--- /dev/null
+++ b/dumps/dump-block-47.bin
Binary files differ
diff --git a/dumps/dump-block-48.bin b/dumps/dump-block-48.bin
new file mode 100644
index 0000000..4e02591
--- /dev/null
+++ b/dumps/dump-block-48.bin
Binary files differ
diff --git a/dumps/dump-block-49.bin b/dumps/dump-block-49.bin
new file mode 100644
index 0000000..b91549b
--- /dev/null
+++ b/dumps/dump-block-49.bin
Binary files differ
diff --git a/dumps/dump-block-50.bin b/dumps/dump-block-50.bin
new file mode 100644
index 0000000..2783929
--- /dev/null
+++ b/dumps/dump-block-50.bin
Binary files differ
diff --git a/dumps/dump-block-51.bin b/dumps/dump-block-51.bin
new file mode 100644
index 0000000..55ec685
--- /dev/null
+++ b/dumps/dump-block-51.bin
Binary files differ
diff --git a/dumps/dump-block-52.bin b/dumps/dump-block-52.bin
new file mode 100644
index 0000000..25139b7
--- /dev/null
+++ b/dumps/dump-block-52.bin
Binary files differ
diff --git a/dumps/dump-block-53.bin b/dumps/dump-block-53.bin
new file mode 100644
index 0000000..88c774f
--- /dev/null
+++ b/dumps/dump-block-53.bin
Binary files differ
diff --git a/dumps/dump-block-54.bin b/dumps/dump-block-54.bin
new file mode 100644
index 0000000..5115bd0
--- /dev/null
+++ b/dumps/dump-block-54.bin
Binary files differ
diff --git a/dumps/dump-block-55.bin b/dumps/dump-block-55.bin
new file mode 100644
index 0000000..f866f89
--- /dev/null
+++ b/dumps/dump-block-55.bin
Binary files differ
diff --git a/dumps/dump-block-56.bin b/dumps/dump-block-56.bin
new file mode 100644
index 0000000..cb59087
--- /dev/null
+++ b/dumps/dump-block-56.bin
Binary files differ
diff --git a/dumps/dump-block-57.bin b/dumps/dump-block-57.bin
new file mode 100644
index 0000000..1830a27
--- /dev/null
+++ b/dumps/dump-block-57.bin
Binary files differ
diff --git a/dumps/dump-block-58.bin b/dumps/dump-block-58.bin
new file mode 100644
index 0000000..9f3ef0f
--- /dev/null
+++ b/dumps/dump-block-58.bin
Binary files differ
diff --git a/dumps/dump-block-59.bin b/dumps/dump-block-59.bin
new file mode 100644
index 0000000..687046f
--- /dev/null
+++ b/dumps/dump-block-59.bin
Binary files differ
diff --git a/dumps/dump-block-60.bin b/dumps/dump-block-60.bin
new file mode 100644
index 0000000..c42cca5
--- /dev/null
+++ b/dumps/dump-block-60.bin
Binary files differ
diff --git a/dumps/dump-block-61.bin b/dumps/dump-block-61.bin
new file mode 100644
index 0000000..88c774f
--- /dev/null
+++ b/dumps/dump-block-61.bin
Binary files differ
diff --git a/dumps/dump-block-62.bin b/dumps/dump-block-62.bin
new file mode 100644
index 0000000..061b3dd
--- /dev/null
+++ b/dumps/dump-block-62.bin
Binary files differ
diff --git a/dumps/dump-block-63.bin b/dumps/dump-block-63.bin
new file mode 100644
index 0000000..255a696
--- /dev/null
+++ b/dumps/dump-block-63.bin
Binary files differ
diff --git a/sevenseg.v b/sevenseg.v
new file mode 100644
index 0000000..29e7888
--- /dev/null
+++ b/sevenseg.v
@@ -0,0 +1,67 @@
+`timescale 1ns / 1ps
+
+// Copyright (c) 2014 Sergiusz 'q3k' Bazański <sergiusz@baznaski.pl>
+// Released under the 2-clause BSD license - see the COPYING file
+
+module sevenseg(
+ // Value to be displayed (0-FFFF)
+ input [15:0] value,
+ output reg [6:0] segments,
+ output reg [3:0] anodes,
+ input sys_clock,
+ input reset
+ );
+
+ reg [1:0] current_anode;
+ wire [3:0] current_digit[0:3];
+ assign current_digit[0] = value[3:0];
+ assign current_digit[1] = value[7:4];
+ assign current_digit[2] = value[11:8];
+ assign current_digit[3] = value[15:12];
+
+ reg [10:0] clock_counter;
+ reg clock;
+
+ always @(posedge sys_clock)
+ begin
+ if (clock_counter >= 1024)
+ begin
+ clock_counter <= 0;
+ clock <= !clock;
+ end else begin
+ clock_counter <= clock_counter + 1;
+ end
+ end
+
+ always @(posedge clock)
+ begin
+ if (reset) begin
+ segments <= 0;
+ anodes <= 0;
+ current_anode <= 0;
+ end else begin
+ current_anode <= current_anode + 1;
+ anodes <= ~(1 << (3-current_anode));
+ case (current_digit[current_anode])
+ 4'h0: segments <= 7'b1000000;
+ 4'h1: segments <= 7'b1111001;
+ 4'h2: segments <= 7'b0100100;
+ 4'h3: segments <= 7'b0110000;
+ 4'h4: segments <= 7'b0011001;
+ 4'h5: segments <= 7'b0010010;
+ 4'h6: segments <= 7'b0000010;
+ 4'h7: segments <= 7'b1111000;
+ 4'h8: segments <= 7'b0000000;
+ 4'h9: segments <= 7'b0011000;
+ 4'hA: segments <= 7'b0001000;
+ 4'hB: segments <= 7'b0000011;
+ 4'hC: segments <= 7'b1000110;
+ 4'hD: segments <= 7'b0100001;
+ 4'hE: segments <= 7'b0000110;
+ 4'hF: segments <= 7'b0001110;
+ default: segments <= 7'b0110110;
+ endcase
+ end
+ end
+
+endmodule
diff --git a/uart.v b/uart.v
index 4e7432a..52cbe45 100644
--- a/uart.v
+++ b/uart.v
@@ -12,7 +12,7 @@ module uart_controller(
input tx_data_latch,
// baud rate clock
- input tx_clock,
+ input clock,
// reset line
input reset,
@@ -20,13 +20,20 @@ module uart_controller(
// goes 1 when the UART finished transmitting
output reg tx_transmitted,
// the actual UART transmitter output
- output reg tx_signal
+ output reg tx_signal,
+
+ output reg rx_present,
+ input rx_present_clear,
+ output reg [7:0] rx_data,
+
+ input rx_signal
);
// Internal TX data (latched from tx_data_in)
reg [7:0] tx_data;
- reg [3:0] state;
+ reg [3:0] tx_state;
+ reg [3:0] rx_state;
`define IDLE 0
`define START 1
`define BIT0 2
@@ -38,63 +45,122 @@ module uart_controller(
`define BIT6 8
`define BIT7 9
`define STOP 10
-
- always @(posedge tx_clock)
+
+ /// Receiver
+ always @(posedge clock)
+ begin
+ if (reset) begin
+ rx_state <= `IDLE;
+ rx_present <= 0;
+ rx_data <= 0;
+ end else begin
+ if (rx_present_clear)
+ rx_present <= 0;
+ case (rx_state)
+ `IDLE: begin
+ if (!rx_signal) begin
+ // We received a start bit
+ rx_state <= `BIT0;
+ rx_present <= 0;
+ end
+ end
+ `BIT0: begin
+ rx_data[0] <= rx_signal;
+ rx_state <= `BIT1;
+ end
+ `BIT1: begin
+ rx_data[1] <= rx_signal;
+ rx_state <= `BIT2;
+ end
+ `BIT2: begin
+ rx_data[2] <= rx_signal;
+ rx_state <= `BIT3;
+ end
+ `BIT3: begin
+ rx_data[3] <= rx_signal;
+ rx_state <= `BIT4;
+ end
+ `BIT4: begin
+ rx_data[4] <= rx_signal;
+ rx_state <= `BIT5;
+ end
+ `BIT5: begin
+ rx_data[5] <= rx_signal;
+ rx_state <= `BIT6;
+ end
+ `BIT6: begin
+ rx_data[6] <= rx_signal;
+ rx_state <= `BIT7;
+ end
+ `BIT7: begin
+ rx_data[7] <= rx_signal;
+ rx_state <= `STOP;
+ end
+ `STOP: begin
+ rx_present <= 1;
+ rx_state <= `IDLE;
+ end
+ endcase
+ end
+ end
+
+ /// Transmitter
+ always @(posedge clock)
begin
if (reset) begin
- state <= `IDLE;
+ tx_state <= `IDLE;
tx_signal <= 1;
tx_data <= 0;
tx_transmitted <= 1;
end else begin
- case (state)
+ case (tx_state)
`IDLE: begin
if (tx_data_latch)
begin
tx_data <= tx_data_in;
- state <= `START;
+ tx_state <= `START;
tx_transmitted <= 0;
end
end
`START: begin
tx_signal <= 0;
- state <= `BIT0;
+ tx_state <= `BIT0;
end
`BIT0: begin
tx_signal <= tx_data[0];
- state <= `BIT1;
+ tx_state <= `BIT1;
end
`BIT1: begin
tx_signal <= tx_data[1];
- state <= `BIT2;
+ tx_state <= `BIT2;
end
`BIT2: begin
tx_signal <= tx_data[2];
- state <= `BIT3;
+ tx_state <= `BIT3;
end
`BIT3: begin
tx_signal <= tx_data[3];
- state <= `BIT4;
+ tx_state <= `BIT4;
end
`BIT4: begin
tx_signal <= tx_data[4];
- state <= `BIT5;
+ tx_state <= `BIT5;
end
`BIT5: begin
tx_signal <= tx_data[5];
- state <= `BIT6;
+ tx_state <= `BIT6;
end
`BIT6: begin
tx_signal <= tx_data[6];
- state <= `BIT7;
+ tx_state <= `BIT7;
end
`BIT7: begin
tx_signal <= tx_data[7];
- state <= `STOP;
+ tx_state <= `STOP;
end
`STOP: begin
tx_signal <= 1;
- state <= `IDLE;
+ tx_state <= `IDLE;
tx_transmitted <= 1;
end
endcase