TIS-100-FPGA/source/mojo_top.luc

50 lines
1.7 KiB
Plaintext

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
sig clk2;
sig subclk[3]; //alows for 8 subclock pulses
.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;
.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));
}
always {
reset_cond.in = ~rst_n; // input raw inverted reset signal
rst = reset_cond.out; // conditioned reset
clk2 = slow_clk.value[11];
subclk = slow_clk.value[13:11];
led = c{nodeA.left_out.in[3:0], subclk, clk2};
// led = 8h00; // turn LEDs off
spi_miso = bz; // not using SPI
spi_channel = bzzzz; // not using flags
avr_rx = bz; // not using serial port
}
}