VHDL實現SPI功能源代碼
-- The SPI bus is a 3 wire bus that in effect links a serial shift
-- register between the "master" and the "Slave". Typically both the
-- master and Slave have an 8 bit shift register so the combined
-- register is 16 bits. When an SPI transfer takes place, the master and
-- Slave shift their shift registers 8 bits and thus exchange their 8
-- bit register values.
Avalon Interface Specification,The Avalon interface specification is designed to accommodate peripheral development for the system-on-a-programmable-chip (SOPC) environment. The specification provides peripheral designers with a basis for describing the address-based read/write interface found on master and Slave peripherals, such as microprocessors, memory, UART, timer, etc.
An AHB system is made of masters Slaves and interconnections. A general approach to include all possible "muxed" implementation of multi layered AHB systems and arbitrated AHB ones can be thought as an acyclic graph where every source node is a master, every destination node is a Slave and every internal node is an arbiter there must
be one and only one arc exiting a master and one or more entering a Slave (single Slave verus multi-Slave or arbitrated Slave) an arbiter can have as many input and output connections as needed. A bridge is a special node that collapses one or more Slave nodes and a master node in a new "complex" node.
This program accesses a SPI EEPROM using polled mode access. The F12x MCU is configured in 4-wire Single Master Mode, and the EEPROM is the only Slave device connected to the SPI bus. The read/write operations are tailored to access a Microchip 4 kB EEPROM
// This program accesses a SPI EEPROM using polled mode access. The F06x MCU
// is configured in 4-wire Single Master Mode, and the EEPROM is the only
// Slave device connected to the SPI bus. The read/write operations are
// tailored to access a Microchip 4 kB EEPROM 25LC320. The relevant hardware
// connections of the F06x MCU are shown here:
// This program accesses a SPI EEPROM using polled mode access. The F06x MCU
// is configured in 4-wire Single Master Mode, and the EEPROM is the only
// Slave device connected to the SPI bus. The read/write operations are
// tailored to access a Microchip 4 kB EEPROM 25LC320. The relevant hardware
// connections of the F06x MCU are shown here:
This example demonstrates how the C8051F06x SMBus interface can communicate
// with a 256 byte I2C Serial EEPROM (Microchip 24LC02B).
// - Interrupt-driven SMBus implementation
// - Only master states defined (no Slave or arbitration)
// - Timer4 used by SMBus for SCL low timeout detection
// - SCL frequency defined by <SMB_FREQUENCY> constant