Beginning FPGA Programming - Partie73
Beginning FPGA Programming - Partie73
end arch;
--=============================================================================
-- architecture end
--=============================================================================
We will reuse the same PLL from Chapter 13 which is 50 MHz in and generate a 29.5 MHz clock out. The
SPI slave and SPI data register will directly use this output clock as a system clock.
The SPI DATA register is updated by the SPI slave wr_enable output. The value of the register will be
used to drive the LED outputs.
360
Chapter 15 ■ Two-Way Communications with Your Raspberry Pi: SPI
We use the locked signal from the PLL as an active low reset (rst_i). The signal will go high when the PLL
output is stable. This reset (rst_i) and output clock (clk_29Mz_i) are used in the rest of the logic.
SPI_DATA register is updated with data_out when the spi_slave, which is instantiated as spi_slave_pm
output wr_enable, is high. The LED outputs are an inverted version of the SPI_DATA (line 72) because the
LEDs are active low logic outputs.
361
Chapter 15 ■ Two-Way Communications with Your Raspberry Pi: SPI
The RTL design view in Quartus looks like Figure 15-20 when you compile the design and select the RTL
view from the top-level design (see section “Using Altera Quartus to Understand the FSM,” in Chapter 11, for
more information on how to use the RTL view).
362
Chapter 15 ■ Two-Way Communications with Your Raspberry Pi: SPI
363
Chapter 15 ■ Two-Way Communications with Your Raspberry Pi: SPI
364