Improved icestorm example
This commit is contained in:
parent
6c7125b380
commit
f4842be8bb
|
@ -1,15 +1,16 @@
|
||||||
|
|
||||||
TOOLCHAIN_PREFIX = riscv64-unknown-elf-
|
TOOLCHAIN_PREFIX = riscv64-unknown-elf-
|
||||||
ICECUBE_DIR = /opt/lscc/iCEcube2.2014.08
|
|
||||||
|
|
||||||
all: example.bin
|
all: example.bin
|
||||||
|
|
||||||
firmware.elf: firmware.S firmware.c firmware.lds
|
firmware.elf: firmware.S firmware.c firmware.lds
|
||||||
$(TOOLCHAIN_PREFIX)gcc -Os -m32 -ffreestanding -nostdlib -o firmware.elf firmware.S firmware.c \
|
$(TOOLCHAIN_PREFIX)gcc -Os -m32 -ffreestanding -nostdlib -o firmware.elf firmware.S firmware.c \
|
||||||
--std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
|
--std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
|
||||||
|
chmod -x firmware.elf
|
||||||
|
|
||||||
firmware.bin: firmware.elf
|
firmware.bin: firmware.elf
|
||||||
$(TOOLCHAIN_PREFIX)objcopy -O binary firmware.elf firmware.bin
|
$(TOOLCHAIN_PREFIX)objcopy -O binary firmware.elf firmware.bin
|
||||||
|
chmod -x firmware.bin
|
||||||
|
|
||||||
firmware.hex: firmware.bin
|
firmware.hex: firmware.bin
|
||||||
python3 ../../firmware/makehex.py firmware.bin 128 > firmware.hex
|
python3 ../../firmware/makehex.py firmware.bin 128 > firmware.hex
|
||||||
|
@ -24,7 +25,7 @@ example.bin: example.txt
|
||||||
icepack example.txt example.bin
|
icepack example.txt example.bin
|
||||||
|
|
||||||
example_tb.exe: example_tb.v example.v firmware.hex
|
example_tb.exe: example_tb.v example.v firmware.hex
|
||||||
iverilog -o example_tb.exe -s testbench example.v example_tb.v ../../picorv32.v # $(ICECUBE_DIR)/verilog/sb_ice_syn.v
|
iverilog -o example_tb.exe -s testbench example.v example_tb.v ../../picorv32.v
|
||||||
chmod -x example_tb.exe
|
chmod -x example_tb.exe
|
||||||
|
|
||||||
sim: example_tb.exe
|
sim: example_tb.exe
|
||||||
|
|
|
@ -6,4 +6,9 @@ set_io LED4 C5
|
||||||
set_io LED5 C4
|
set_io LED5 C4
|
||||||
set_io LED6 B3
|
set_io LED6 B3
|
||||||
set_io LED7 C3
|
set_io LED7 C3
|
||||||
|
|
||||||
|
# on-board oscillator (12.0 MHz)
|
||||||
set_io clk_pin J3
|
set_io clk_pin J3
|
||||||
|
|
||||||
|
# external clock on PIO1_01 (pin 4 on 40 pin header)
|
||||||
|
#set_io clk_pin R15
|
||||||
|
|
|
@ -7,18 +7,8 @@ module top (
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Clock Buffer
|
// Clock Buffer
|
||||||
|
|
||||||
wire clk;
|
wire clk = clk_pin;
|
||||||
|
|
||||||
`ifdef USE_SB_GB_IO
|
|
||||||
SB_GB_IO #(
|
|
||||||
.PIN_TYPE(6'b 0000_01)
|
|
||||||
) clk_gb (
|
|
||||||
.PACKAGE_PIN(clk_pin),
|
|
||||||
.GLOBAL_BUFFER_OUTPUT(clk)
|
|
||||||
);
|
|
||||||
`else
|
|
||||||
assign clk = clk_pin;
|
|
||||||
`endif
|
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Reset Generator
|
// Reset Generator
|
||||||
|
@ -31,6 +21,7 @@ module top (
|
||||||
resetn_counter <= resetn_counter + 1;
|
resetn_counter <= resetn_counter + 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// PicoRV32 Core
|
// PicoRV32 Core
|
||||||
|
|
||||||
|
@ -60,6 +51,7 @@ module top (
|
||||||
.mem_rdata(mem_rdata)
|
.mem_rdata(mem_rdata)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Memory/IO Interface
|
// Memory/IO Interface
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue