Sample MachXO2 Lattice Diamond Project

From MKRD.info Wiki

MachXO2 Lattice Diamond Project


There are two implementations in the project: user and config for User Mode and Configure Mode respectively. Those two implementations share the same .lpf file. The Diamond project and file structure look like the following:


User implementation:


power_control


|___power_control.ldf

|___power_control.lpf

|___Strategy1.sty

|___user

|___source

|___adc_top.v

|___box_ave.v

|___demo_top_user.v

|___count16_ldrg.vhd

|___display.v

|___lcd_display.v

|___lcd4digit.v

|___LCDEncoding4to1.v

|___lcdencoding4to1com.v

|___pwm.v

|___sigmadelta_adc.v

|___ipexpress/LCDCharMap/LCDCharMap.ipx7 MachXO2 Low Power Control Demo



Config Implementation:


power_control

|___power_control.ldf

|___power_control.lpf

|___Strategy1.sty

|___config

|___source

|___adc_top.v

|___box_ave.v

|___demo_top_config.v

|___count16_ldrg.vhd

|___display.v

|___lcd_display.v

|___lcd4digit.v

|___LCDEncoding4to1.v

|___lcdencoding4to1com.v

|___pwm.v

|___sigmadelta_adc.v

|___wb_master.v

|___ipexpress/efb_spi_i2c/efb_spi_i2c.ipx

|___ipexpress/pwr_ctrl/pwr_ctrl.ipx

|___ipexpress/LCDCharMap/LCDCharMap.ipx


The following are necessary to enable the power control for the on-chip oscillator:


2.The STDBY port of OSCH needs to be set/reset to put the oscillator into Standby or Wake mode.


The Verilog code for OSCH instantiation looks like the following:


OSCH OSCH_inst (

.STDBY( STDBY ), // STDBY=1, stop oscillator; STDBY=0, start oscillator.

.OSC ( clk_osc ),

.SEDSTDBY ( )

/* synthesis syn_noprune = 1 */ ; // to prevent the oscillator from being optimized away


The on-chip oscillator can be turned on/off in two ways: through internal user logic and/or through the external I2C or SPI port.


In RTL coding, there Oscillator Instantiation1. An OSCH module needs to be instantiated in the code.