2020-02-04 16:35:48 +01:00
|
|
|
module mojo_top (
|
|
|
|
input clk, // 50MHz clock
|
|
|
|
input rst_n, // reset button (active low)
|
|
|
|
output led [8], // 8 user controllable LEDs
|
|
|
|
input cclk, // configuration clock, AVR ready when high
|
|
|
|
output spi_miso, // AVR SPI MISO
|
|
|
|
input spi_ss, // AVR SPI Slave Select
|
|
|
|
input spi_mosi, // AVR SPI MOSI
|
|
|
|
input spi_sck, // AVR SPI Clock
|
|
|
|
output spi_channel [4], // AVR general purpose pins (used by default to select ADC channel)
|
|
|
|
input avr_tx, // AVR TX (FPGA RX)
|
|
|
|
output avr_rx, // AVR RX (FPGA TX)
|
|
|
|
input avr_rx_busy // AVR RX buffer full
|
|
|
|
) {
|
|
|
|
|
|
|
|
sig rst; // reset signal
|
2020-02-04 19:41:15 +01:00
|
|
|
sig clk2;
|
|
|
|
sig subclk[3]; //alows for 8 subclock pulses
|
2020-02-04 16:35:48 +01:00
|
|
|
|
|
|
|
.clk(clk) {
|
|
|
|
// The reset conditioner is used to synchronize the reset signal to the FPGA
|
|
|
|
// clock. This ensures the entire FPGA comes out of reset at the same time.
|
|
|
|
reset_conditioner reset_cond;
|
2020-02-04 19:41:15 +01:00
|
|
|
|
|
|
|
.rst(rst) {
|
|
|
|
counter slow_clk(#SIZE(15), #DIV(15));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.clk(clk2), .rst(rst), .subclk(subclk) {
|
|
|
|
node nodeA(.up_in(GNode.NULL), .right_in(GNode.NULL), .down_in(GNode.NULL), .left_in(GNode.NULL));
|
2020-02-04 16:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
always {
|
|
|
|
reset_cond.in = ~rst_n; // input raw inverted reset signal
|
|
|
|
rst = reset_cond.out; // conditioned reset
|
2020-02-04 19:41:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
clk2 = slow_clk.value[11];
|
|
|
|
subclk = slow_clk.value[13:11];
|
|
|
|
|
|
|
|
led = c{nodeA.left_out.in[3:0], subclk, clk2};
|
|
|
|
|
2020-02-04 16:35:48 +01:00
|
|
|
|
2020-02-04 19:41:15 +01:00
|
|
|
// led = 8h00; // turn LEDs off
|
2020-02-04 16:35:48 +01:00
|
|
|
spi_miso = bz; // not using SPI
|
|
|
|
spi_channel = bzzzz; // not using flags
|
|
|
|
avr_rx = bz; // not using serial port
|
|
|
|
}
|
|
|
|
}
|