This commit is contained in:
Polprzewodnikowy 2021-08-23 22:30:47 +02:00
parent 87fddd912e
commit b1826a9167
28 changed files with 115 additions and 1531 deletions

View File

@ -53,7 +53,7 @@ set_global_assignment -name QIP_FILE rtl/intel/fifo/intel_fifo_8.qip
set_global_assignment -name QIP_FILE rtl/intel/pll/intel_pll.qip set_global_assignment -name QIP_FILE rtl/intel/pll/intel_pll.qip
set_global_assignment -name SDC_FILE SummerCart64.sdc set_global_assignment -name SDC_FILE SummerCart64.sdc
set_global_assignment -name SIGNALTAP_FILE stp.stp set_global_assignment -name SIGNALTAP_FILE stp.stp
set_global_assignment -name SYSTEMVERILOG_FILE btldr/btldr.sv set_global_assignment -name SYSTEMVERILOG_FILE cpu/bootloader/cpu_bootloader.sv
set_global_assignment -name SYSTEMVERILOG_FILE picorv32/picorv32.v set_global_assignment -name SYSTEMVERILOG_FILE picorv32/picorv32.v
set_global_assignment -name SYSTEMVERILOG_FILE rtl/cpu/cpu_bus.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/cpu/cpu_bus.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/cpu/cpu_cfg.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/cpu/cpu_cfg.sv
@ -216,7 +216,7 @@ set_global_assignment -name USE_CONFIGURATION_DEVICE OFF
# Signal Tap Assignments # Signal Tap Assignments
# ====================== # ======================
set_global_assignment -name ENABLE_SIGNALTAP ON set_global_assignment -name ENABLE_SIGNALTAP ON
set_global_assignment -name USE_SIGNALTAP_FILE stp.stp set_global_assignment -name USE_SIGNALTAP_FILE output_files/signaltap.stp
# Power Estimation Assignments # Power Estimation Assignments
# ============================ # ============================
@ -304,6 +304,5 @@ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
# ------------------------ # ------------------------
set_global_assignment -name QIP_FILE rtl/intel/gpio/intel_gpio_ddro.qip set_global_assignment -name QIP_FILE rtl/intel/gpio/intel_gpio_ddro.qip
set_global_assignment -name SOURCE_FILE sfp.spf
set_global_assignment -name SLD_FILE db/stp_auto_stripped.stp
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_global_assignment -name SLD_FILE db/stp_auto_stripped.stp

View File

@ -1,36 +0,0 @@
CROSS=riscv64-unknown-elf-
FLAGS=\
-mabi=ilp32 \
-march=rv32i \
-std=c11 \
-Os \
-Wall \
-Wstrict-prototypes \
-fverbose-asm \
-ffunction-sections \
-fdata-sections \
-Tbtldr.ld \
-Wl,--gc-sections \
-ffreestanding \
-nostartfiles \
-nostdlib
all: btldr.bin btldr.sv print_size
btldr.elf: btldr.ld btldr.c
@$(CROSS)gcc $(FLAGS) btldr.c -o btldr.elf
btldr.bin: btldr.elf
@$(CROSS)objcopy -O binary btldr.elf btldr.bin
btldr.sv: btldr.bin
@python3 bin2sv.py btldr.bin btldr_template.sv btldr.sv
print_size:
@echo 'Size of target .elf file:'
$(CROSS)size -B btldr.elf
clean:
@rm -f btldr.sv btldr.bin btldr.elf
.PHONY: clean

View File

