Line 41... |
Line 41... |
// Board level I/O
|
// Board level I/O
|
i_sw, i_btn, o_led,
|
i_sw, i_btn, o_led,
|
o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3,
|
o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3,
|
// Board level PMod I/O
|
// Board level PMod I/O
|
i_aux_rx, o_aux_tx, o_aux_cts, i_gps_rx, o_gps_tx,
|
i_aux_rx, o_aux_tx, o_aux_cts, i_gps_rx, o_gps_tx,
|
// i_gpio, o_gpio,
|
`ifdef USE_GPIO
|
|
i_gpio, o_gpio,
|
|
`endif
|
// Wishbone control
|
// Wishbone control
|
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr,
|
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr,
|
i_wb_data, o_wb_ack, o_wb_stall, o_wb_data,
|
i_wb_data, o_wb_ack, o_wb_stall, o_wb_data,
|
// Cross-board I/O
|
// Cross-board I/O
|
i_rtc_ppd, i_buserr, i_other_ints, o_bus_int, o_board_ints);
|
i_rtc_ppd, i_buserr, i_gps_now, i_gps_step, i_other_ints, o_bus_int, o_board_ints);
|
parameter AUXUART_SETUP = 30'd1736, // 115200 baud from 200MHz clk
|
parameter AUXUART_SETUP = 30'd1736, // 115200 baud from 200MHz clk
|
GPSUART_SETUP = 30'd20833, // 9600 baud from 200MHz clk
|
GPSUART_SETUP = 30'd20833, // 9600 baud from 200MHz clk
|
EXTRACLOCK = 1; // Do we need an extra clock to process?
|
EXTRACLOCK = 1, // Do we need an extra clock to process?
|
|
NGPI=0, NGPO=0; // Number of GPIO in and out wires
|
input i_clk;
|
input i_clk;
|
// Board level I/O
|
// Board level I/O
|
input [3:0] i_sw;
|
input [3:0] i_sw;
|
input [3:0] i_btn;
|
input [3:0] i_btn;
|
output wire [3:0] o_led;
|
output wire [3:0] o_led;
|
Line 69... |
Line 72... |
//
|
//
|
// GPS UART I/O
|
// GPS UART I/O
|
input i_gps_rx;
|
input i_gps_rx;
|
output wire o_gps_tx;
|
output wire o_gps_tx;
|
//
|
//
|
|
`ifdef USE_GPIO
|
// GPIO
|
// GPIO
|
// input [(NGPI-1):0] i_gpio;
|
input [(NGPI-1):0] i_gpio;
|
// output reg [(NGPO-1):0] o_gpio;
|
output reg [(NGPO-1):0] o_gpio;
|
|
`endif
|
//
|
//
|
// Wishbone inputs
|
// Wishbone inputs
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input [4:0] i_wb_addr;
|
input [4:0] i_wb_addr;
|
input [31:0] i_wb_data;
|
input [31:0] i_wb_data;
|
Line 85... |
Line 90... |
output reg [31:0] o_wb_data;
|
output reg [31:0] o_wb_data;
|
// A strobe at midnight, to keep the calendar on "time"
|
// A strobe at midnight, to keep the calendar on "time"
|
input i_rtc_ppd;
|
input i_rtc_ppd;
|
// Address of the last bus error
|
// Address of the last bus error
|
input [31:0] i_buserr;
|
input [31:0] i_buserr;
|
|
// The current time, as produced by the GPS tracking processor
|
|
input [31:0] i_gps_now, i_gps_step;
|
//
|
//
|
// Interrupts -- both the output bus interrupt, as well as those
|
// Interrupts -- both the output bus interrupt, as well as those
|
// internally generated interrupts which may be used elsewhere
|
// internally generated interrupts which may be used elsewhere
|
// in the design
|
// in the design
|
input wire [8:0] i_other_ints;
|
input wire [8:0] i_other_ints;
|
Line 149... |
Line 156... |
// A 32-bit counter that starts at power up and never resets. It's a
|
// A 32-bit counter that starts at power up and never resets. It's a
|
// read only counter if you will.
|
// read only counter if you will.
|
reg [31:0] pwr_counter;
|
reg [31:0] pwr_counter;
|
initial pwr_counter = 32'h00;
|
initial pwr_counter = 32'h00;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
pwr_counter <= pwr_counter+32'h001;
|
if (pwr_counter[31])
|
|
pwr_counter[30:0] <= pwr_counter[30:0] + 31'h001;
|
|
else
|
|
pwr_counter[31:0] <= pwr_counter[31:0] + 31'h001;
|
|
|
//
|
//
|
// BTNSW
|
// BTNSW
|
//
|
//
|
// The button and switch control register
|
// The button and switch control register
|
Line 205... |
Line 215... |
// Not used (yet), but this interface should allow us to control up to
|
// Not used (yet), but this interface should allow us to control up to
|
// 16 GPIO inputs, and another 16 GPIO outputs. The interrupt trips
|
// 16 GPIO inputs, and another 16 GPIO outputs. The interrupt trips
|
// when any of the inputs changes. (Sorry, which input isn't (yet)
|
// when any of the inputs changes. (Sorry, which input isn't (yet)
|
// selectable.)
|
// selectable.)
|
//
|
//
|
|
wire [31:0] gpio_data;
|
|
`ifdef USE_GPIO
|
|
wbgpio #(NIN, NOUT)
|
|
gpioi(i_clk, w_wb_cyc, (w_wb_stb)&&(w_wb_addr == 5'hd), 1'b1,
|
|
w_wb_data, gpio_data, i_gpio, o_gpio, gpio_int);
|
|
`else
|
|
assign gpio_data = 32'h00;
|
assign gpio_int = 1'b0;
|
assign gpio_int = 1'b0;
|
|
`endif
|
|
|
//
|
//
|
// AUX (UART) SETUP
|
// AUX (UART) SETUP
|
//
|
//
|
// Set us up for 4Mbaud, 8 data bits, no stop bits.
|
// Set us up for 4Mbaud, 8 data bits, no stop bits.
|
Line 414... |
Line 432... |
r_gpsrx_data[ 9] <= gpsrx_perr;
|
r_gpsrx_data[ 9] <= gpsrx_perr;
|
r_gpsrx_data[7:0]<= rx_data_gps_port;
|
r_gpsrx_data[7:0]<= rx_data_gps_port;
|
end
|
end
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if(((i_wb_stb)&&(~i_wb_we)&&(i_wb_addr == 5'h10))||(gpsrx_stb))
|
if(((i_wb_stb)&&(~i_wb_we)&&(i_wb_addr == 5'h10))||(gpsrx_stb))
|
r_gpsrx_data[8] <= gpsrx_stb;
|
r_gpsrx_data[8] <= !gpsrx_stb;
|
assign gpsrx_data = { 20'h00, r_gpsrx_data };
|
assign gpsrx_data = { 20'h00, r_gpsrx_data };
|
assign gpsrx_int = r_gpsrx_data[8];
|
assign gpsrx_int = r_gpsrx_data[8];
|
|
|
|
|
// Then the transmitter
|
// Then the transmitter
|
Line 457... |
Line 475... |
5'h08: o_wb_data <= w_clr_led0;
|
5'h08: o_wb_data <= w_clr_led0;
|
5'h09: o_wb_data <= w_clr_led1;
|
5'h09: o_wb_data <= w_clr_led1;
|
5'h0a: o_wb_data <= w_clr_led2;
|
5'h0a: o_wb_data <= w_clr_led2;
|
5'h0b: o_wb_data <= w_clr_led3;
|
5'h0b: o_wb_data <= w_clr_led3;
|
5'h0c: o_wb_data <= date_data;
|
5'h0c: o_wb_data <= date_data;
|
// 5'h0d: o_wb_data <= gpio_data;
|
5'h0d: o_wb_data <= gpio_data;
|
5'h0e: o_wb_data <= auxrx_data;
|
5'h0e: o_wb_data <= auxrx_data;
|
5'h0f: o_wb_data <= auxtx_data;
|
5'h0f: o_wb_data <= auxtx_data;
|
5'h10: o_wb_data <= gpsrx_data;
|
5'h10: o_wb_data <= gpsrx_data;
|
5'h11: o_wb_data <= gpstx_data;
|
5'h11: o_wb_data <= gpstx_data;
|
|
5'h12: o_wb_data <= i_gps_now;
|
|
5'h13: o_wb_data <= i_gps_step;
|
// 5'hf: UART_SETUP
|
// 5'hf: UART_SETUP
|
// 4'h6: GPIO
|
// 4'h6: GPIO
|
// ?? : GPS-UARTRX
|
// ?? : GPS-UARTRX
|
// ?? : GPS-UARTTX
|
// ?? : GPS-UARTTX
|
default: o_wb_data <= 32'h00;
|
default: o_wb_data <= 32'h00;
|