From f4842be8bbbf0ba6b44b6a5aaf69647e5007924a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 19 Jul 2015 16:44:31 +0200 Subject: Improved icestorm example --- scripts/icestorm/Makefile | 5 +++-- scripts/icestorm/example.pcf | 5 +++++ scripts/icestorm/example.v | 14 +++----------- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'scripts/icestorm') diff --git a/scripts/icestorm/Makefile b/scripts/icestorm/Makefile index 296c8ed..a6a4b4f 100644 --- a/scripts/icestorm/Makefile +++ b/scripts/icestorm/Makefile @@ -1,15 +1,16 @@ TOOLCHAIN_PREFIX = riscv64-unknown-elf- -ICECUBE_DIR = /opt/lscc/iCEcube2.2014.08 all: example.bin firmware.elf: firmware.S firmware.c firmware.lds $(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 + chmod -x firmware.elf firmware.bin: firmware.elf $(TOOLCHAIN_PREFIX)objcopy -O binary firmware.elf firmware.bin + chmod -x firmware.bin firmware.hex: firmware.bin python3 ../../firmware/makehex.py firmware.bin 128 > firmware.hex @@ -24,7 +25,7 @@ example.bin: example.txt icepack example.txt example.bin 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 sim: example_tb.exe diff --git a/scripts/icestorm/example.pcf b/scripts/icestorm/example.pcf index 5f21bd6..8190282 100644 --- a/scripts/icestorm/example.pcf +++ b/scripts/icestorm/example.pcf @@ -6,4 +6,9 @@ set_io LED4 C5 set_io LED5 C4 set_io LED6 B3 set_io LED7 C3 + +# on-board oscillator (12.0 MHz) set_io clk_pin J3 + +# external clock on PIO1_01 (pin 4 on 40 pin header) +#set_io clk_pin R15 diff --git a/scripts/icestorm/example.v b/scripts/icestorm/example.v index 5c40661..cd52c76 100644 --- a/scripts/icestorm/example.v +++ b/scripts/icestorm/example.v @@ -7,18 +7,8 @@ module top ( // ------------------------------- // 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 @@ -31,6 +21,7 @@ module top ( resetn_counter <= resetn_counter + 1; end + // ------------------------------- // PicoRV32 Core @@ -60,6 +51,7 @@ module top ( .mem_rdata(mem_rdata) ); + // ------------------------------- // Memory/IO Interface -- cgit