|
@@ -547,8 +547,21 @@ module max80 (
|
|
|
tri1 [31:0] sysreg_rdata[0:31];
|
|
|
assign iodev_rdata_sys = sysreg_rdata[sysreg_subreg];
|
|
|
|
|
|
- assign sysreg_rdata[0] = 32'h5058414d;
|
|
|
- assign sysreg_rdata[1] = { 31'b0, rtc_32khz_rework };
|
|
|
+ //
|
|
|
+ // Board identification
|
|
|
+ //
|
|
|
+ // Magic number: "MAX8"
|
|
|
+ // Board revision: 1.0
|
|
|
+ // Board rework flags:
|
|
|
+ // [0] - RTC 32 kHz pullup and serial port RxD/TxD swap
|
|
|
+ // [15:1] - reserved
|
|
|
+ //
|
|
|
+ wire [ 7:0] max80_major = 8'd1;
|
|
|
+ wire [ 7:0] max80_minor = 8'd0;
|
|
|
+ wire [15:0] max80_fixes = { 14'b0, rtc_32khz_rework }; // Workarounds
|
|
|
+
|
|
|
+ assign sysreg_rdata[0] = SYS_MAGIC_MAX80;
|
|
|
+ assign sysreg_rdata[1] = { max80_major, max80_minor, max80_fixes };
|
|
|
|
|
|
// Hard system reset under program control
|
|
|
assign reset_cmd =
|
|
@@ -630,6 +643,7 @@ module max80 (
|
|
|
.tty_txd ( tty_data_out ) // DTE -> DCE
|
|
|
);
|
|
|
|
|
|
+`ifdef WORKAROUNDS
|
|
|
reg [1:0] tty_dtr_q;
|
|
|
always @(posedge sys_clk)
|
|
|
begin
|
|
@@ -655,7 +669,14 @@ module max80 (
|
|
|
assign gpio[3] = tty_dtr_q[1] ? 1'bz : tty_cts_out;
|
|
|
|
|
|
// DTR on GPIO -> assume RTC 32 kHz output is nonfunctional
|
|
|
- wire rtc_32khz_rework = tty_dtr_q[1];
|
|
|
+ assign rtc_32khz_rework = tty_dtr_q[1];
|
|
|
+`else
|
|
|
+ assign tty_data_in = tty_txd;
|
|
|
+ assign tty_rxd = tty_data_out;
|
|
|
+ assign tty_rts_in = tty_rts;
|
|
|
+ assign tty_cts = tty_cts_out;
|
|
|
+ assign rtc_32khz_rework = 1'b1;
|
|
|
+`endif
|
|
|
|
|
|
// SD card
|
|
|
sdcard #(
|
|
@@ -689,6 +710,7 @@ module max80 (
|
|
|
// divider down from the 84 MHz system clock. The
|
|
|
// error is about 200 ppm; a proper NCO could do better.
|
|
|
|
|
|
+`ifdef WORKAROUNDS
|
|
|
reg ctr_32khz;
|
|
|
reg [10:0] ctr_64khz;
|
|
|
always @(posedge sys_clk)
|
|
@@ -704,6 +726,9 @@ module max80 (
|
|
|
|
|
|
// 32kHz clock synchronized with sys_clk
|
|
|
wire clk_32kHz = rtc_32khz_rework ? ~rtc_32khz : ctr_32khz;
|
|
|
+`else // !`ifdef WORKAROUNDS
|
|
|
+ wire clk_32kHz = ~rtc_32khz;
|
|
|
+`endif
|
|
|
|
|
|
sysclock #(.PERIODIC_HZ_LG2 ( 5 ))
|
|
|
sysclock (
|