@ -1,33 +0,0 @@
CROSS=riscv64-unknown-elf-
FLAGS=\
-mabi=ilp32 \
-march=rv32i \
-std=c11 \
-Os \
-Wall \
-Wstrict-prototypes \
-fverbose-asm \
-ffunction-sections \
-fdata-sections \
-Wl,--gc-sections \
-ffreestanding \
-nostartfiles \
-nostdlib
all: cntrllr.bin print_size
cntrllr.elf: cntrllr.ld main.c rtc.c startup.S
@$(CROSS)gcc $(FLAGS) -Tcntrllr.ld main.c rtc.c startup.S -o cntrllr.elf
cntrllr.bin: cntrllr.elf
@$(CROSS)objcopy -O binary cntrllr.elf cntrllr.bin
print_size:
@echo 'Size of target .elf file:'
@$(CROSS)size -B cntrllr.elf
@echo $(shell $(CROSS)size -B cntrllr.elf | awk 'NR==2 { printf "\nTotal memory used: %.2f%%\n",(100/(16*1024))*($$4) }')
clean:
@rm -f cntrllr.bin cntrllr.elf
.PHONY: clean

Binary file not shown.

View File

@ -0,0 +1,36 @@
CROSS=riscv64-unknown-elf-
FLAGS=\
-mabi=ilp32 \
-march=rv32i \
-std=c11 \
-Os \
-Wall \
-Wstrict-prototypes \
-fverbose-asm \
-ffunction-sections \
-fdata-sections \
-Tprv32_rx.ld \
-Wl,--gc-sections \
-ffreestanding \
-nostartfiles \
-nostdlib
all: bootloader.bin cpu_bootloader.sv print_size
bootloader.elf: prv32_rx.ld main.c
@$(CROSS)gcc $(FLAGS) main.c -o bootloader.elf
bootloader.bin: bootloader.elf
@$(CROSS)objcopy -O binary bootloader.elf bootloader.bin
cpu_bootloader.sv: bootloader.bin
@python3 bin2sv.py bootloader.bin cpu_bootloader_template.sv cpu_bootloader.sv
print_size:
@echo 'Size of target .elf file:'
$(CROSS)size -B bootloader.elf
clean:
@rm -f cpu_bootloader.sv bootloader.bin bootloader.elf
.PHONY: clean

View File

