§ Коды

Исходный код шаблона скачать тут. В шаблоне есть vendor-файл для UFM.

§ max10.qpf

QUARTUS_VERSION = "15.1"
DATE = "20:37:53  October 03, 2020"
PROJECT_REVISION = "max10"

§ max10.v

В шаблоне сразу используется модуль UFM.
module max10(

    output wire [13:0]   IO,
    output wire [ 3:0]   LED,
    input  wire          KEY0,
    input  wire          KEY1,
    input  wire          SERIAL_RX,
    output wire          SERIAL_TX,
    input  wire          CLK100MHZ
);

wire drclk;
wire arshft;
wire arclk;
wire drdout;

// 3072 слов по 32 бита
altera_onchip_flash_block # (

        .DEVICE_FAMILY          ("MAX 10"),
        .PART_NAME              ("10M02DCV36C8G"),
        .IS_DUAL_BOOT           ("False"),
        .IS_ERAM_SKIP           ("True"),
        .IS_COMPRESSED_IMAGE    ("False"),
        .INIT_FILENAME          ("demo.mif"),
        .MIN_VALID_ADDR         (0),
        .MAX_VALID_ADDR         (3071),
        .MIN_UFM_VALID_ADDR     (0),
        .MAX_UFM_VALID_ADDR     (3071),
        .ADDR_RANGE1_END_ADDR   (3071),
        .ADDR_RANGE1_OFFSET     (512),
        .ADDR_RANGE2_OFFSET     (0),
        // simulation only start
        .DEVICE_ID              ("02"),
        .INIT_FILENAME_SIM      ("")
        // simulation only end

    ) altera_onchip_flash_block_ (

        .xe_ye      (1'b1),
        .se         (1'b1),
        .arclk      (arclk),        // arclk = 12.5/32 mhz
        .arshft     (arshft),       // 1=задвиг 0=инкремент
        .ardin      ({{22{1'b1}}, 1'b0}), // Задвигается постоянно адрес 0
        .drclk      (drclk),        // Тактовая частота 12,5 mhz для данных
        .drshft     (drshft),
        .drdin      (1'b0),
        .nprogram   (1'b1),
        .nerase     (1'b1),
        .nosc_ena   (1'b0),
        .par_en     (1'b1),
        .drdout     (drdout),       // Выходные данные для чтения Data Read Out
        .busy       (),
        .se_pass    (),
        .sp_pass    (),
        .osc        ()
    );

endmodule

§ max10.qsf

set_global_assignment -name FAMILY "MAX 10"
set_global_assignment -name DEVICE 10M02DCV36C8G
set_global_assignment -name TOP_LEVEL_ENTITY max10
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 15.1.0
set_global_assignment -name PROJECT_CREATION_TIME_DATE "20:37:53  OCTOBER 03, 2020"
set_global_assignment -name LAST_QUARTUS_VERSION 15.1.0
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 256
set_global_assignment -name EDA_SIMULATION_TOOL "ModelSim-Altera (Verilog)"
set_global_assignment -name EDA_OUTPUT_DATA_FORMAT "VERILOG HDL" -section_id eda_simulation
set_global_assignment -name VERILOG_FILE max10.v
set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "2.5 V"
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top

set_location_assignment PIN_B6 -to IO[10]
set_location_assignment PIN_C5 -to IO[11]
set_location_assignment PIN_C6 -to IO[8]
set_location_assignment PIN_D6 -to IO[9]
set_location_assignment PIN_D5 -to IO[6]
set_location_assignment PIN_E6 -to IO[7]
set_location_assignment PIN_E5 -to IO[4]
set_location_assignment PIN_F4 -to IO[2]
set_location_assignment PIN_E4 -to IO[5]
set_location_assignment PIN_F3 -to IO[3]
set_location_assignment PIN_E3 -to IO[1]
set_location_assignment PIN_F2 -to IO[0]
set_location_assignment PIN_B2 -to LED[0]
set_location_assignment PIN_A2 -to LED[1]
set_location_assignment PIN_A3 -to LED[2]
set_location_assignment PIN_A4 -to KEY1
set_location_assignment PIN_E2 -to KEY0
set_location_assignment PIN_B4 -to LED[3]
set_location_assignment PIN_A5 -to IO[12]
set_location_assignment PIN_B5 -to IO[13]
set_location_assignment PIN_E1 -to SERIAL_RX
set_location_assignment PIN_D1 -to CLK100MHZ
set_location_assignment PIN_C2 -to SERIAL_TX
set_instance_assignment -name IO_STANDARD "2.5 V SCHMITT TRIGGER" -to KEY0
set_instance_assignment -name IO_STANDARD "2.5 V SCHMITT TRIGGER" -to KEY1
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to KEY0
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to KEY1

set_global_assignment -name ENABLE_OCT_DONE OFF
set_global_assignment -name ENABLE_CONFIGURATION_PINS OFF
set_global_assignment -name ENABLE_BOOT_SEL_PIN OFF
set_global_assignment -name USE_CONFIGURATION_DEVICE ON
set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top