@ -1,4 +1,4 @@
#include "btldr.h" #include "sys.h"
int reset_handler (void) { int reset_handler (void) {
#ifdef BOOT_UART #ifdef BOOT_UART

View File

@ -0,0 +1,36 @@
CROSS=riscv64-unknown-elf-
FLAGS=\
-mabi=ilp32 \
-march=rv32i \
-std=c11 \
-Os \
-Wall \
-Wstrict-prototypes \
-fverbose-asm \
-ffunction-sections \
-fdata-sections \
-Tprv32_rwx.ld \
-Wl,--gc-sections \
-ffreestanding \
-nostartfiles \
-nostdlib
all: controller.bin print_size
controller.elf: prv32_rwx.ld main.c rtc.c startup.S
@$(CROSS)gcc $(FLAGS) main.c rtc.c startup.S -o controller.elf
controller.bin: controller.elf
@$(CROSS)objcopy -O binary controller.elf tmp.bin
@python3 bin2rom.py tmp.bin controller.bin
@rm -f tmp.bin
print_size:
@echo 'Size of target .elf file:'
@$(CROSS)size -B controller.elf
@echo $(shell $(CROSS)size -B controller.elf | awk 'NR==2 { printf "\nTotal memory used: %.2f%%\n",(100/(16*1024))*($$4) }')
clean:
@rm -f controller.bin controller.elf
.PHONY: clean

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
import os
import sys
binary = None
rom = None
binary_name = sys.argv[1] or 'binary.bin'
rom_name = sys.argv[2] or 'rom.bin'
try:
binary = open(binary_name, mode='rb')
rom = open(rom_name, mode='wb')
length = os.path.getsize(binary_name)
rom.write(length.to_bytes(4, byteorder='little'))
rom.write(binary.read())
except Exception as e:
print(f'Unable to convert the rom: {e}', file=sys.stderr)
sys.exit(-1)
finally:
if (binary): binary.close()
if (rom): rom.close()

View File

@ -71,8 +71,8 @@
<parameter name="SECTOR_ACCESS_MODE">Read only,Read only,Hidden,Read only,Read only</parameter> <parameter name="SECTOR_ACCESS_MODE">Read only,Read only,Hidden,Read only,Read only</parameter>
<parameter name="autoInitializationFileName">$${FILENAME}_onchip_flash_0</parameter> <parameter name="autoInitializationFileName">$${FILENAME}_onchip_flash_0</parameter>
<parameter name="initFlashContent" value="true" /> <parameter name="initFlashContent" value="true" />
<parameter name="initializationFileName">C:/Dev/SummerCollection/sw/bootloader/build/SummerLoader64.hex</parameter> <parameter name="initializationFileName">../sw/bootloader/build/SummerLoader64.hex</parameter>
<parameter name="initializationFileNameForSim">C:/Dev/SummerCollection/sw/bootloader/build/SummerLoader64.hex</parameter> <parameter name="initializationFileNameForSim">../sw/bootloader/build/SummerLoader64.hex</parameter>
<parameter name="useNonDefaultInitFile" value="true" /> <parameter name="useNonDefaultInitFile" value="true" />
</module> </module>
<interconnectRequirement for="$system" name="qsys_mm.clockCrossingAdapter" value="HANDSHAKE" /> <interconnectRequirement for="$system" name="qsys_mm.clockCrossingAdapter" value="HANDSHAKE" />

View File

@ -1,111 +0,0 @@
/*
WARNING: Do NOT edit the input and output ports in this file in a text
editor if you plan to continue editing the block that represents it in
the Block Editor! File corruption is VERY likely to occur.
*/
/*
Copyright (C) 2020 Intel Corporation. All rights reserved.
Your use of Intel Corporation's design tools, logic functions
and other software and tools, and any partner logic
functions, and any output files from any of the foregoing
(including device programming or simulation files), and any
associated documentation or information are expressly subject
to the terms and conditions of the Intel Program License
Subscription Agreement, the Intel Quartus Prime License Agreement,
the Intel FPGA IP License Agreement, or other applicable license
agreement, including, without limitation, that your use is for
the sole purpose of programming logic devices manufactured by
Intel and sold by Intel or its authorized distributors. Please
refer to the applicable agreement for further details, at
https://fpgasoftware.intel.com/eula.
*/
(header "symbol" (version "1.1"))
(symbol
(rect 0 0 368 264)
(text "intel_flash" (rect 154 -1 192 11)(font "Arial" (font_size 10)))
(text "inst" (rect 8 248 20 260)(font "Arial" ))
(port
(pt 0 72)
(input)
(text "clock" (rect 0 0 20 12)(font "Arial" (font_size 8)))
(text "clock" (rect 4 61 34 72)(font "Arial" (font_size 8)))
(line (pt 0 72)(pt 144 72)(line_width 1))
)
(port
(pt 0 112)
(input)
(text "avmm_data_addr[15..0]" (rect 0 0 96 12)(font "Arial" (font_size 8)))
(text "avmm_data_addr[15..0]" (rect 4 101 130 112)(font "Arial" (font_size 8)))
(line (pt 0 112)(pt 144 112)(line_width 3))
)
(port
(pt 0 128)
(input)
(text "avmm_data_read" (rect 0 0 73 12)(font "Arial" (font_size 8)))
(text "avmm_data_read" (rect 4 117 88 128)(font "Arial" (font_size 8)))
(line (pt 0 128)(pt 144 128)(line_width 1))
)
(port
(pt 0 192)
(input)
(text "avmm_data_burstcount[1..0]" (rect 0 0 115 12)(font "Arial" (font_size 8)))
(text "avmm_data_burstcount[1..0]" (rect 4 181 160 192)(font "Arial" (font_size 8)))
(line (pt 0 192)(pt 144 192)(line_width 3))
)
(port
(pt 0 232)
(input)
(text "reset_n" (rect 0 0 30 12)(font "Arial" (font_size 8)))
(text "reset_n" (rect 4 221 46 232)(font "Arial" (font_size 8)))
(line (pt 0 232)(pt 144 232)(line_width 1))
)
(port
(pt 0 144)
(output)
(text "avmm_data_readdata[31..0]" (rect 0 0 113 12)(font "Arial" (font_size 8)))
(text "avmm_data_readdata[31..0]" (rect 4 133 154 144)(font "Arial" (font_size 8)))
(line (pt 0 144)(pt 144 144)(line_width 3))
)
(port
(pt 0 160)
(output)
(text "avmm_data_waitrequest" (rect 0 0 99 12)(font "Arial" (font_size 8)))
(text "avmm_data_waitrequest" (rect 4 149 130 160)(font "Arial" (font_size 8)))
(line (pt 0 160)(pt 144 160)(line_width 1))
)
(port
(pt 0 176)
(output)
(text "avmm_data_readdatavalid" (rect 0 0 107 12)(font "Arial" (font_size 8)))
(text "avmm_data_readdatavalid" (rect 4 165 142 176)(font "Arial" (font_size 8)))
(line (pt 0 176)(pt 144 176)(line_width 1))
)
(drawing
(text "clk" (rect 129 43 276 99)(font "Arial" (color 128 0 0)(font_size 9)))
(text "clk" (rect 149 67 316 144)(font "Arial" (color 0 0 0)))
(text "data" (rect 120 83 264 179)(font "Arial" (color 128 0 0)(font_size 9)))
(text "address" (rect 149 107 340 224)(font "Arial" (color 0 0 0)))
(text "read" (rect 149 123 322 256)(font "Arial" (color 0 0 0)))
(text "readdata" (rect 149 139 346 288)(font "Arial" (color 0 0 0)))
(text "waitrequest" (rect 149 155 364 320)(font "Arial" (color 0 0 0)))
(text "readdatavalid" (rect 149 171 376 352)(font "Arial" (color 0 0 0)))
(text "burstcount" (rect 149 187 358 384)(font "Arial" (color 0 0 0)))
(text "nreset" (rect 108 203 252 419)(font "Arial" (color 128 0 0)(font_size 9)))
(text "reset_n" (rect 149 227 340 464)(font "Arial" (color 0 0 0)))
(text " system " (rect 333 248 714 506)(font "Arial" ))
(line (pt 144 32)(pt 224 32)(line_width 1))
(line (pt 224 32)(pt 224 248)(line_width 1))
(line (pt 144 248)(pt 224 248)(line_width 1))
(line (pt 144 32)(pt 144 248)(line_width 1))
(line (pt 145 52)(pt 145 76)(line_width 1))
(line (pt 146 52)(pt 146 76)(line_width 1))
(line (pt 145 92)(pt 145 196)(line_width 1))
(line (pt 146 92)(pt 146 196)(line_width 1))
(line (pt 145 212)(pt 145 236)(line_width 1))
(line (pt 146 212)(pt 146 236)(line_width 1))
(line (pt 0 0)(pt 368 0)(line_width 1))
(line (pt 368 0)(pt 368 264)(line_width 1))
(line (pt 0 264)(pt 368 264)(line_width 1))
(line (pt 0 0)(pt 0 264)(line_width 1))
)
)

View File

@ -1,13 +0,0 @@
component intel_flash is
port (
clock : in std_logic := 'X'; -- clk
avmm_data_addr : in std_logic_vector(15 downto 0) := (others => 'X'); -- address
avmm_data_read : in std_logic := 'X'; -- read
avmm_data_readdata : out std_logic_vector(31 downto 0); -- readdata
avmm_data_waitrequest : out std_logic; -- waitrequest
avmm_data_readdatavalid : out std_logic; -- readdatavalid
avmm_data_burstcount : in std_logic_vector(1 downto 0) := (others => 'X'); -- burstcount
reset_n : in std_logic := 'X' -- reset_n
);
end component intel_flash;

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<pinplan
variation_name="onchip_flash_0"
megafunction_name="ALTERA_ONCHIP_FLASH"
intended_family="MAX 10"
specifies="all_ports">
<global>
<pin name="clock" direction="input" scope="external" />
<pin name="reset_n" direction="input" scope="external" />
<pin name="avmm_data_addr[15..0]" direction="input" scope="external" />
<pin name="avmm_data_read" direction="input" scope="external" />
<pin name="avmm_data_readdata[31..0]" direction="output" scope="external" />
<pin name="avmm_data_waitrequest" direction="output" scope="external" />
<pin name="avmm_data_readdatavalid" direction="output" scope="external" />
<pin name="avmm_data_burstcount[1..0]" direction="input" scope="external" />
</global>
</pinplan>

View File

@ -1,20 +0,0 @@
module intel_flash (
clock,
avmm_data_addr,
avmm_data_read,
avmm_data_readdata,
avmm_data_waitrequest,
avmm_data_readdatavalid,
avmm_data_burstcount,
reset_n);
input clock;
input [15:0] avmm_data_addr;
input avmm_data_read;
output [31:0] avmm_data_readdata;
output avmm_data_waitrequest;
output avmm_data_readdatavalid;
input [1:0] avmm_data_burstcount;
input reset_n;
endmodule

View File

@ -1,11 +0,0 @@
intel_flash u0 (
.clock (<connected-to-clock>), // clk.clk
.avmm_data_addr (<connected-to-avmm_data_addr>), // data.address
.avmm_data_read (<connected-to-avmm_data_read>), // .read
.avmm_data_readdata (<connected-to-avmm_data_readdata>), // .readdata
.avmm_data_waitrequest (<connected-to-avmm_data_waitrequest>), // .waitrequest
.avmm_data_readdatavalid (<connected-to-avmm_data_readdatavalid>), // .readdatavalid
.avmm_data_burstcount (<connected-to-avmm_data_burstcount>), // .burstcount
.reset_n (<connected-to-reset_n>) // nreset.reset_n
);

View File

@ -1,25 +0,0 @@
component intel_flash is
port (
clock : in std_logic := 'X'; -- clk
avmm_data_addr : in std_logic_vector(15 downto 0) := (others => 'X'); -- address
avmm_data_read : in std_logic := 'X'; -- read
avmm_data_readdata : out std_logic_vector(31 downto 0); -- readdata
avmm_data_waitrequest : out std_logic; -- waitrequest
avmm_data_readdatavalid : out std_logic; -- readdatavalid
avmm_data_burstcount : in std_logic_vector(1 downto 0) := (others => 'X'); -- burstcount
reset_n : in std_logic := 'X' -- reset_n
);
end component intel_flash;
u0 : component intel_flash
port map (
clock => CONNECTED_TO_clock, -- clk.clk
avmm_data_addr => CONNECTED_TO_avmm_data_addr, -- data.address
avmm_data_read => CONNECTED_TO_avmm_data_read, -- .read
avmm_data_readdata => CONNECTED_TO_avmm_data_readdata, -- .readdata
avmm_data_waitrequest => CONNECTED_TO_avmm_data_waitrequest, -- .waitrequest
avmm_data_readdatavalid => CONNECTED_TO_avmm_data_readdatavalid, -- .readdatavalid
avmm_data_burstcount => CONNECTED_TO_avmm_data_burstcount, -- .burstcount
reset_n => CONNECTED_TO_reset_n -- nreset.reset_n
);

View File

@ -1,15 +0,0 @@
<session jtag_chain="Arrow-USB-Blaster [AR5GOOMN]" jtag_device="@1: 10M08SA(.|ES)/10M08SC (0x031820DD)" sof_file="C:/Dev/SummerCollection/fw/output_files/SummerCart64.sof">
<display_attributes is_max_probe_read_interval="1" is_write_immediate="1" probe_read_interval="1" probe_read_interval_units="s"/>
<instance enable_logging="true" entity_name="SC64" is_auto_node="true" name="SC64">
<node_ip_info instance_id="0" mfg_id="110" node_id="9" version="0"/>
<sources>
<source name="source[0]" value="false"/>
</sources>
<probes/>
<view>
<view_node expanded="true" group_name="source[0..0]" index="0" lsb_to_msb="false" node_type="source" view_type="group_header"/>
<view_node expanded="true" index="0" node_type="source" view_type="group_member"/>
</view>
<log data="" max_size="8" size="0" time="" width="1"/>
</instance>
</session>

1231
fw/stp.stp

File diff suppressed because one or more lines are too long