├── .gitignore ├── .readthedocs.yaml ├── COPYING ├── CodeOfConduct ├── Makefile ├── README ├── config.mk ├── docs ├── .gitignore ├── Makefile ├── README.md └── source │ ├── _static │ ├── images │ │ ├── checkerboard.png │ │ ├── checkerboard.sh │ │ ├── colbuf.svg │ │ ├── icestick.jpg │ │ ├── iosp.svg │ │ ├── sp4h.svg │ │ └── sp4v.svg │ └── slides.pdf │ ├── conf.py │ ├── format.rst │ ├── index.rst │ ├── io_tile.rst │ ├── logic_tile.rst │ ├── notes_osx.rst │ ├── overview.rst │ ├── ram_tile.rst │ ├── requirements.txt │ └── ultraplus.rst ├── examples ├── hx8kboard │ ├── .gitignore │ ├── Makefile │ ├── example.v │ └── hx8kboard.pcf ├── iceblink │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── example.v │ └── iceblink.pcf ├── icebreaker │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── example.v │ └── icebreaker.pcf ├── icemulti │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── app0.v │ ├── app1.v │ ├── app2.v │ ├── app3.v │ └── icestick.pcf ├── icestick │ ├── .gitignore │ ├── Makefile │ ├── checker.v │ ├── checker_tb.v │ ├── example.v │ ├── icestick.pcf │ ├── rs232demo.v │ └── rs232demo_tb.v ├── icezum │ ├── .gitignore │ ├── Makefile │ ├── example.v │ └── icezum.pcf └── up5k_rgb │ ├── .gitignore │ ├── Makefile │ ├── Makefile.uwg30 │ ├── README │ ├── rgb.pcf │ ├── rgb.v │ └── rgb_uwg30.pcf ├── icebox ├── .gitignore ├── Makefile ├── icebox.py ├── icebox_asc2hlc.py ├── icebox_chipdb.py ├── icebox_colbuf.py ├── icebox_diff.py ├── icebox_explain.py ├── icebox_hlc2asc.py ├── icebox_hlcsort.py ├── icebox_html.py ├── icebox_maps.py ├── icebox_stat.py ├── icebox_vlog.py ├── iceboxdb.py ├── tc_logic_xpr.py ├── tc_rxlat_netnames.py └── tc_xlat_netnames.py ├── icebram ├── .gitignore ├── Makefile ├── icebram.cc ├── makedemo.py └── rundemo.sh ├── icecompr ├── .gitignore ├── Makefile ├── README ├── example_1k.bin ├── example_8k.bin ├── icecompr.cc ├── icecompr.py └── iceuncompr.c ├── icefuzz ├── .gitignore ├── Makefile ├── cached_dsp0_5k.txt ├── cached_dsp1_5k.txt ├── cached_dsp2_5k.txt ├── cached_dsp3_5k.txt ├── cached_io.txt ├── cached_ipcon_5k.txt ├── cached_logic.txt ├── cached_ramb.txt ├── cached_ramb_8k.txt ├── cached_ramt.txt ├── cached_ramt_8k.txt ├── check.sh ├── database.py ├── export.py ├── extract.py ├── fuzzconfig.py ├── glbcheck.py ├── glbmapbits.py ├── icecube.sh ├── make_aig.py ├── make_binop.py ├── make_cluster.py ├── make_dsp.py ├── make_fanout.py ├── make_fflogic.py ├── make_gbio.py ├── make_gbio2.py ├── make_io.py ├── make_iopack.py ├── make_logic.py ├── make_mem.py ├── make_mesh.py ├── make_pin2pin.py ├── make_pll.py ├── make_prim.py ├── make_ram40.py ├── make_uip.py ├── make_upip.py ├── pinloc │ ├── .gitignore │ ├── pinloc-1k-cb121.sh │ ├── pinloc-1k-cb132.sh │ ├── pinloc-1k-cb81.sh │ ├── pinloc-1k-cm121.sh │ ├── pinloc-1k-cm36.sh │ ├── pinloc-1k-cm49.sh │ ├── pinloc-1k-cm81.sh │ ├── pinloc-1k-qn84.sh │ ├── pinloc-1k-swg16tr.sh │ ├── pinloc-1k-tq144.sh │ ├── pinloc-1k-vq100.sh │ ├── pinloc-384-cm36.sh │ ├── pinloc-384-cm49.sh │ ├── pinloc-384-qn32.sh │ ├── pinloc-4k-cb132.sh │ ├── pinloc-4k-cm121.sh │ ├── pinloc-4k-cm225.sh │ ├── pinloc-4k-cm81.sh │ ├── pinloc-4k-tq144.sh │ ├── pinloc-8k-cb132.sh │ ├── pinloc-8k-cm121.sh │ ├── pinloc-8k-cm225.sh │ ├── pinloc-8k-cm81.sh │ ├── pinloc-8k-ct256.sh │ ├── pinloc-u4k-sg48.sh │ └── pinlocdb.py ├── rename_dsps.py ├── runloop.sh ├── tests │ ├── .gitignore │ ├── all_luts_ffff.bin │ ├── bitop.pcf │ ├── bitop.v │ ├── bram.pcf │ ├── bram.v │ ├── carry.v │ ├── colbuf.py │ ├── colbuf.sh │ ├── colbuf_384.py │ ├── colbuf_384.sh │ ├── colbuf_5k.sh │ ├── colbuf_8k.sh │ ├── colbuf_io.sh │ ├── colbuf_io_384.sh │ ├── colbuf_io_5k.sh │ ├── colbuf_io_8k.sh │ ├── colbuf_io_lm4k.sh │ ├── colbuf_io_u4k.sh │ ├── colbuf_logic.sh │ ├── colbuf_logic_384.sh │ ├── colbuf_logic_5k.sh │ ├── colbuf_logic_8k.sh │ ├── colbuf_logic_lm4k.sh │ ├── colbuf_logic_u4k.sh │ ├── colbuf_ram.sh │ ├── colbuf_ram_5k.sh │ ├── colbuf_ram_8k.sh │ ├── colbuf_ram_lm4k.sh │ ├── colbuf_ram_u4k.sh │ ├── colbuf_u4k.sh │ ├── colbufs.pcf │ ├── colbufs.v │ ├── cross_0.pcf │ ├── cross_0.v │ ├── dsp_cbit │ │ ├── .gitignore │ │ ├── dsp_cbits_up5k.txt │ │ └── fuzz_dsp_cbit.py │ ├── example_hx8kboard.pcf │ ├── example_hx8kboard.sdc │ ├── example_hx8kboard.sh │ ├── example_hx8kboard.v │ ├── example_icestick.pcf │ ├── example_icestick.sdc │ ├── example_icestick.sh │ ├── example_icestick.v │ ├── glb-u4k.sh │ ├── icegate.pcf │ ├── icegate.v │ ├── intosc.pcf │ ├── intosc.v │ ├── io_glb_netwk.pcf │ ├── io_glb_netwk.v │ ├── io_latched.sh │ ├── io_latched.v │ ├── io_latched_384.sh │ ├── io_latched_5k.sh │ ├── io_latched_lm4k.sh │ ├── io_latched_u4k.sh │ ├── ioctrl.py │ ├── ioctrl.sh │ ├── ioctrl_384.py │ ├── ioctrl_384.sh │ ├── ioctrl_5k.py │ ├── ioctrl_5k.sh │ ├── ioctrl_lm4k.py │ ├── ioctrl_lm4k.sh │ ├── ip │ │ ├── .gitignore │ │ ├── make_html_table.py │ │ ├── trace_ip.py │ │ ├── trace_ip_u4k.py │ │ ├── u4k_I2C_data.txt │ │ ├── u4k_SPI_data.txt │ │ ├── up5k_I2C_data.txt │ │ ├── up5k_LEDDA_IP_data.txt │ │ └── up5k_SPI_data.txt │ ├── lut_cascade.pcf │ ├── lut_cascade.v │ ├── osc │ │ └── osc.py │ ├── pllauto │ │ ├── .gitignore │ │ ├── pll_data_up5k.txt │ │ └── pllauto.py │ ├── raminits.pcf │ ├── raminits.v │ ├── rgb_drv_cbit │ │ ├── .gitignore │ │ ├── fuzz_rgb_drv_cbit.py │ │ └── rgb_drv_data_u4k.txt │ ├── rgba_drv_cbit │ │ ├── .gitignore │ │ ├── fuzz_rgba_drv_cbit.py │ │ └── rgba_drv_data_up5k.txt │ ├── sb_dff.v │ ├── sb_dffe.v │ ├── sb_dffer.v │ ├── sb_dffes.v │ ├── sb_dffesr.v │ ├── sb_dffess.v │ ├── sb_dffr.v │ ├── sb_dffs.v │ ├── sb_dffsr.v │ ├── sb_dffss.v │ ├── sb_gb.v │ ├── sb_gb_io.v │ ├── sb_i2c.pcf │ ├── sb_i2c.v │ ├── sb_i2c_io.pcf │ ├── sb_i2c_io.v │ ├── sb_io.pcf │ ├── sb_io.v │ ├── sb_io_i3c.pcf │ ├── sb_io_i3c.v │ ├── sb_io_negclk.pcf │ ├── sb_io_negclk.v │ ├── sb_io_od.pcf │ ├── sb_io_od.v │ ├── sb_mac16.v │ ├── sb_pll40_2_pad.v │ ├── sb_pll40_2f_core.v │ ├── sb_pll40_2f_pad.v │ ├── sb_pll40_core.v │ ├── sb_pll40_pad.v │ ├── sb_ram40.pcf │ ├── sb_ram40.v │ ├── sb_rgb_drv.pcf │ ├── sb_rgb_drv.v │ ├── sb_rgba_drv.pcf │ ├── sb_rgba_drv.v │ ├── sb_spram256ka.v │ ├── sb_warmboot.v │ ├── spram │ │ ├── .gitignore │ │ ├── fuzz_spram.py │ │ └── up5k_spram_data.txt │ ├── test_pio.sh │ └── test_pio_tb.v ├── timings.py ├── timings_hx1k.txt ├── timings_hx8k.txt ├── timings_loop.sh ├── timings_lp1k.txt ├── timings_lp384.txt ├── timings_lp8k.txt ├── timings_u4k.txt ├── timings_up5k.txt ├── tmedges.txt └── tmedges.ys ├── icemulti ├── .gitignore ├── Makefile └── icemulti.cc ├── icepack ├── .gitignore ├── Makefile └── icepack.cc ├── icepll ├── .gitignore ├── Makefile └── icepll.cc ├── iceprog ├── .gitignore ├── Makefile ├── iceprog.c ├── mpsse.c └── mpsse.h └── icetime ├── .gitignore ├── Makefile ├── cells.v ├── icetime.cc ├── iceutil.cc ├── mktest.py ├── show.sh └── timings.py /.gitignore: -------------------------------------------------------------------------------- 1 | icestorm-win32.zip 2 | icestorm-win32/ 3 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-22.04 5 | tools: 6 | python: '3.11' 7 | jobs: 8 | pre_build: 9 | - python3 icebox/icebox_html.py -3 -d docs/source/_static/bitdocs-384 10 | - python3 icebox/icebox_html.py -d docs/source/_static/bitdocs-1k 11 | - python3 icebox/icebox_html.py -8 -d docs/source/_static/bitdocs-8k 12 | 13 | sphinx: 14 | configuration: docs/source/conf.py 15 | 16 | python: 17 | install: 18 | - requirements: docs/source/requirements.txt 19 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 - 2022 Claire Xenia Wolf 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include config.mk 2 | 3 | SUBDIRS := icebox icepack icemulti icepll icebram icetime 4 | ifeq ($(ICEPROG),1) 5 | SUBDIRS += iceprog 6 | endif 7 | 8 | all: $(addsuffix .all,$(SUBDIRS)) 9 | $(addsuffix .all,$(SUBDIRS)): 10 | $(MAKE) -C $(basename $@) all 11 | 12 | clean install uninstall: 13 | for dir in $(SUBDIRS); do \ 14 | $(MAKE) -C $$dir $@ || exit; \ 15 | done 16 | 17 | mxebin: clean 18 | $(MAKE) MXE=1 19 | rm -rf icestorm-win32 && mkdir icestorm-win32 20 | cp icebox/chipdb-*.txt icepack/*.exe iceprog/*.exe icestorm-win32/ 21 | cp icemulti/*.exe icepll/*.exe icetime/*.exe icestorm-win32/ 22 | zip -r icestorm-win32.zip icestorm-win32/ 23 | 24 | .PHONY: all clean install uninstall 25 | 26 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Project IceStorm aims at documenting the bitstream format of Lattice iCE40 2 | FPGAs and providing simple tools for analyzing and creating bitstream files. 3 | 4 | See https://prjicestorm.readthedocs.io/ for more information. 5 | 6 | Most of Project IceStorm is licensed under the ISC license: 7 | 8 | # Permission to use, copy, modify, and/or distribute this software for any 9 | # purpose with or without fee is hereby granted, provided that the above 10 | # copyright notice and this permission notice appear in all copies. 11 | # 12 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | -------------------------------------------------------------------------------- /config.mk: -------------------------------------------------------------------------------- 1 | PREFIX ?= /usr/local 2 | DEBUG ?= 0 3 | ICEPROG ?= 1 4 | PROGRAM_PREFIX ?= 5 | 6 | CXX ?= clang++ 7 | CC ?= clang 8 | PKG_CONFIG ?= pkg-config 9 | 10 | C_STD ?= c99 11 | CXX_STD ?= c++11 12 | ifeq ($(DEBUG),1) 13 | OPT_LEVEL ?= 0 14 | DBG_LEVEL ?= -ggdb 15 | else 16 | OPT_LEVEL ?= 2 17 | DBG_LEVEL ?= 18 | endif 19 | WARN_LEVEL ?= all 20 | 21 | LDLIBS = -lm -lstdc++ 22 | CFLAGS += -MD -MP -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(C_STD) -I$(PREFIX)/include 23 | CXXFLAGS += -MD -MP -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(CXX_STD) -I$(PREFIX)/include 24 | 25 | DESTDIR ?= 26 | CHIPDB_SUBDIR ?= $(PROGRAM_PREFIX)icebox 27 | 28 | ifeq ($(MXE),1) 29 | EXE = .exe 30 | CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc 31 | CC = $(CXX) 32 | PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config 33 | endif 34 | 35 | ifeq ($(EMCC),1) 36 | EXE = .js 37 | CC = emcc 38 | CXX = emcc 39 | PREFIX = / 40 | LDFLAGS = -O2 --memory-init-file 0 -s TOTAL_MEMORY=64*1024*1024 41 | SUBDIRS = icebox icepack icemulti icepll icetime icebram 42 | endif 43 | 44 | PYTHON3 ?= python3 45 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | build 3 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | PYTHON ?= python3 11 | 12 | # Put it first so that "make" without argument is like "make help". 13 | help: 14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 15 | 16 | .PHONY: help Makefile 17 | 18 | # Catch-all target: route all unknown targets to Sphinx using the new 19 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 20 | %: Makefile 21 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 22 | 23 | .PHONY: clean 24 | 25 | clean: 26 | @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 27 | 28 | .PHONY: reqs 29 | reqs: 30 | $(PYTHON) -m pip install -r source/requirements.txt 31 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | Project Icestorm Documentation 2 | =================================== 3 | 4 | Setting up environment 5 | ---------------------- 6 | 7 | ``` 8 | python -m venv .venv 9 | source .venv/bin/activate 10 | make reqs 11 | ``` 12 | -------------------------------------------------------------------------------- /docs/source/_static/images/checkerboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/docs/source/_static/images/checkerboard.png -------------------------------------------------------------------------------- /docs/source/_static/images/checkerboard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pbm_to_ppm() { 4 | read line; echo "P3" 5 | read line; echo "$line"; echo "2" 6 | sed "s,0,x,g; s,1,y,g; s,x,$1,g; s,y,$2,g;" 7 | 8 | } 9 | 10 | ../icepack/icepack -uc -B0 ../tests/example.bin | pbm_to_ppm "0 0 0" "0 0 2" > checkerboard_0.ppm 11 | ../icepack/icepack -ucc -B0 ../tests/example.bin | pbm_to_ppm "0 0 0" "0 1 0" > checkerboard_1.ppm 12 | ../icepack/icepack -uc -B1 ../tests/example.bin | pbm_to_ppm "0 0 0" "0 1 1" > checkerboard_2.ppm 13 | ../icepack/icepack -ucc -B1 ../tests/example.bin | pbm_to_ppm "0 0 0" "1 0 0" > checkerboard_3.ppm 14 | ../icepack/icepack -uc -B2 ../tests/example.bin | pbm_to_ppm "0 0 0" "1 0 1" > checkerboard_4.ppm 15 | ../icepack/icepack -ucc -B2 ../tests/example.bin | pbm_to_ppm "0 0 0" "1 1 0" > checkerboard_5.ppm 16 | ../icepack/icepack -uc -B3 ../tests/example.bin | pbm_to_ppm "0 0 0" "1 1 1" > checkerboard_6.ppm 17 | ../icepack/icepack -ucc -B3 ../tests/example.bin | pbm_to_ppm "0 0 0" "0 1 0" > checkerboard_7.ppm 18 | 19 | convert -evaluate-sequence add checkerboard_[01234567].ppm checkerboard.png 20 | rm -f checkerboard_[01234567].ppm 21 | 22 | -------------------------------------------------------------------------------- /docs/source/_static/images/icestick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/docs/source/_static/images/icestick.jpg -------------------------------------------------------------------------------- /docs/source/_static/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/docs/source/_static/slides.pdf -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # For the full list of built-in configuration values, see the documentation: 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 5 | 6 | # -- Project information ----------------------------------------------------- 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 8 | 9 | project = 'Project Icestorm' 10 | copyright = '2024, YosysHQ' 11 | author = 'YosysHQ' 12 | 13 | # -- General configuration --------------------------------------------------- 14 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 15 | 16 | extensions = ['sphinx_rtd_theme', 17 | 'sphinxcontrib.rsvgconverter' 18 | ] 19 | 20 | templates_path = ['_templates'] 21 | exclude_patterns = [] 22 | 23 | 24 | # -- Options for HTML output ------------------------------------------------- 25 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 26 | 27 | html_theme = 'sphinx_rtd_theme' 28 | html_theme_options = { 29 | "collapse_navigation": True, 30 | "sticky_navigation": True, 31 | "includehidden": True, 32 | "navigation_depth": 4, 33 | "titles_only": False 34 | } 35 | html_static_path = ['_static'] 36 | 37 | latex_engine = 'lualatex' 38 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to Project Icestorm 2 | =========================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: Project Icestorm 7 | 8 | overview 9 | format 10 | logic_tile 11 | io_tile 12 | ram_tile 13 | ultraplus 14 | notes_osx 15 | -------------------------------------------------------------------------------- /docs/source/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx_rtd_theme 3 | sphinxcontrib-svg2pdfconverter 4 | -------------------------------------------------------------------------------- /examples/hx8kboard/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !example.v 4 | !hx8kboard.pcf 5 | !Makefile 6 | -------------------------------------------------------------------------------- /examples/hx8kboard/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = example 2 | PIN_DEF = hx8kboard.pcf 3 | DEVICE = hx8k 4 | PACKAGE = ct256 5 | 6 | all: $(PROJ).rpt $(PROJ).bin 7 | 8 | %.json: %.v 9 | yosys -p 'synth_ice40 -top top -json $@' $< 10 | 11 | %.asc: $(PIN_DEF) %.json 12 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 13 | 14 | %.bin: %.asc 15 | icepack $< $@ 16 | 17 | %.rpt: %.asc 18 | icetime -d $(DEVICE) -mtr $@ $< 19 | 20 | prog: $(PROJ).bin 21 | iceprog $< 22 | 23 | sudo-prog: $(PROJ).bin 24 | @echo 'Executing prog as root!!!' 25 | sudo iceprog $< 26 | 27 | clean: 28 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 29 | 30 | .SECONDARY: 31 | .PHONY: all prog clean 32 | -------------------------------------------------------------------------------- /examples/hx8kboard/example.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED0, 4 | output LED1, 5 | output LED2, 6 | output LED3, 7 | output LED4, 8 | output LED5, 9 | output LED6, 10 | output LED7 11 | ); 12 | 13 | localparam BITS = 8; 14 | localparam LOG2DELAY = 22; 15 | 16 | reg [BITS+LOG2DELAY-1:0] counter = 0; 17 | reg [BITS-1:0] outcnt; 18 | 19 | always @(posedge clk) begin 20 | counter <= counter + 1; 21 | outcnt <= counter >> LOG2DELAY; 22 | end 23 | 24 | assign {LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7} = outcnt ^ (outcnt >> 1); 25 | endmodule 26 | -------------------------------------------------------------------------------- /examples/hx8kboard/hx8kboard.pcf: -------------------------------------------------------------------------------- 1 | set_io LED0 B5 2 | set_io LED1 B4 3 | set_io LED2 A2 4 | set_io LED3 A1 5 | set_io LED4 C5 6 | set_io LED5 C4 7 | set_io LED6 B3 8 | set_io LED7 C3 9 | set_io clk J3 10 | -------------------------------------------------------------------------------- /examples/iceblink/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !example.v 4 | !iceblink.pcf 5 | !Makefile 6 | !README 7 | -------------------------------------------------------------------------------- /examples/iceblink/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = example 2 | PIN_DEF = iceblink.pcf 3 | DEVICE = hx1k 4 | PACKAGE = vq100 5 | 6 | all: $(PROJ).rpt $(PROJ).bin 7 | 8 | %.json: %.v 9 | yosys -p 'synth_ice40 -top top -json $@' $< 10 | 11 | %.asc: $(PIN_DEF) %.json 12 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 13 | 14 | %.bin: %.asc 15 | icepack $< $@ 16 | 17 | %.rpt: %.asc 18 | icetime -d $(DEVICE) -mtr $@ $< 19 | 20 | prog: $(PROJ).bin 21 | iCEburn.py -e -v -w $< 22 | 23 | sudo-prog: $(PROJ).bin 24 | @echo 'Executing prog as root!!!' 25 | iCEburn.py -e -v -w $< 26 | 27 | clean: 28 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 29 | 30 | .PHONY: all prog clean 31 | -------------------------------------------------------------------------------- /examples/iceblink/README: -------------------------------------------------------------------------------- 1 | Note, there are at least two similar looking versions of the iCEblink40 evaluation board: 2 | -iCEblink40-HX1K 3 | -iCEblink40-LP1K 4 | 5 | This example assumes the iCEblink40-HX1K board. 6 | The iCEblink40-LP1K is *not* compatible with this example without modification. 7 | 8 | The iCEblink40 boards have an on-board programmer with USB interface from Digilent. 9 | You need iCEburn to program the FPGA via this interface (or the original vendor 10 | tools). 11 | https://github.com/davidcarne/iceBurn 12 | -------------------------------------------------------------------------------- /examples/iceblink/example.v: -------------------------------------------------------------------------------- 1 | /* Binary counter displayed on LEDs (the 4 green ones on the right). 2 | * Changes value about once a second. 3 | */ 4 | module top ( 5 | input clk, 6 | output LED2, 7 | output LED3, 8 | output LED4, 9 | output LED5 10 | ); 11 | 12 | localparam BITS = 4; 13 | localparam LOG2DELAY = 22; 14 | 15 | reg [BITS+LOG2DELAY-1:0] counter = 0; 16 | reg [BITS-1:0] outcnt; 17 | 18 | always @(posedge clk) begin 19 | counter <= counter + 1; 20 | outcnt <= counter >> LOG2DELAY; 21 | end 22 | 23 | assign {LED2, LED3, LED4, LED5} = outcnt; 24 | endmodule 25 | -------------------------------------------------------------------------------- /examples/iceblink/iceblink.pcf: -------------------------------------------------------------------------------- 1 | set_io LED2 59 2 | set_io LED3 56 3 | set_io LED4 53 4 | set_io LED5 51 5 | set_io clk 13 6 | -------------------------------------------------------------------------------- /examples/icebreaker/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !example.v 4 | !icebreaker.pcf 5 | !Makefile 6 | !README 7 | -------------------------------------------------------------------------------- /examples/icebreaker/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = example 2 | 3 | PIN_DEF = icebreaker.pcf 4 | DEVICE = up5k 5 | PACKAGE = sg48 6 | 7 | all: $(PROJ).rpt $(PROJ).bin 8 | 9 | %.json: %.v 10 | yosys -p 'synth_ice40 -top top -json $@' $< 11 | 12 | %.asc: $(PIN_DEF) %.json 13 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 14 | 15 | %.bin: %.asc 16 | icepack $< $@ 17 | 18 | %.rpt: %.asc 19 | icetime -d $(DEVICE) -mtr $@ $< 20 | 21 | %_tb: %_tb.v %.v 22 | iverilog -o $@ $^ 23 | 24 | %_tb.vcd: %_tb 25 | vvp -N $< +vcd=$@ 26 | 27 | %_syn.v: %.json 28 | yosys -p 'read_json $^; write_verilog $@' 29 | 30 | %_syntb: %_tb.v %_syn.v 31 | iverilog -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` 32 | 33 | %_syntb.vcd: %_syntb 34 | vvp -N $< +vcd=$@ 35 | 36 | prog: $(PROJ).bin 37 | iceprog $< 38 | 39 | sudo-prog: $(PROJ).bin 40 | @echo 'Executing prog as root!!!' 41 | sudo iceprog $< 42 | 43 | clean: 44 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 45 | 46 | .SECONDARY: 47 | .PHONY: all prog clean 48 | -------------------------------------------------------------------------------- /examples/icebreaker/README: -------------------------------------------------------------------------------- 1 | Simple example for the iCEbreaker dev board: 2 | https://github.com/esden/icebreaker/ 3 | -------------------------------------------------------------------------------- /examples/icebreaker/example.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input CLK, 3 | 4 | output LED1, 5 | output LED2, 6 | output LED3, 7 | output LED4, 8 | output LED5, 9 | 10 | input BTN_N, 11 | input BTN1, 12 | input BTN2, 13 | input BTN3, 14 | 15 | output LEDR_N, 16 | output LEDG_N, 17 | 18 | output P1A1, P1A2, P1A3, P1A4, P1A7, P1A8, P1A9, P1A10, 19 | output P1B1, P1B2, P1B3, P1B4, P1B7, P1B8, P1B9, P1B10 20 | ); 21 | 22 | localparam BITS = 5; 23 | localparam LOG2DELAY = 22; 24 | 25 | reg [BITS+LOG2DELAY-1:0] counter = 0; 26 | reg [BITS-1:0] outcnt; 27 | 28 | always @(posedge CLK) begin 29 | counter <= counter + 1; 30 | outcnt <= counter >> LOG2DELAY; 31 | end 32 | 33 | assign {LED1, LED2, LED3, LED4, LED5} = outcnt ^ (outcnt >> 1); 34 | 35 | assign {LEDR_N, LEDG_N} = ~(!BTN_N + BTN1 + BTN2 + BTN3); 36 | 37 | assign {P1A1, P1A2, P1A3, P1A4, P1A7, P1A8, P1A9, P1A10, 38 | P1B1, P1B2, P1B3, P1B4, P1B7, P1B8, P1B9, P1B10} = 1 << (outcnt & 15); 39 | endmodule 40 | -------------------------------------------------------------------------------- /examples/icebreaker/icebreaker.pcf: -------------------------------------------------------------------------------- 1 | # 12 MHz clock 2 | set_io -nowarn CLK 35 3 | 4 | # RS232 5 | set_io -nowarn RX 6 6 | set_io -nowarn TX 9 7 | 8 | # LEDs and Button 9 | set_io -nowarn BTN_N 10 10 | set_io -nowarn LEDR_N 11 11 | set_io -nowarn LEDG_N 37 12 | 13 | # RGB LED Driver 14 | set_io -nowarn LED_RED_N 39 15 | set_io -nowarn LED_GRN_N 40 16 | set_io -nowarn LED_BLU_N 41 17 | 18 | # SPI Flash 19 | set_io -nowarn FLASH_SCK 15 20 | set_io -nowarn FLASH_SSB 16 21 | set_io -nowarn FLASH_IO0 14 22 | set_io -nowarn FLASH_IO1 17 23 | set_io -nowarn FLASH_IO2 12 24 | set_io -nowarn FLASH_IO3 13 25 | 26 | # PMOD 1A 27 | set_io -nowarn P1A1 4 28 | set_io -nowarn P1A2 2 29 | set_io -nowarn P1A3 47 30 | set_io -nowarn P1A4 45 31 | set_io -nowarn P1A7 3 32 | set_io -nowarn P1A8 48 33 | set_io -nowarn P1A9 46 34 | set_io -nowarn P1A10 44 35 | 36 | # PMOD 1B 37 | set_io -nowarn P1B1 43 38 | set_io -nowarn P1B2 38 39 | set_io -nowarn P1B3 34 40 | set_io -nowarn P1B4 31 41 | set_io -nowarn P1B7 42 42 | set_io -nowarn P1B8 36 43 | set_io -nowarn P1B9 32 44 | set_io -nowarn P1B10 28 45 | 46 | # PMOD 2 47 | set_io -nowarn P2_1 27 48 | set_io -nowarn P2_2 25 49 | set_io -nowarn P2_3 21 50 | set_io -nowarn P2_4 19 51 | set_io -nowarn P2_7 26 52 | set_io -nowarn P2_8 23 53 | set_io -nowarn P2_9 20 54 | set_io -nowarn P2_10 18 55 | 56 | # LEDs and Buttons (PMOD 2) 57 | set_io -nowarn LED1 27 58 | set_io -nowarn LED2 25 59 | set_io -nowarn LED3 21 60 | set_io -nowarn BTN2 19 61 | set_io -nowarn LED5 26 62 | set_io -nowarn LED4 23 63 | set_io -nowarn BTN1 20 64 | set_io -nowarn BTN3 18 65 | -------------------------------------------------------------------------------- /examples/icemulti/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !app?.v 4 | !icestick.pcf 5 | !Makefile 6 | !README 7 | -------------------------------------------------------------------------------- /examples/icemulti/Makefile: -------------------------------------------------------------------------------- 1 | all: config.bin 2 | 3 | prog: config.bin 4 | sudo iceprog config.bin 5 | 6 | sudo-prog: config.bin 7 | @echo 'Executing prog as root!!!' 8 | sudo iceprog config.bin 9 | 10 | config.bin: app0.bin app1.bin app2.bin app3.bin 11 | icemulti -v -A16 -p0 -o config.bin app0.bin app1.bin app2.bin app3.bin 12 | 13 | app%.bin: app%.v icestick.pcf 14 | yosys -p "synth_ice40 -top top -json $(basename $<).json" $< 15 | nextpnr-ice40 --hx1k --package tq144 --asc $(basename $<).asc --pcf icestick.pcf --json $(basename $<).json 16 | icetime -d hx1k -c 25 $(basename $<).asc 17 | icepack $(basename $<).asc $(basename $<).bin 18 | 19 | clean: 20 | rm -f app?.asc app?.bin app?.json config.bin 21 | 22 | .PHONY: prog sudo-prog clean 23 | -------------------------------------------------------------------------------- /examples/icemulti/README: -------------------------------------------------------------------------------- 1 | 2 | A simple example for icemulti using the iCEstick dev board. 3 | 4 | Each of the four images blinks another LED. After 7 blinks 5 | the next image is loaded automatically. 6 | 7 | -------------------------------------------------------------------------------- /examples/icemulti/app0.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, LED2, LED3, LED4, LED5 4 | ); 5 | localparam LOG2DELAY = 22; 6 | 7 | reg [LOG2DELAY-1:0] counter = 0; 8 | reg [3:0] counter2 = 0; 9 | reg state = 0; 10 | 11 | always @(posedge clk) begin 12 | counter <= counter + 1; 13 | counter2 <= counter2 + !counter; 14 | state <= state ^ !counter; 15 | end 16 | 17 | assign LED1 = state; 18 | assign LED2 = 0; 19 | assign LED3 = 0; 20 | assign LED4 = 0; 21 | assign LED5 = 1; 22 | 23 | SB_WARMBOOT WB ( 24 | .BOOT(&counter2), 25 | .S1(1'b 0), 26 | .S0(1'b 1) 27 | ); 28 | endmodule 29 | -------------------------------------------------------------------------------- /examples/icemulti/app1.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, LED2, LED3, LED4, LED5 4 | ); 5 | localparam LOG2DELAY = 22; 6 | 7 | reg [LOG2DELAY-1:0] counter = 0; 8 | reg [3:0] counter2 = 0; 9 | reg state = 0; 10 | 11 | always @(posedge clk) begin 12 | counter <= counter + 1; 13 | counter2 <= counter2 + !counter; 14 | state <= state ^ !counter; 15 | end 16 | 17 | assign LED1 = 0; 18 | assign LED2 = state; 19 | assign LED3 = 0; 20 | assign LED4 = 0; 21 | assign LED5 = 1; 22 | 23 | SB_WARMBOOT WB ( 24 | .BOOT(&counter2), 25 | .S1(1'b 1), 26 | .S0(1'b 0) 27 | ); 28 | endmodule 29 | -------------------------------------------------------------------------------- /examples/icemulti/app2.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, LED2, LED3, LED4, LED5 4 | ); 5 | localparam LOG2DELAY = 22; 6 | 7 | reg [LOG2DELAY-1:0] counter = 0; 8 | reg [3:0] counter2 = 0; 9 | reg state = 0; 10 | 11 | always @(posedge clk) begin 12 | counter <= counter + 1; 13 | counter2 <= counter2 + !counter; 14 | state <= state ^ !counter; 15 | end 16 | 17 | assign LED1 = 0; 18 | assign LED2 = 0; 19 | assign LED3 = state; 20 | assign LED4 = 0; 21 | assign LED5 = 1; 22 | 23 | SB_WARMBOOT WB ( 24 | .BOOT(&counter2), 25 | .S1(1'b 1), 26 | .S0(1'b 1) 27 | ); 28 | endmodule 29 | -------------------------------------------------------------------------------- /examples/icemulti/app3.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, LED2, LED3, LED4, LED5 4 | ); 5 | localparam LOG2DELAY = 22; 6 | 7 | reg [LOG2DELAY-1:0] counter = 0; 8 | reg [3:0] counter2 = 0; 9 | reg state = 0; 10 | 11 | always @(posedge clk) begin 12 | counter <= counter + 1; 13 | counter2 <= counter2 + !counter; 14 | state <= state ^ !counter; 15 | end 16 | 17 | assign LED1 = 0; 18 | assign LED2 = 0; 19 | assign LED3 = 0; 20 | assign LED4 = state; 21 | assign LED5 = 1; 22 | 23 | SB_WARMBOOT WB ( 24 | .BOOT(&counter2), 25 | .S1(1'b 0), 26 | .S0(1'b 0) 27 | ); 28 | endmodule 29 | -------------------------------------------------------------------------------- /examples/icemulti/icestick.pcf: -------------------------------------------------------------------------------- 1 | # full iCEstick pinout: 2 | # http://www.pighixxx.com/test/portfolio-items/icestick/ 3 | 4 | set_io --warn-no-port RX 9 5 | set_io --warn-no-port TX 8 6 | set_io LED1 99 7 | set_io LED2 98 8 | set_io LED3 97 9 | set_io LED4 96 10 | set_io LED5 95 11 | set_io clk 21 12 | -------------------------------------------------------------------------------- /examples/icestick/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !checker_tb.v 4 | !checker.v 5 | !example.v 6 | !icestick.pcf 7 | !Makefile 8 | !rs232demo_tb.v 9 | !rs232demo.v 10 | -------------------------------------------------------------------------------- /examples/icestick/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = example 2 | # PROJ = rs232demo 3 | # PROJ = checker 4 | 5 | PIN_DEF = icestick.pcf 6 | DEVICE = hx1k 7 | PACKAGE = tq144 8 | 9 | all: $(PROJ).rpt $(PROJ).bin 10 | 11 | %.json: %.v 12 | yosys -p 'synth_ice40 -top top -json $@' $< 13 | 14 | %.asc: $(PIN_DEF) %.json 15 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 16 | 17 | %.bin: %.asc 18 | icepack $< $@ 19 | 20 | %.rpt: %.asc 21 | icetime -d $(DEVICE) -mtr $@ $< 22 | 23 | %_tb: %_tb.v %.v 24 | iverilog -o $@ $^ 25 | 26 | %_tb.vcd: %_tb 27 | vvp -N $< +vcd=$@ 28 | 29 | %_syn.v: %.json 30 | yosys -p 'read_json $^; write_verilog $@' 31 | 32 | %_syntb: %_tb.v %_syn.v 33 | iverilog -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` 34 | 35 | %_syntb.vcd: %_syntb 36 | vvp -N $< +vcd=$@ 37 | 38 | sim: $(PROJ)_tb.vcd 39 | 40 | postsim: $(PROJ)_syntb.vcd 41 | 42 | prog: $(PROJ).bin 43 | iceprog $< 44 | 45 | sudo-prog: $(PROJ).bin 46 | @echo 'Executing prog as root!!!' 47 | sudo iceprog $< 48 | 49 | clean: 50 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 51 | 52 | .SECONDARY: 53 | .PHONY: all prog clean 54 | -------------------------------------------------------------------------------- /examples/icestick/checker.v: -------------------------------------------------------------------------------- 1 | // A simple circuit that can be used to detect brownouts and other hardware issues 2 | 3 | module top ( 4 | input clk, 5 | output LED1, 6 | output LED2, 7 | output LED3, 8 | output LED4, 9 | output LED5 10 | ); 11 | reg [7:0] reset_counter = 0; 12 | reg resetn = 0; 13 | 14 | always @(posedge clk) begin 15 | reset_counter <= reset_counter + 1; 16 | resetn <= resetn | &reset_counter; 17 | end 18 | 19 | reg error, rdmode, rdfin; 20 | 21 | reg [31:0] scratchpad [0:1023]; 22 | reg [31:0] xorshift32_state; 23 | reg [9:0] index; 24 | 25 | reg [31:0] next_xorshift32_state; 26 | 27 | always @* begin 28 | next_xorshift32_state = xorshift32_state ^ ( xorshift32_state << 13); 29 | next_xorshift32_state = next_xorshift32_state ^ (next_xorshift32_state >> 17); 30 | next_xorshift32_state = next_xorshift32_state ^ (next_xorshift32_state << 5); 31 | end 32 | 33 | always @(posedge clk) begin 34 | xorshift32_state <= &index ? 123456789 : next_xorshift32_state; 35 | index <= index + 1; 36 | 37 | if (!resetn) begin 38 | xorshift32_state <= 123456789; 39 | index <= 0; 40 | error <= 0; 41 | rdmode <= 0; 42 | rdfin <= 0; 43 | end else 44 | if (!rdmode) begin 45 | scratchpad[index] <= xorshift32_state; 46 | rdmode <= &index; 47 | end else begin 48 | if (scratchpad[index] != xorshift32_state) error <= 1; 49 | rdfin <= rdfin || &index; 50 | end 51 | end 52 | 53 | wire ok = resetn && rdfin && !error; 54 | assign LED1 = 0, LED2 = error, LED3 = 0, LED4 = error, LED5 = ok; 55 | endmodule 56 | -------------------------------------------------------------------------------- /examples/icestick/checker_tb.v: -------------------------------------------------------------------------------- 1 | module testbench; 2 | reg clk; 3 | always #5 clk = (clk === 1'b0); 4 | 5 | wire ok; 6 | 7 | top uut ( 8 | .clk(clk), 9 | .LED5(ok) 10 | ); 11 | 12 | reg [4095:0] vcdfile; 13 | 14 | initial begin 15 | if ($value$plusargs("vcd=%s", vcdfile)) begin 16 | $dumpfile(vcdfile); 17 | $dumpvars(0, testbench); 18 | end 19 | end 20 | 21 | initial begin 22 | @(posedge ok); 23 | @(negedge ok); 24 | $display("ERROR: detected falling edge on OK pin!"); 25 | $stop; 26 | end 27 | 28 | initial begin 29 | repeat (3000) @(posedge clk); 30 | 31 | if (!ok) begin 32 | $display("ERROR: OK pin not asserted after 3000 cycles!"); 33 | $stop; 34 | end 35 | 36 | repeat (10000) @(posedge clk); 37 | $display("SUCCESS: OK pin still asserted after 10000 cycles."); 38 | $finish; 39 | end 40 | endmodule 41 | -------------------------------------------------------------------------------- /examples/icestick/example.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, 4 | output LED2, 5 | output LED3, 6 | output LED4, 7 | output LED5 8 | ); 9 | 10 | localparam BITS = 5; 11 | localparam LOG2DELAY = 22; 12 | 13 | reg [BITS+LOG2DELAY-1:0] counter = 0; 14 | reg [BITS-1:0] outcnt; 15 | 16 | always @(posedge clk) begin 17 | counter <= counter + 1; 18 | outcnt <= counter >> LOG2DELAY; 19 | end 20 | 21 | assign {LED1, LED2, LED3, LED4, LED5} = outcnt ^ (outcnt >> 1); 22 | endmodule 23 | -------------------------------------------------------------------------------- /examples/icestick/icestick.pcf: -------------------------------------------------------------------------------- 1 | # full iCEstick pinout: 2 | # http://www.pighixxx.com/test/portfolio-items/icestick/ 3 | 4 | set_io --warn-no-port RX 9 5 | set_io --warn-no-port TX 8 6 | set_io LED1 99 7 | set_io LED2 98 8 | set_io LED3 97 9 | set_io LED4 96 10 | set_io LED5 95 11 | set_io clk 21 12 | -------------------------------------------------------------------------------- /examples/icestick/rs232demo_tb.v: -------------------------------------------------------------------------------- 1 | module testbench; 2 | localparam integer PERIOD = 12000000 / 9600; 3 | 4 | // reg clk = 0; 5 | // initial #10 forever #5 clk = ~clk; 6 | 7 | reg clk; 8 | always #5 clk = (clk === 1'b0); 9 | 10 | reg RX = 1; 11 | wire TX; 12 | wire LED1; 13 | wire LED2; 14 | wire LED3; 15 | wire LED4; 16 | wire LED5; 17 | 18 | top uut ( 19 | .clk (clk ), 20 | .RX (RX ), 21 | .TX (TX ), 22 | .LED1(LED1), 23 | .LED2(LED2), 24 | .LED3(LED3), 25 | .LED4(LED4), 26 | .LED5(LED5) 27 | ); 28 | 29 | task send_byte; 30 | input [7:0] c; 31 | integer i; 32 | begin 33 | RX <= 0; 34 | repeat (PERIOD) @(posedge clk); 35 | 36 | for (i = 0; i < 8; i = i+1) begin 37 | RX <= c[i]; 38 | repeat (PERIOD) @(posedge clk); 39 | end 40 | 41 | RX <= 1; 42 | repeat (PERIOD) @(posedge clk); 43 | end 44 | endtask 45 | 46 | reg [4095:0] vcdfile; 47 | 48 | initial begin 49 | if ($value$plusargs("vcd=%s", vcdfile)) begin 50 | $dumpfile(vcdfile); 51 | $dumpvars(0, testbench); 52 | end 53 | 54 | repeat (10 * PERIOD) @(posedge clk); 55 | 56 | // turn all LEDs off 57 | send_byte("1"); 58 | send_byte("3"); 59 | send_byte("5"); 60 | 61 | // turn all LEDs on 62 | send_byte("1"); 63 | send_byte("2"); 64 | send_byte("3"); 65 | send_byte("4"); 66 | send_byte("5"); 67 | 68 | // turn all LEDs off 69 | send_byte("1"); 70 | send_byte("2"); 71 | send_byte("3"); 72 | send_byte("4"); 73 | send_byte("5"); 74 | 75 | repeat (10 * PERIOD) @(posedge clk); 76 | 77 | $finish; 78 | end 79 | endmodule 80 | -------------------------------------------------------------------------------- /examples/icezum/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !example.v 4 | !icezum.pcf 5 | !Makefile 6 | -------------------------------------------------------------------------------- /examples/icezum/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = example 2 | PIN_DEF = icezum.pcf 3 | DEVICE = hx1k 4 | PACKAGE = tq144 5 | 6 | all: $(PROJ).rpt $(PROJ).bin 7 | 8 | %.json: %.v 9 | yosys -p 'synth_ice40 -top top -json $@' $< 10 | 11 | %.asc: $(PIN_DEF) %.json 12 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 13 | 14 | %.bin: %.asc 15 | icepack $< $@ 16 | 17 | %.rpt: %.asc 18 | icetime -d $(DEVICE) -mtr $@ $< 19 | 20 | prog: $(PROJ).bin 21 | iceprog $< 22 | 23 | sudo-prog: $(PROJ).bin 24 | @echo 'Executing prog as root!!!' 25 | sudo iceprog $< 26 | 27 | clean: 28 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 29 | 30 | .SECONDARY: 31 | .PHONY: all prog clean 32 | -------------------------------------------------------------------------------- /examples/icezum/example.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED0, 4 | output LED1, 5 | output LED2, 6 | output LED3, 7 | output LED4, 8 | output LED5, 9 | output LED6, 10 | output LED7 11 | ); 12 | 13 | localparam BITS = 3; 14 | localparam LOG2DELAY = 20; 15 | 16 | reg [BITS+LOG2DELAY-1:0] counter = 0; 17 | reg [BITS-1:0] outcnt; 18 | 19 | always @(posedge clk) begin 20 | counter <= counter + 1; 21 | outcnt <= counter >> LOG2DELAY; 22 | end 23 | 24 | assign {LED7, LED6, LED5, LED4, LED3, LED2, LED1, LED0} = 1 << outcnt; 25 | endmodule 26 | -------------------------------------------------------------------------------- /examples/icezum/icezum.pcf: -------------------------------------------------------------------------------- 1 | set_io LED0 95 2 | set_io LED1 96 3 | set_io LED2 97 4 | set_io LED3 98 5 | set_io LED4 99 6 | set_io LED5 101 7 | set_io LED6 102 8 | set_io LED7 104 9 | set_io clk 21 10 | -------------------------------------------------------------------------------- /examples/up5k_rgb/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !Makefile* 4 | !README 5 | !rgb*.pcf 6 | !rgb.v 7 | -------------------------------------------------------------------------------- /examples/up5k_rgb/Makefile: -------------------------------------------------------------------------------- 1 | PROJ = rgb 2 | PIN_DEF = rgb.pcf 3 | DEVICE = up5k 4 | PACKAGE = sg48 5 | 6 | ICEPACK = icepack 7 | ICETIME = icetime 8 | ICEPROG = iceprog 9 | 10 | all: $(PROJ).bin 11 | 12 | %.json: %.v 13 | yosys -p 'synth_ice40 -top top -json $@' $< 14 | 15 | %.asc: $(PIN_DEF) %.json 16 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 17 | 18 | %.bin: %.asc 19 | $(ICEPACK) $< $@ 20 | 21 | %.rpt: %.asc 22 | $(ICETIME) -d $(DEVICE) -mtr $@ $< 23 | 24 | prog: $(PROJ).bin 25 | $(ICEPROG) -S $< 26 | 27 | sudo-prog: $(PROJ).bin 28 | @echo 'Executing prog as root!!!' 29 | sudo $(ICEPROG) -S $< 30 | 31 | clean: 32 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 33 | 34 | .SECONDARY: 35 | .PHONY: all prog clean 36 | -------------------------------------------------------------------------------- /examples/up5k_rgb/Makefile.uwg30: -------------------------------------------------------------------------------- 1 | PROJ = rgb 2 | PIN_DEF = rgb_uwg30.pcf 3 | DEVICE = up5k 4 | PACKAGE = uwg30 5 | 6 | 7 | ICEPACK = icepack 8 | ICETIME = icetime 9 | ICEPROG = iceprog 10 | 11 | all: $(PROJ).bin 12 | 13 | %.blif: %.v 14 | yosys -p 'synth_ice40 -top top -json $@' $< 15 | 16 | %.asc: $(PIN_DEF) %.json 17 | nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --asc $@ --pcf $< --json $*.json 18 | 19 | %.bin: %.asc 20 | $(ICEPACK) $< $@ 21 | 22 | %.rpt: %.asc 23 | $(ICETIME) -d $(DEVICE) -mtr $@ $< 24 | 25 | prog: $(PROJ).bin 26 | $(ICEPROG) -S $< 27 | 28 | sudo-prog: $(PROJ).bin 29 | @echo 'Executing prog as root!!!' 30 | sudo $(ICEPROG) -S $< 31 | 32 | clean: 33 | rm -f $(PROJ).json $(PROJ).asc $(PROJ).rpt $(PROJ).bin 34 | 35 | .SECONDARY: 36 | .PHONY: all prog clean 37 | -------------------------------------------------------------------------------- /examples/up5k_rgb/README: -------------------------------------------------------------------------------- 1 | Simple RGB LED demo for UP5K boards, such as the Lattice "iCE40 UltraPlus Breakout Board" and 2 | the Lattice "iCE40 UltraPlus Mobile Development Platform". 3 | -------------------------------------------------------------------------------- /examples/up5k_rgb/rgb.pcf: -------------------------------------------------------------------------------- 1 | set_frequency clk 32 2 | set_io RGB0 39 3 | set_io RGB1 40 4 | set_io RGB2 41 5 | -------------------------------------------------------------------------------- /examples/up5k_rgb/rgb.v: -------------------------------------------------------------------------------- 1 | module top( 2 | output RGB0, RGB1, RGB2 3 | ); 4 | 5 | wire clk; 6 | 7 | SB_HFOSC inthosc ( 8 | .CLKHFPU(1'b1), 9 | .CLKHFEN(1'b1), 10 | .CLKHF(clk) 11 | ); 12 | 13 | localparam counter_width = 32; 14 | 15 | reg [counter_width-1:0] ctr; 16 | 17 | always@(posedge clk) 18 | begin 19 | ctr <= ctr + 1; 20 | end 21 | 22 | localparam pwm_width = 12; 23 | 24 | localparam pwm_max = (2**pwm_width) - 1; 25 | localparam pwm_max_div4 = (2**(pwm_width-2)) - 1; 26 | 27 | 28 | wire [1:0] phase = ctr[counter_width - 1 : counter_width - 2]; 29 | wire [pwm_width-1:0] fade = ctr[counter_width - 3 : counter_width - (2 + pwm_width)]; 30 | wire [pwm_width-1:0] fade_div4 = ctr[counter_width - 3 : counter_width - (pwm_width)]; 31 | 32 | wire [pwm_width-1:0] r_val, g_val, b_val; 33 | 34 | // Fade R->G->B->W-> 35 | assign r_val = (phase == 0) ? pwm_max_div4 + (3 * fade_div4) : 36 | (phase == 1) ? pwm_max - fade : 37 | (phase == 3) ? fade_div4 : 38 | 0; 39 | 40 | assign g_val = (phase == 0) ? pwm_max_div4 - fade_div4: 41 | (phase == 1) ? fade : 42 | (phase == 2) ? pwm_max - fade : 43 | (phase == 3) ? fade_div4 : 44 | 0; 45 | 46 | assign b_val = (phase == 0) ? pwm_max_div4 - fade_div4: 47 | (phase == 2) ? fade : 48 | (phase == 3) ? pwm_max - (3 * fade_div4) : 49 | 0; 50 | 51 | reg [pwm_width-1:0] pwm_ctr; 52 | 53 | reg pwm_r, pwm_g, pwm_b; 54 | 55 | always@(posedge clk) 56 | begin 57 | pwm_ctr <= pwm_ctr + 1; 58 | pwm_r <= (pwm_ctr < r_val) ? 1'b1 : 1'b0; 59 | pwm_g <= (pwm_ctr < g_val) ? 1'b1 : 1'b0; 60 | pwm_b <= (pwm_ctr < b_val) ? 1'b1 : 1'b0; 61 | end 62 | 63 | SB_RGBA_DRV RGBA_DRIVER ( 64 | .CURREN(1'b1), 65 | .RGBLEDEN(1'b1), 66 | .RGB0PWM(pwm_g), 67 | .RGB1PWM(pwm_b), 68 | .RGB2PWM(pwm_r), 69 | .RGB0(RGB0), 70 | .RGB1(RGB1), 71 | .RGB2(RGB2) 72 | ); 73 | 74 | 75 | defparam RGBA_DRIVER.CURRENT_MODE = "0b1"; 76 | defparam RGBA_DRIVER.RGB0_CURRENT = "0b000111"; 77 | defparam RGBA_DRIVER.RGB1_CURRENT = "0b000111"; 78 | defparam RGBA_DRIVER.RGB2_CURRENT = "0b000111"; 79 | 80 | 81 | endmodule 82 | -------------------------------------------------------------------------------- /examples/up5k_rgb/rgb_uwg30.pcf: -------------------------------------------------------------------------------- 1 | set_io RGB0 A5 2 | set_io RGB1 B5 3 | set_io RGB2 C5 4 | -------------------------------------------------------------------------------- /icebox/.gitignore: -------------------------------------------------------------------------------- 1 | chipdb-1k.txt 2 | chipdb-5k.txt 3 | chipdb-lm4k.txt 4 | chipdb-8k.txt 5 | chipdb-384.txt 6 | chipdb-u4k.txt 7 | __pycache__ 8 | -------------------------------------------------------------------------------- /icebox/icebox_hlcsort.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | top_levels = [] 5 | f = open(sys.argv[1]) 6 | 7 | current_block_stack = [top_levels] 8 | while len(current_block_stack) > 0: 9 | line = f.readline() 10 | if not line: 11 | break 12 | 13 | if '#' in line: 14 | continue 15 | 16 | if '{' in line: 17 | new_block = [] 18 | current_block_stack[-1].append(new_block) 19 | current_block_stack.append(new_block) 20 | 21 | if line.strip(): 22 | current_block_stack[-1].append(line) 23 | 24 | if '}' in line or not line: 25 | assert len(current_block_stack) > 1 or not line, current_block_stack 26 | old_block = current_block_stack.pop(-1) 27 | sorted_block = [old_block[0],] + sorted(old_block[1:-1], key=lambda x: repr(x)) + [old_block[-1],] 28 | old_block.clear() 29 | old_block.extend(sorted_block) 30 | 31 | top_levels = list(sorted(top_levels, key=lambda x: repr(x))) 32 | 33 | output_stack = [top_levels] 34 | while len(output_stack) > 0: 35 | if len(output_stack[0]) == 0: 36 | output_stack.pop(0) 37 | continue 38 | if type(output_stack[0][0]) == list: 39 | output_stack.insert(0, output_stack[0].pop(0)) 40 | continue 41 | print(output_stack[0].pop(0), end='') 42 | -------------------------------------------------------------------------------- /icebox/tc_logic_xpr.py: -------------------------------------------------------------------------------- 1 | # Test case for `icebox_asc2hlc' and `icebox_hlc2asc': Does conversion 2 | # from LUT strings to logic expressions and back work correctly? 3 | # Copyright (C) 2017 Roland Lutz 4 | # 5 | # Permission to use, copy, modify, and/or distribute this software for any 6 | # purpose with or without fee is hereby granted, provided that the above 7 | # copyright notice and this permission notice appear in all copies. 8 | # 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | import sys 18 | import icebox 19 | from icebox_asc2hlc import lut_to_logic_expression 20 | from icebox_hlc2asc import logic_expression_to_lut 21 | 22 | def main(): 23 | sys.stderr.write("testing conversion from LUT strings " 24 | "to logic expressions and back") 25 | 26 | for i in range(65536): 27 | if i % 4096 == 0: 28 | sys.stderr.write(".") 29 | sys.stderr.flush() 30 | 31 | lut = bin(i)[2:].zfill(16) 32 | s = lut_to_logic_expression(lut, ('a', 'b', 'c', 'd')) 33 | l = logic_expression_to_lut(s, ('a', 'b', 'c', 'd')) 34 | 35 | if l != lut: 36 | sys.stderr.write("\nERROR at LUT = %s\n" % lut) 37 | sys.stderr.write("stringified = %s\n" % s) 38 | sys.stderr.write("resulting LUT = %s\n" % l) 39 | sys.exit(1) 40 | 41 | sys.stderr.write("\n") 42 | 43 | if __name__ == '__main__': 44 | main() 45 | -------------------------------------------------------------------------------- /icebram/.gitignore: -------------------------------------------------------------------------------- 1 | demo.asc 2 | demo.blif 3 | demo.json 4 | demo.pcf 5 | demo.v 6 | demo.vvp 7 | demo_dat0.hex 8 | demo_dat1.hex 9 | demo_new.asc 10 | demo_new.v 11 | demo_tb.v 12 | icebram 13 | icebram.d 14 | icebram.o 15 | icebram.exe 16 | icebram.wasm 17 | -------------------------------------------------------------------------------- /icebram/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | ifeq ($(STATIC),1) 4 | LDFLAGS += -static 5 | endif 6 | 7 | all: $(PROGRAM_PREFIX)icebram$(EXE) 8 | 9 | $(PROGRAM_PREFIX)icebram$(EXE): icebram.o 10 | $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) 11 | 12 | test: $(PROGRAM_PREFIX)icebram 13 | bash rundemo.sh 14 | 15 | install: all 16 | mkdir -p $(DESTDIR)$(PREFIX)/bin 17 | cp $(PROGRAM_PREFIX)icebram$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebram$(EXE) 18 | 19 | uninstall: 20 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebram$(EXE) 21 | 22 | clean: 23 | rm -f $(PROGRAM_PREFIX)icebram$(EXE) 24 | rm -f $(PROGRAM_PREFIX)icebram.exe 25 | rm -f demo.* demo_*.* 26 | rm -f *.o *.d 27 | 28 | -include *.d 29 | 30 | .PHONY: all test install uninstall clean 31 | 32 | -------------------------------------------------------------------------------- /icebram/rundemo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | python3 makedemo.py 5 | yosys -p 'synth_ice40 -json demo.json' demo.v 6 | nextpnr-ice40 --hx8k --package bg121 --pcf-allow-unconstrained --asc demo.asc --json demo.json 7 | 8 | ./icebram -v demo_dat0.hex demo_dat1.hex < demo.asc > demo_new.asc 9 | 10 | icebox_vlog -n demo -p demo.pcf -c demo_new.asc > demo_new.v 11 | iverilog -o demo.vvp demo_tb.v demo_new.v $( yosys-config --datdir/ice40/cells_sim.v ) 12 | vvp -N demo.vvp 13 | -------------------------------------------------------------------------------- /icecompr/.gitignore: -------------------------------------------------------------------------------- 1 | icecompr 2 | iceuncompr 3 | icecompr.d 4 | icecompr.o 5 | iceuncompr.o 6 | example_?k.compr 7 | example_?k.compr_py 8 | example_?k.ok 9 | example_?k.uncompr 10 | -------------------------------------------------------------------------------- /icecompr/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | all: icecompr iceuncompr 4 | 5 | test: example_1k.ok example_8k.ok 6 | 7 | icecompr: icecompr.o 8 | $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) 9 | 10 | iceuncompr: iceuncompr.o 11 | $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) 12 | 13 | %.compr: %.bin icecompr 14 | ./icecompr -v $< $@ 15 | 16 | %.compr_py: %.bin icecompr.py 17 | ./icecompr.py < $< > $@ 18 | 19 | %.uncompr: %.compr iceuncompr 20 | ./iceuncompr $< $@ 21 | 22 | %.ok: %.compr %.compr_py %.uncompr %.bin 23 | cmp $(basename $@).compr $(basename $@).compr_py 24 | cmp $(basename $@).uncompr $(basename $@).bin 25 | touch $@ 26 | 27 | clean: 28 | rm -f icecompr iceuncompr *.d 29 | rm -f example_1k.compr example_8k.compr 30 | rm -f example_1k.compr_py example_8k.compr_py 31 | rm -f example_1k.uncompr example_8k.uncompr 32 | rm -f example_1k.ok example_8k.ok 33 | 34 | .SECONDARY: 35 | .PHONY: all test clean 36 | 37 | -------------------------------------------------------------------------------- /icecompr/README: -------------------------------------------------------------------------------- 1 | 2 | A simple compression algorithm for iCE40 bit-streams 3 | ==================================================== 4 | 5 | This directory contains tools for compressing and uncompressing 6 | iCE40 bit-streams. The motivation is to reduce the bandwidth 7 | requirements for bit-stream upload. 8 | 9 | Note that iCE40 FPGAs can not uncompress this compressed bit-streams! 10 | Uncompression must be performed by e.g. a uC on the FPGA board. 11 | 12 | This compression algorithm uses the fact that most bits in an iCE40 13 | bit-stream are cleared. 14 | 15 | The bit-stream is encoded as the distances between set bits (i.e. 16 | the length of runs of ZERO bits between two ONE bits). This sequence 17 | of integers is stored using a simple prefix code to spend fewer bits 18 | on smaller (more frequent) numbers. 19 | 20 | The algorithm includes an escape-mechanism to mix uncompressed binary 21 | data with compressed bit-streams. This is useful when the bit-stream 22 | contains sections that do not compress well with this algorithm, for 23 | example in BRAM initialization data. 24 | 25 | The compressed bitstream starts with the ASCII string "ICECOMPR", i.e. 26 | the hex values 0x49434543 and 0x4f4d5052 (stored as big-endian numbers). 27 | 28 | After the 8 bytes magic the compressed bitstream is a stream of the 29 | following opcodes that must be interpreted by the decompressor. The 30 | notation ZERO and ONE is used for zero and one bits. The notation foo[N] 31 | is used for an N bit value "foo", transmitted MSB first. 32 | 33 | ONE count[2] 34 | ZERO ONE count[5] 35 | ZERO ZERO ONE count[8] 36 | ZERO ZERO ZERO ZERO ONE count[23] 37 | output count ZERO bits followed by a single ONE bit 38 | 39 | ZERO ZERO ZERO ONE count[6] data[count] 40 | output the count data bits followed by a single ONE bit 41 | 42 | ZERO ZERO ZERO ZERO ZERO count[23] 43 | output count ZERO bits and stop decompressing. (end of file) 44 | 45 | The program "icecompr" (C++11, ISC license) contains an implementation of a 46 | compressor and a decompressor. The decompressor in this program however is 47 | only used for integrity checking the compressed bit-stream. 48 | 49 | The program "iceuncompr" (plain C, public domain) contains an implementation 50 | of a stand-alone decompressor. Simply copy&paste this implementation into 51 | your uC firmware. 52 | 53 | -------------------------------------------------------------------------------- /icecompr/example_1k.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/icecompr/example_1k.bin -------------------------------------------------------------------------------- /icecompr/example_8k.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/icecompr/example_8k.bin -------------------------------------------------------------------------------- /icefuzz/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.glb 3 | *.psb 4 | *.tmp/ 5 | *.asc 6 | *.vsb 7 | *.sdf 8 | /work_*/ 9 | __pycache__ 10 | bitdata_*.txt 11 | data_*.txt 12 | database_*.txt 13 | timings_*.html 14 | tmedges_unrenamed.tmp 15 | -------------------------------------------------------------------------------- /icefuzz/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | for id; do 6 | id=${id%.bin} 7 | icebox_vlog_opts="-Sa" 8 | if test -f $id.pcf; then icebox_vlog_opts="$icebox_vlog_opts -p $id.pcf"; fi 9 | if test -f $id.psb; then icebox_vlog_opts="$icebox_vlog_opts -P $id.psb"; fi 10 | 11 | ../icepack/iceunpack $id.bin $id.asc 12 | ../icebox/icebox_vlog.py $icebox_vlog_opts $id.asc > $id.ve 13 | 14 | yosys -p " 15 | read_verilog $id.v 16 | read_verilog $id.ve 17 | read_verilog -lib +/ice40/cells_sim.v 18 | rename top gold 19 | rename chip gate 20 | 21 | proc 22 | splitnets -ports 23 | clean -purge 24 | 25 | ## Variant 1 ## 26 | 27 | # miter -equiv -flatten gold gate equiv 28 | # tee -q synth -top equiv 29 | # sat -verify -prove trigger 0 -show-ports equiv 30 | 31 | ## Variant 2 ## 32 | 33 | # miter -equiv -flatten -ignore_gold_x -make_outcmp -make_outputs gold gate equiv 34 | # hierarchy -top equiv 35 | # sat -max_undef -prove trigger 0 -show-ports equiv 36 | 37 | ## Variant 3 ## 38 | 39 | equiv_make gold gate equiv 40 | hierarchy -top equiv 41 | opt -share_all 42 | 43 | equiv_simple 44 | equiv_induct 45 | equiv_status -assert 46 | " 47 | 48 | touch $id.ok 49 | done 50 | 51 | -------------------------------------------------------------------------------- /icefuzz/export.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os 3 | 4 | device_class = os.getenv("ICEDEVICE") 5 | 6 | with open("../icebox/iceboxdb.py", "w") as f: 7 | files = [ "database_io", "database_logic", "database_ramb", "database_ramt", "database_ipcon_5k"] 8 | for device_class in ["8k"]: 9 | files.append("database_ramb_" + device_class) 10 | files.append("database_ramt_" + device_class) 11 | for i in range(4): 12 | files.append("database_dsp%d_5k" % i) 13 | for i in files: 14 | print('%s_txt = """' % i, file=f) 15 | with open("%s.txt" % i, "r") as fi: 16 | for line in fi: 17 | print(line, end="", file=f) 18 | print('"""', file=f) 19 | -------------------------------------------------------------------------------- /icefuzz/glbmapbits.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import re 4 | import fileinput 5 | 6 | tiletype = "" 7 | x, y = 0, 0 8 | 9 | for line in fileinput.input(): 10 | if line.startswith("LogicTile"): 11 | fields = line.split("_") 12 | tiletype = "Logic" 13 | x, y = int(fields[1]), int(fields[2]) 14 | continue 15 | 16 | if line.startswith("RAM_Tile") or line.startswith("IO_Tile"): 17 | fields = line.split("_") 18 | tiletype = fields[0] 19 | x, y = int(fields[2]), int(fields[3]) 20 | continue 21 | 22 | if line.startswith("GlobalNetwork"): 23 | tiletype = "" 24 | continue 25 | 26 | if tiletype != "": 27 | fields = re.split('[ ()]*', line.strip()) 28 | if len(fields) <= 1: continue 29 | fields = [int(fields[i+1]) for i in range(4)] 30 | print("%-5s %2d %2d %2d %2d %3d %3d" % (tiletype, x, y, fields[0], fields[1], fields[2], fields[3])) 31 | 32 | -------------------------------------------------------------------------------- /icefuzz/make_aig.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_aig" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | w = len(pins) // 2 15 | 16 | for idx in range(num): 17 | with open(working_dir + "/aig_%02d.v" % idx, "w") as f: 18 | print("module top(input [%d:0] a, output [%d:0] y);" % (w-1, w-1), file=f) 19 | 20 | sigs = ["a[%d]" % i for i in range(w)] 21 | netidx = 0 22 | 23 | for i in range(100 if num_ramb40 < 20 else 1000): 24 | netidx += 1 25 | newnet = "n_%d" % netidx 26 | 27 | print(" wire %s = %s%s && %s%s;" % (newnet, 28 | np.random.choice(["", "!"]), np.random.choice(sigs), 29 | np.random.choice(["", "!"]), np.random.choice(sigs)), file=f) 30 | 31 | sigs.append(newnet) 32 | 33 | while len(sigs) > w: 34 | netidx += 1 35 | newnet = "n_%d" % netidx 36 | 37 | a = np.random.choice(sigs) 38 | sigs.remove(a) 39 | 40 | b = np.random.choice(sigs) 41 | sigs.remove(b) 42 | 43 | print(" wire %s = %s%s && %s%s;" % (newnet, 44 | np.random.choice(["", "!"]), a, 45 | np.random.choice(["", "!"]), b), file=f) 46 | 47 | sigs.append(newnet) 48 | 49 | for i in range(w): 50 | print(" assign y[%d] = %s;" % (i, sigs[i]), file=f) 51 | 52 | print("endmodule", file=f) 53 | 54 | with open(working_dir + "/aig_%02d.pcf" % idx, "w") as f: 55 | p = np.random.permutation(pins) 56 | for i in range(w): 57 | print("set_io a[%d] %s" % (i, p[i]), file=f) 58 | print("set_io y[%d] %s" % (i, p[i+w]), file=f) 59 | 60 | 61 | output_makefile(working_dir, "aig") 62 | -------------------------------------------------------------------------------- /icefuzz/make_binop.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_binop" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | for idx in range(num): 15 | with open(working_dir + "/binop_%02d.v" % idx, "w") as f: 16 | print("module top(input a, b, output y);", file=f) 17 | print(" assign y = a%sb;" % np.random.choice([" ^ ", " ^ ~", " & ", " & ~", " | ", " | ~"]), file=f) 18 | print("endmodule", file=f) 19 | with open(working_dir + "/binop_%02d.pcf" % idx, "w") as f: 20 | p = np.random.permutation(pins) 21 | print("set_io a %s" % p[0], file=f) 22 | print("set_io b %s" % p[1], file=f) 23 | print("set_io y %s" % p[2], file=f) 24 | 25 | 26 | output_makefile(working_dir, "binop") 27 | 28 | -------------------------------------------------------------------------------- /icefuzz/make_cluster.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_cluster" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | for idx in range(num): 15 | with open(working_dir + "/cluster_%02d.v" % idx, "w") as f: 16 | print("module top(input [3:0] a, output [3:0] y);", file=f) 17 | print(" assign y = {|a, &a, ^a, a[3:2] == a[1:0]};", file=f) 18 | print("endmodule", file=f) 19 | with open(working_dir + "/cluster_%02d.pcf" % idx, "w") as f: 20 | i = np.random.randint(len(pins)) 21 | netnames = np.random.permutation(["a[%d]" % i for i in range(4)] + ["y[%d]" % i for i in range(4)]) 22 | for net in netnames: 23 | print("set_io %s %s" % (net, pins[i]), file=f) 24 | i = (i + 1) % len(pins) 25 | 26 | output_makefile(working_dir, "cluster") 27 | -------------------------------------------------------------------------------- /icefuzz/make_fanout.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_fanout" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | 15 | for idx in range(num): 16 | output_count = len(pins) - 2 17 | with open(working_dir + "/fanout_%02d.v" % idx, "w") as f: 18 | print("module top(input [1:0] a, output [%d:0] y);" % (output_count,), file=f) 19 | print(" assign y = {%d{a}};" % (output_count,), file=f) 20 | print("endmodule", file=f) 21 | with open(working_dir + "/fanout_%02d.pcf" % idx, "w") as f: 22 | p = np.random.permutation(pins) 23 | for i in range(output_count): 24 | print("set_io y[%d] %s" % (i, p[i]), file=f) 25 | print("set_io a[0] %s" % p[output_count], file=f) 26 | print("set_io a[1] %s" % p[output_count+1], file=f) 27 | 28 | 29 | output_makefile(working_dir, "fanout") 30 | -------------------------------------------------------------------------------- /icefuzz/make_fflogic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_fflogic" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | w = (len(pins) - 4) // 5 15 | 16 | def random_op(): 17 | return np.random.choice(["+", "-", "*", "^", "&", "|"]) 18 | 19 | def print_seq_op(dst, src1, src2, op, f): 20 | mode = np.random.choice(list("abc")) 21 | negreset = np.random.choice(["!", ""]) 22 | enable = np.random.choice(["if (en) ", ""]) 23 | if mode == "a": 24 | print(" always @(%sedge clk) begin" % np.random.choice(["pos", "neg"]), file=f) 25 | print(" %s%s <= %s %s %s;" % (enable, dst, src1, op, src2), file=f) 26 | print(" end", file=f) 27 | elif mode == "b": 28 | print(" always @(%sedge clk) begin" % np.random.choice(["pos", "neg"]), file=f) 29 | print(" if (%srst)" % negreset, file=f) 30 | print(" %s <= %d;" % (dst, np.random.randint(2**16)), file=f) 31 | print(" else", file=f) 32 | print(" %s%s <= %s %s %s;" % (enable, dst, src1, op, src2), file=f) 33 | print(" end", file=f) 34 | elif mode == "c": 35 | print(" always @(%sedge clk, %sedge rst) begin" % (np.random.choice(["pos", "neg"]), "neg" if negreset == "!" else "pos"), file=f) 36 | print(" if (%srst)" % negreset, file=f) 37 | print(" %s <= %d;" % (dst, np.random.randint(2**16)), file=f) 38 | print(" else", file=f) 39 | print(" %s%s <= %s %s %s;" % (enable, dst, src1, op, src2), file=f) 40 | print(" end", file=f) 41 | else: 42 | assert False 43 | 44 | for idx in range(num): 45 | with open(working_dir + "/fflogic_%02d.v" % idx, "w") as f: 46 | print("module top(input clk, rst, en, input [%d:0] a, b, c, d, output [%d:0] y, output z);" % (w-1, w-1), file=f) 47 | print(" reg [%d:0] p, q;" % (w-1,), file=f) 48 | 49 | print_seq_op("p", "a", "b", random_op(), f) 50 | print_seq_op("q", "c", "d", random_op(), f) 51 | print(" assign y = p %s q, z = clk ^ rst ^ en;" % random_op(), file=f) 52 | print("endmodule", file=f) 53 | 54 | 55 | output_makefile(working_dir, "fflogic") 56 | -------------------------------------------------------------------------------- /icefuzz/make_io.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_io" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | w = num_iobanks 15 | 16 | for idx in range(num): 17 | with open(working_dir + "/io_%02d.v" % idx, "w") as f: 18 | glbs = np.random.permutation(list(range(8))) 19 | print(""" 20 | module top ( 21 | inout [%s:0] pin, 22 | input [%s:0] latch_in, 23 | input [%s:0] clk_en, 24 | input [%s:0] clk_in, 25 | input [%s:0] clk_out, 26 | input [%s:0] oen, 27 | input [%s:0] dout_0, 28 | input [%s:0] dout_1, 29 | output [%s:0] din_0, 30 | output [%s:0] din_1 31 | ); 32 | SB_IO #( 33 | .PIN_TYPE(6'b %s_%s), 34 | .PULLUP(1'b %s), 35 | .NEG_TRIGGER(1'b %s), 36 | .IO_STANDARD("SB_LVCMOS") 37 | ) PINS [%s:0] ( 38 | .PACKAGE_PIN(pin), 39 | .LATCH_INPUT_VALUE(latch_in), 40 | .CLOCK_ENABLE(clk_en), 41 | .INPUT_CLK(clk_in), 42 | .OUTPUT_CLK(clk_out), 43 | .OUTPUT_ENABLE(oen), 44 | .D_OUT_0(dout_0), 45 | .D_OUT_1(dout_1), 46 | .D_IN_0(din_0), 47 | .D_IN_1(din_1) 48 | ); 49 | endmodule 50 | """ % ( 51 | w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1, 52 | np.random.choice(["0000", "0110", "1010", "1110", "0101", "1001", "1101", "0100", "1000", "1100", "0111", "1111"]), 53 | np.random.choice(["00", "01", "10", "11"]), np.random.choice(["0", "1"]), np.random.choice(["0", "1"]), w-1 54 | ), file=f) 55 | with open(working_dir + "/io_%02d.pcf" % idx, "w") as f: 56 | p = list(np.random.permutation(pins)) 57 | for k in ["pin", "latch_in", "clk_en", "clk_in", "clk_out", "oen", "dout_0", "dout_1", "din_0", "din_1"]: 58 | for i in range(w): 59 | print("set_io %s[%d] %s" % (k, i, p.pop()), file=f) 60 | 61 | 62 | output_makefile(working_dir, "io") 63 | -------------------------------------------------------------------------------- /icefuzz/make_iopack.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | from numpy.random import randint, choice, permutation 8 | 9 | num_xor = 8 10 | num_luts = 8 11 | num_outputs_range = (5, 20) 12 | 13 | device_class = os.getenv("ICEDEVICE") 14 | 15 | working_dir = "work_%s_iopack" % (device_class, ) 16 | 17 | os.system("rm -rf " + working_dir) 18 | os.mkdir(working_dir) 19 | 20 | def get_pin_directions(): 21 | pindirs = ["i" for i in range(len(pins))] 22 | for i in range(randint(num_outputs_range[0], num_outputs_range[1])): 23 | pindirs[randint(len(pins))] = "o" 24 | return pindirs 25 | 26 | def get_nearby_inputs(p, n, r): 27 | while True: 28 | ipins = list() 29 | for i in range(-r, +r): 30 | ip = (p + i + len(pins)) % len(pins) 31 | if pindirs[ip] == "i": 32 | ipins.append(ip) 33 | if len(ipins) >= n: 34 | break 35 | r += 4 36 | return [choice(ipins) for i in range(n)] 37 | 38 | for idx in range(num): 39 | with open(working_dir + "/iopack_%02d.v" % idx, "w") as f: 40 | pindirs = get_pin_directions() 41 | print("module top(%s);" % ", ".join(["%sput p%d" % ("in" if pindirs[i] == "i" else "out", i) for i in range(len(pins))]), file=f) 42 | for outp in range(len(pins)): 43 | if pindirs[outp] == "o": 44 | xor_nets = set(["%sp%d" % (choice(["~", ""]), p) for p in get_nearby_inputs(outp, num_xor, 2 + randint(10))]) 45 | for i in range(num_luts): 46 | print(" localparam [15:0] p%d_lut%d = 16'd %d;" % (outp, i, randint(2**16)), file=f) 47 | print(" wire p%d_in%d = p%d_lut%d >> {%s};" % (outp, i, outp, i, 48 | ", ".join(["p%d" % p for p in get_nearby_inputs(outp + randint(-10, +11), 4, 4)])), file=f) 49 | xor_nets.add("%sp%d_in%d" % (choice(["~", ""]), outp, i)) 50 | print(" assign p%d = ^{%s};" % (outp, ", ".join(sorted(xor_nets))), file=f) 51 | print("endmodule", file=f) 52 | with open(working_dir + "/iopack_%02d.pcf" % idx, "w") as f: 53 | for i in range(len(pins)): 54 | print("set_io p%d %s" % (i, pins[i]), file=f) 55 | 56 | output_makefile(working_dir, "iopack") 57 | 58 | -------------------------------------------------------------------------------- /icefuzz/make_logic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_logic" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | def random_op(): 15 | return np.random.choice(["+", "-", "^", "&", "|", "&~", "|~"]) 16 | 17 | for idx in range(num): 18 | bus_width = len(pins) // 5 19 | with open(working_dir + "/logic_%02d.v" % idx, "w") as f: 20 | print("module top(input [%d:0] a, b, c, d, output [%d:0] y);" % (bus_width, bus_width), file=f) 21 | print(" assign y = (a %s b) %s (c %s d);" % (random_op(), random_op(), random_op()), file=f) 22 | print("endmodule", file=f) 23 | with open(working_dir + "/logic_%02d.pcf" % idx, "w") as f: 24 | p = np.random.permutation(pins) 25 | for i in range(bus_width): 26 | print("set_io a[%d] %s" % (i, p[i]), file=f) 27 | print("set_io b[%d] %s" % (i, p[i+bus_width]), file=f) 28 | print("set_io c[%d] %s" % (i, p[i+bus_width*2]), file=f) 29 | print("set_io d[%d] %s" % (i, p[i+bus_width*3]), file=f) 30 | print("set_io y[%d] %s" % (i, p[i+bus_width*4]), file=f) 31 | 32 | output_makefile(working_dir, "logic") 33 | -------------------------------------------------------------------------------- /icefuzz/make_mem.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_mem" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | for idx in range(num): 15 | with open(working_dir + "/mem_%02d.v" % idx, "w") as f: 16 | print(""" 17 | module top(input clk, i0, i1, i2, i3, output reg o0, o1, o2, o3, o4); 18 | reg [9:0] raddr, waddr, rdata, wdata; 19 | reg [9:0] memory [0:1023]; 20 | always @(posedge clk) begin 21 | case ({i0, i1, i2}) 22 | 0: raddr <= {raddr, i3}; 23 | 1: waddr <= {waddr, i3}; 24 | 2: wdata <= {wdata, i3}; 25 | 3: rdata <= memory[raddr]; 26 | 4: memory[waddr] <= wdata; 27 | 5: rdata <= memory[waddr]; 28 | 6: {o0, o1, o2, o3, o4} <= rdata[4:0]; 29 | 7: {o0, o1, o2, o3, o4} <= rdata[9:5]; 30 | endcase 31 | end 32 | endmodule 33 | """, file=f) 34 | with open(working_dir + "/mem_%02d.pcf" % idx, "w") as f: 35 | p = list(np.random.permutation(pins)) 36 | for port in [ "clk", "i0", "i1", "i2", "i3", "o0", "o1", "o2", "o3", "o4" ]: 37 | print("set_io %s %s" % (port, p.pop()), file=f) 38 | 39 | 40 | output_makefile(working_dir, "mem") 41 | 42 | -------------------------------------------------------------------------------- /icefuzz/make_mesh.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | 8 | device_class = os.getenv("ICEDEVICE") 9 | 10 | working_dir = "work_%s_mesh" % (device_class, ) 11 | 12 | os.system("rm -rf " + working_dir) 13 | os.mkdir(working_dir) 14 | 15 | # This test maps a random set of pins to another random set of outputs. 16 | 17 | device_class = os.getenv("ICEDEVICE") 18 | 19 | for idx in range(num): 20 | io_count = len(pins) // 2 21 | with open(working_dir + "/mesh_%02d.v" % idx, "w") as f: 22 | print("module top(input [%d:0] a, output [%d:0] y);" % (io_count, io_count), file=f) 23 | print(" assign y = a;", file=f) 24 | print("endmodule", file=f) 25 | with open(working_dir + "/mesh_%02d.pcf" % idx, "w") as f: 26 | p = np.random.permutation(pins) 27 | for i in range(io_count): 28 | print("set_io a[%d] %s" % (i, p[i]), file=f) 29 | for i in range(io_count): 30 | print("set_io y[%d] %s" % (i, p[io_count+i]), file=f) 31 | 32 | 33 | output_makefile(working_dir, "mesh") 34 | -------------------------------------------------------------------------------- /icefuzz/make_pin2pin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from fuzzconfig import * 4 | import numpy as np 5 | import os 6 | 7 | device_class = os.getenv("ICEDEVICE") 8 | 9 | working_dir = "work_%s_pin2pin" % (device_class, ) 10 | 11 | os.system("rm -rf " + working_dir) 12 | os.mkdir(working_dir) 13 | 14 | for idx in range(num): 15 | with open(working_dir + "/pin2pin_%02d.v" % idx, "w") as f: 16 | print("module top(input a, output y);", file=f) 17 | print(" assign y = a;", file=f) 18 | print("endmodule", file=f) 19 | with open(working_dir + "/pin2pin_%02d.pcf" % idx, "w") as f: 20 | p = np.random.permutation(pins) 21 | print("set_io a %s" % p[0], file=f) 22 | print("set_io y %s" % p[1], file=f) 23 | 24 | 25 | output_makefile(working_dir, "pin2pin") 26 | 27 | -------------------------------------------------------------------------------- /icefuzz/pinloc/.gitignore: -------------------------------------------------------------------------------- 1 | pinloc-*.mk 2 | pinloc-*.exp 3 | pinloc-*.exp.new 4 | pinloc-*.log 5 | pinloc-*.pcf 6 | pinloc-*.rpt 7 | pinloc-*.txt 8 | pinloc-*.v 9 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cb121.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cb121 4 | cd pinloc-1k-cb121 5 | 6 | pins=" 7 | A2 A3 A4 A5 A6 A8 A10 A11 8 | B1 B3 B4 B5 B8 B9 B11 9 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C11 10 | D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 11 | E2 E3 E4 E5 E6 E7 E8 E9 E11 12 | F2 F3 F4 F7 F8 F9 F10 13 | G1 G3 G4 G7 G8 G9 G10 14 | H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 15 | J1 J2 J3 J4 J5 J6 J8 J9 J11 16 | K3 K4 K8 K9 K11 17 | L2 L3 L4 L5 L8 L9 L10 L11 18 | " 19 | 20 | if [ $(echo $pins | wc -w) -ne 92 ]; then 21 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 22 | exit 1 23 | fi 24 | 25 | { 26 | echo -n "all:" 27 | for pin in $pins; do 28 | id="pinloc-1k-cb121_${pin}" 29 | echo -n " ${id}.exp" 30 | done 31 | echo 32 | 33 | for pin in $pins; do 34 | id="pinloc-1k-cb121_${pin}" 35 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 36 | echo "set_io y ${pin}" >> ${id}.pcf 37 | echo; echo "${id}.exp:" 38 | echo " ICEDEV=lp1k-cb121 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 39 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 40 | echo " ! grep '^Warning: pin' ${id}.log" 41 | echo " rm -rf ${id}.tmp" 42 | echo " mv ${id}.exp.new ${id}.exp" 43 | done 44 | } > pinloc-1k-cb121.mk 45 | 46 | set -ex 47 | make -f pinloc-1k-cb121.mk -j4 48 | python3 ../pinlocdb.py pinloc-1k-cb121_*.exp > ../pinloc-1k-cb121.txt 49 | 50 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cb132.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cb132 4 | cd pinloc-1k-cb132 5 | 6 | pins=" 7 | A1 A2 A4 A5 A6 A7 A10 A12 B1 B14 8 | C1 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C14 9 | D1 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D14 10 | E1 E4 E11 E12 E14 F3 F4 F11 F12 F14 11 | G1 G3 G4 G11 G12 G14 H1 H3 H4 H11 H12 12 | J1 J3 J11 J12 K3 K4 K11 K12 K14 13 | L1 L4 L5 L6 L7 L8 L9 L12 L14 14 | M1 M3 M4 M6 M7 M8 M9 M11 M12 N14 15 | P2 P3 P4 P5 P7 P8 P9 P10 P11 P12 P13 P14 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 95 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-1k-cb132_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-1k-cb132_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=hx1k-cb132 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-1k-cb132.mk 43 | 44 | set -ex 45 | make -f pinloc-1k-cb132.mk -j4 46 | python3 ../pinlocdb.py pinloc-1k-cb132_*.exp > ../pinloc-1k-cb132.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cb81.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cb81 4 | cd pinloc-1k-cb81 5 | 6 | pins=" 7 | A2 A3 A4 A7 A8 8 | B1 B2 B3 B4 B5 B6 B7 B8 9 | C1 C2 C3 C4 C5 C6 C7 C8 C9 10 | D1 D2 D3 D4 D5 D6 D7 D8 11 | E1 E2 E3 E6 E7 E8 E9 12 | F2 F3 F6 F7 F8 F9 13 | G1 G2 G3 G4 G5 G6 G7 G8 G9 14 | H2 H3 H4 H5 H7 H8 15 | J2 J3 J7 J8 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 62 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-1k-cb81_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-1k-cb81_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=lp1k-cb81 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-1k-cb81.mk 43 | 44 | set -ex 45 | make -f pinloc-1k-cb81.mk -j4 46 | python3 ../pinlocdb.py pinloc-1k-cb81_*.exp > ../pinloc-1k-cb81.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cm121.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cm121 4 | cd pinloc-1k-cm121 5 | 6 | pins=" 7 | A1 A2 A3 A5 A7 A8 A9 A10 A11 8 | B1 B2 B3 B4 B5 B7 B8 B9 B10 B11 9 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 10 | D1 D2 D3 D4 D5 D6 D10 D11 11 | E2 E3 E4 E6 E7 E8 E9 E10 12 | F2 F3 F4 F5 F6 F8 F9 F11 13 | G2 G4 G8 G9 G11 14 | H1 H2 H4 H5 H6 H7 H8 H9 H10 H11 15 | J1 J2 J5 J6 J8 J10 J11 16 | K1 K2 K3 K4 K5 K7 K8 K9 K10 K11 17 | L1 L2 L3 L4 L5 L7 L9 L10 L11 18 | " 19 | 20 | if [ $(echo $pins | wc -w) -ne 95 ]; then 21 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 22 | exit 1 23 | fi 24 | 25 | { 26 | echo -n "all:" 27 | for pin in $pins; do 28 | id="pinloc-1k-cm121_${pin}" 29 | echo -n " ${id}.exp" 30 | done 31 | echo 32 | 33 | for pin in $pins; do 34 | id="pinloc-1k-cm121_${pin}" 35 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 36 | echo "set_io y ${pin}" >> ${id}.pcf 37 | echo; echo "${id}.exp:" 38 | echo " ICEDEV=lp1k-cm121 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 39 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 40 | echo " ! grep '^Warning: pin' ${id}.log" 41 | echo " rm -rf ${id}.tmp" 42 | echo " mv ${id}.exp.new ${id}.exp" 43 | done 44 | } > pinloc-1k-cm121.mk 45 | 46 | set -ex 47 | make -f pinloc-1k-cm121.mk -j4 48 | python3 ../pinlocdb.py pinloc-1k-cm121_*.exp > ../pinloc-1k-cm121.txt 49 | 50 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cm36.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cm36 4 | cd pinloc-1k-cm36 5 | 6 | pins=" 7 | A1 A2 A3 8 | B1 B3 B4 B5 B6 9 | C1 C2 C3 C5 C6 10 | D1 D5 D6 11 | E1 E2 E3 E4 E5 E6 12 | F2 F3 F5 13 | " 14 | 15 | if [ $(echo $pins | wc -w) -ne 25 ]; then 16 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 17 | exit 1 18 | fi 19 | 20 | { 21 | echo -n "all:" 22 | for pin in $pins; do 23 | id="pinloc-1k-cm36_${pin}" 24 | echo -n " ${id}.exp" 25 | done 26 | echo 27 | 28 | for pin in $pins; do 29 | id="pinloc-1k-cm36_${pin}" 30 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 31 | echo "set_io y ${pin}" >> ${id}.pcf 32 | echo; echo "${id}.exp:" 33 | echo " ICEDEV=lp1k-cm36 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 34 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 35 | echo " ! grep '^Warning: pin' ${id}.log" 36 | echo " rm -rf ${id}.tmp" 37 | echo " mv ${id}.exp.new ${id}.exp" 38 | done 39 | } > pinloc-1k-cm36.mk 40 | 41 | set -ex 42 | make -f pinloc-1k-cm36.mk -j4 43 | python3 ../pinlocdb.py pinloc-1k-cm36_*.exp > ../pinloc-1k-cm36.txt 44 | 45 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cm49.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cm49 4 | cd pinloc-1k-cm49 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 8 | B1 B2 B3 B4 9 | C1 C2 C4 C5 C6 C7 10 | D1 D2 D3 D4 D6 D7 11 | E2 E6 E7 12 | F2 F3 F4 F5 F6 F7 13 | G3 G4 G6 14 | " 15 | 16 | if [ $(echo $pins | wc -w) -ne 35 ]; then 17 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 18 | exit 1 19 | fi 20 | 21 | { 22 | echo -n "all:" 23 | for pin in $pins; do 24 | id="pinloc-1k-cm49_${pin}" 25 | echo -n " ${id}.exp" 26 | done 27 | echo 28 | 29 | for pin in $pins; do 30 | id="pinloc-1k-cm49_${pin}" 31 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 32 | echo "set_io y ${pin}" >> ${id}.pcf 33 | echo; echo "${id}.exp:" 34 | echo " ICEDEV=lp1k-cm49 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 35 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 36 | echo " ! grep '^Warning: pin' ${id}.log" 37 | echo " rm -rf ${id}.tmp" 38 | echo " mv ${id}.exp.new ${id}.exp" 39 | done 40 | } > pinloc-1k-cm49.mk 41 | 42 | set -ex 43 | make -f pinloc-1k-cm49.mk -j4 44 | python3 ../pinlocdb.py pinloc-1k-cm49_*.exp > ../pinloc-1k-cm49.txt 45 | 46 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-cm81.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-cm81 4 | cd pinloc-1k-cm81 5 | 6 | pins=" 7 | A1 A2 A3 A4 A6 A7 A8 A9 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 9 | C1 C2 C3 C4 C5 C9 10 | D1 D2 D3 D5 D6 D7 D8 D9 11 | E1 E2 E3 E4 E5 E7 E8 12 | F1 F3 F7 F8 13 | G1 G3 G4 G5 G6 G7 G8 G9 14 | H1 H4 H5 H7 H9 15 | J1 J2 J3 J4 J6 J7 J8 J9 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 63 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-1k-cm81_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-1k-cm81_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=lp1k-cm81 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-1k-cm81.mk 43 | 44 | set -ex 45 | make -f pinloc-1k-cm81.mk -j4 46 | python3 ../pinlocdb.py pinloc-1k-cm81_*.exp > ../pinloc-1k-cm81.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-qn84.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-qn84 4 | cd pinloc-1k-qn84 5 | 6 | pins=" 7 | A1 B1 A2 B2 A3 B3 A4 B4 A5 B5 A8 A9 B7 A10 B8 A11 B9 A12 8 | A13 B10 B11 A14 B12 A16 B13 B14 A19 B15 A20 B17 A22 A23 B18 B19 A25 A26 9 | B20 B21 A27 A29 B22 B23 A31 B24 A32 A33 A34 B26 A35 B27 A38 B29 A39 B30 10 | A40 B31 A41 A43 B32 A44 A45 B34 A46 B35 A47 B36 A48 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 67 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-1k-qn84_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-1k-qn84_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=lp1k-qn84 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-1k-qn84.mk 38 | 39 | set -ex 40 | make -f pinloc-1k-qn84.mk -j4 41 | python3 ../pinlocdb.py pinloc-1k-qn84_*.exp > ../pinloc-1k-qn84.txt 42 | 43 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-swg16tr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-swg16tr 4 | cd pinloc-1k-swg16tr 5 | 6 | pins=" 7 | A2 A4 B1 B2 B3 C1 C2 C3 D1 D3 8 | " 9 | 10 | if [ $(echo $pins | wc -w) -ne 10 ]; then 11 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 12 | exit 1 13 | fi 14 | 15 | { 16 | echo -n "all:" 17 | for pin in $pins; do 18 | id="pinloc-1k-swg16tr_${pin}" 19 | echo -n " ${id}.exp" 20 | done 21 | echo 22 | 23 | for pin in $pins; do 24 | id="pinloc-1k-swg16tr_${pin}" 25 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 26 | echo "set_io y ${pin}" >> ${id}.pcf 27 | echo; echo "${id}.exp:" 28 | echo " ICEDEV=lp1k-swg16tr bash ../../icecube.sh ${id} > ${id}.log 2>&1" 29 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 30 | echo " ! grep '^Warning: pin' ${id}.log" 31 | echo " rm -rf ${id}.tmp" 32 | echo " mv ${id}.exp.new ${id}.exp" 33 | done 34 | } > pinloc-1k-swg16tr.mk 35 | 36 | set -ex 37 | make -f pinloc-1k-swg16tr.mk -j4 38 | python3 ../pinlocdb.py pinloc-1k-swg16tr_*.exp > ../pinloc-1k-swg16tr.txt 39 | 40 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-tq144.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-tq144 4 | cd pinloc-1k-tq144 5 | 6 | pins=" 7 | 1 2 3 4 7 8 9 10 11 12 19 20 21 22 23 24 25 26 28 29 31 32 33 34 8 | 37 38 39 41 42 43 44 45 47 48 49 50 52 56 58 60 61 62 63 64 67 68 70 71 9 | 73 74 75 76 78 79 80 81 87 88 90 91 93 94 95 96 97 98 99 101 102 104 105 106 107 10 | 112 113 114 115 116 117 118 119 120 121 122 128 129 134 135 136 137 138 139 141 142 143 144 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 96 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-1k-tq144_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-1k-tq144_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=hx1k-tq144 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-1k-tq144.mk 38 | 39 | set -ex 40 | make -f pinloc-1k-tq144.mk -j4 41 | python3 ../pinlocdb.py pinloc-1k-tq144_*.exp > ../pinloc-1k-tq144.txt 42 | 43 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-1k-vq100.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-1k-vq100 4 | cd pinloc-1k-vq100 5 | 6 | pins=" 7 | 1 2 3 4 7 8 9 10 12 13 15 16 18 19 20 21 24 25 8 | 26 27 28 29 30 33 34 36 37 40 41 42 45 46 48 49 9 | 51 52 53 54 56 57 59 60 62 63 64 65 66 68 69 71 72 73 74 10 | 78 79 80 81 82 83 85 86 87 89 90 91 93 94 95 96 97 99 100 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 72 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-1k-vq100_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-1k-vq100_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=hx1k-vq100 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-1k-vq100.mk 38 | 39 | set -ex 40 | make -f pinloc-1k-vq100.mk -j4 41 | python3 ../pinlocdb.py pinloc-1k-vq100_*.exp > ../pinloc-1k-vq100.txt 42 | 43 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-384-cm36.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-384-cm36 4 | cd pinloc-384-cm36 5 | 6 | pins=" 7 | A1 A2 A3 8 | B1 B3 B4 B5 B6 9 | C1 C2 C3 C5 C6 10 | D1 D5 D6 11 | E1 E2 E3 E4 E5 E6 12 | F2 F3 F5 13 | " 14 | 15 | if [ $(echo $pins | wc -w) -ne 25 ]; then 16 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 17 | exit 1 18 | fi 19 | 20 | { 21 | echo -n "all:" 22 | for pin in $pins; do 23 | id="pinloc-384-cm36_${pin}" 24 | echo -n " ${id}.exp" 25 | done 26 | echo 27 | 28 | for pin in $pins; do 29 | id="pinloc-384-cm36_${pin}" 30 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 31 | echo "set_io y ${pin}" >> ${id}.pcf 32 | echo; echo "${id}.exp:" 33 | echo " ICEDEV=lp384-cm36 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 34 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 35 | echo " ! grep '^Warning: pin' ${id}.log" 36 | echo " rm -rf ${id}.tmp" 37 | echo " mv ${id}.exp.new ${id}.exp" 38 | done 39 | } > pinloc-384-cm36.mk 40 | 41 | set -ex 42 | make -f pinloc-384-cm36.mk -j4 43 | python3 ../pinlocdb.py pinloc-384-cm36_*.exp > ../pinloc-384-cm36.txt 44 | 45 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-384-cm49.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-384-cm49 4 | cd pinloc-384-cm49 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 8 | B1 B2 B3 B4 9 | C1 C2 C4 C5 C6 C7 10 | D1 D2 D3 D4 D6 D7 11 | E2 E6 E7 12 | F1 F2 F3 F4 F5 F6 F7 13 | G1 G3 G4 G6 14 | " 15 | 16 | 17 | if [ $(echo $pins | wc -w) -ne 37 ]; then 18 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 19 | exit 1 20 | fi 21 | 22 | { 23 | echo -n "all:" 24 | for pin in $pins; do 25 | id="pinloc-384-cm49_${pin}" 26 | echo -n " ${id}.exp" 27 | done 28 | echo 29 | 30 | for pin in $pins; do 31 | id="pinloc-384-cm49_${pin}" 32 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 33 | echo "set_io y ${pin}" >> ${id}.pcf 34 | echo; echo "${id}.exp:" 35 | echo " ICEDEV=lp384-cm49 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 36 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 37 | echo " ! grep '^Warning: pin' ${id}.log" 38 | echo " rm -rf ${id}.tmp" 39 | echo " mv ${id}.exp.new ${id}.exp" 40 | done 41 | } > pinloc-384-cm49.mk 42 | 43 | set -ex 44 | make -f pinloc-384-cm49.mk -j4 45 | python3 ../pinlocdb.py pinloc-384-cm49_*.exp > ../pinloc-384-cm49.txt 46 | 47 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-384-qn32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-384-qn32 4 | cd pinloc-384-qn32 5 | 6 | pins=" 7 | 1 2 5 6 7 8 8 | 12 13 14 15 9 | 18 19 20 22 23 10 | 26 27 29 30 31 32 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 21 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-384-qn32_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-384-qn32_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=lp384-qn32 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-384-qn32.mk 38 | 39 | set -ex 40 | make -f pinloc-384-qn32.mk -j4 41 | python3 ../pinlocdb.py pinloc-384-qn32_*.exp > ../pinloc-384-qn32.txt 42 | 43 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-4k-cb132.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-4k-cb132 4 | cd pinloc-4k-cb132 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 A10 A11 A12 B1 B14 8 | C1 C3 C4 C5 C6 C7 C9 C10 C11 C12 C14 9 | D1 D3 D4 D5 D6 D7 D9 D10 D11 D12 D14 10 | E1 E4 E11 E12 E14 F3 F4 F11 F12 F14 11 | G1 G3 G4 G11 G12 G14 H1 H3 H4 H11 H12 12 | J1 J3 J11 J12 K3 K4 K11 K12 K14 13 | L1 L4 L5 L6 L8 L9 L12 L14 14 | M1 M3 M4 M6 M7 M9 M11 M12 N1 N14 15 | P1 P2 P3 P4 P5 P7 P8 P9 P10 P11 P12 P13 P14 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 95 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-4k-cb132_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-4k-cb132_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=hx4k-cb132 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-4k-cb132.mk 43 | 44 | set -ex 45 | make -f pinloc-4k-cb132.mk -j4 46 | python3 ../pinlocdb.py pinloc-4k-cb132_*.exp > ../pinloc-4k-cb132.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-4k-cm121.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-4k-cm121 4 | cd pinloc-4k-cm121 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 B11 9 | C1 C2 C3 C4 C7 C8 C9 C11 10 | D1 D2 D3 D5 D7 D9 D10 D11 11 | E1 E2 E3 E8 E9 E10 E11 12 | F1 F2 F3 F4 F9 F10 F11 13 | G1 G2 G3 G8 G9 G10 G11 14 | H1 H2 H3 H7 H9 H10 H11 15 | J1 J2 J3 J4 J5 J7 J8 J9 J10 J11 16 | K1 K2 K3 K4 K5 K6 K7 K9 K10 K11 17 | L1 L2 L3 L4 L5 L7 L8 L10 18 | " 19 | 20 | if [ $(echo $pins | wc -w) -ne 93 ]; then 21 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 22 | exit 1 23 | fi 24 | 25 | { 26 | echo -n "all:" 27 | for pin in $pins; do 28 | id="pinloc-4k-cm121_${pin}" 29 | echo -n " ${id}.exp" 30 | done 31 | echo 32 | 33 | for pin in $pins; do 34 | id="pinloc-4k-cm121_${pin}" 35 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 36 | echo "set_io y ${pin}" >> ${id}.pcf 37 | echo; echo "${id}.exp:" 38 | echo " ICEDEV=lp4k-cm121 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 39 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 40 | echo " ! grep '^Warning: pin' ${id}.log" 41 | echo " rm -rf ${id}.tmp" 42 | echo " mv ${id}.exp.new ${id}.exp" 43 | done 44 | } > pinloc-4k-cm121.mk 45 | 46 | set -ex 47 | make -f pinloc-4k-cm121.mk -j4 48 | python3 ../pinlocdb.py pinloc-4k-cm121_*.exp > ../pinloc-4k-cm121.txt 49 | 50 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-4k-cm225.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-4k-cm225 4 | cd pinloc-4k-cm225 5 | 6 | pins=" 7 | A1 A2 A5 A6 A7 A8 A9 A11 A15 8 | B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 9 | C1 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 10 | D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D13 D14 D15 11 | E2 E3 E4 E5 E6 E9 E10 E11 E13 E14 12 | F1 F2 F3 F4 F5 F7 F9 F11 F12 F13 F14 F15 13 | G2 G4 G5 G10 G11 G12 G13 G14 G15 14 | H1 H2 H3 H4 H5 H6 H11 H12 H13 H14 15 | J1 J2 J3 J4 J5 J10 J11 J12 J14 J15 16 | K1 K4 K5 K9 K11 K12 K13 K15 17 | L3 L4 L5 L6 L7 L9 L10 L11 L12 L13 18 | M1 M2 M3 M4 M5 M6 M7 M8 M9 M11 M12 M13 M15 19 | N2 N3 N4 N5 N6 N7 N9 N10 N12 20 | P1 P2 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 21 | R1 R2 R3 R4 R5 R6 R9 R10 R11 R12 R14 R15 22 | " 23 | 24 | if [ $(echo $pins | wc -w) -ne 167 ]; then 25 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 26 | exit 1 27 | fi 28 | 29 | { 30 | echo -n "all:" 31 | for pin in $pins; do 32 | id="pinloc-4k-cm225_${pin}" 33 | echo -n " ${id}.exp" 34 | done 35 | echo 36 | 37 | for pin in $pins; do 38 | id="pinloc-4k-cm225_${pin}" 39 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 40 | echo "set_io y ${pin}" >> ${id}.pcf 41 | echo; echo "${id}.exp:" 42 | echo " ICEDEV=lp4k-cm225 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 43 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 44 | echo " ! grep '^Warning: pin' ${id}.log" 45 | echo " rm -rf ${id}.tmp" 46 | echo " mv ${id}.exp.new ${id}.exp" 47 | done 48 | } > pinloc-4k-cm225.mk 49 | 50 | set -ex 51 | make -f pinloc-4k-cm225.mk -j4 52 | python3 ../pinlocdb.py pinloc-4k-cm225_*.exp > ../pinloc-4k-cm225.txt 53 | 54 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-4k-cm81.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-4k-cm81 4 | cd pinloc-4k-cm81 5 | 6 | pins=" 7 | A1 A2 A3 A4 A6 A7 A8 A9 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 9 | C1 C2 C3 C4 C5 C9 10 | D1 D2 D3 D5 D6 D7 D8 D9 11 | E1 E2 E3 E4 E5 E7 E8 12 | F1 F3 F7 F8 13 | G1 G2 G3 G4 G5 G6 G7 G8 G9 14 | H1 H2 H4 H5 H7 H9 15 | J1 J2 J3 J4 J8 J9 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 63 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-4k-cm81_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-4k-cm81_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=lp4k-cm81 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-4k-cm81.mk 43 | 44 | set -ex 45 | make -f pinloc-4k-cm81.mk -j4 46 | python3 ../pinlocdb.py pinloc-4k-cm81_*.exp > ../pinloc-4k-cm81.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-4k-tq144.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-4k-tq144 4 | cd pinloc-4k-tq144 5 | 6 | pins=" 7 | 1 2 3 4 7 8 9 10 11 12 15 16 17 18 19 20 21 22 23 24 25 26 28 29 31 32 33 34 8 | 37 38 39 41 42 43 44 45 47 48 49 52 55 56 60 61 62 63 64 67 68 70 71 9 | 73 74 75 76 78 79 80 81 82 83 84 85 87 88 90 91 93 94 95 96 97 98 99 101 102 104 105 106 107 10 | 110 112 113 114 115 116 117 118 119 120 121 122 124 125 128 129 130 134 135 136 137 138 139 141 142 143 144 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 107 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-4k-tq144_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-4k-tq144_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=hx4k-tq144 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-4k-tq144.mk 38 | 39 | set -ex 40 | make -f pinloc-4k-tq144.mk -j4 41 | python3 ../pinlocdb.py pinloc-4k-tq144_*.exp > ../pinloc-4k-tq144.txt 42 | 43 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-8k-cb132.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-8k-cb132 4 | cd pinloc-8k-cb132 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 A10 A11 A12 B1 B14 8 | C1 C3 C4 C5 C6 C7 C9 C10 C11 C12 C14 9 | D1 D3 D4 D5 D6 D7 D9 D10 D11 D12 D14 10 | E1 E4 E11 E12 E14 F3 F4 F11 F12 F14 11 | G1 G3 G4 G11 G12 G14 H1 H3 H4 H11 H12 12 | J1 J3 J11 J12 K3 K4 K11 K12 K14 13 | L1 L4 L5 L6 L8 L9 L12 L14 14 | M1 M3 M4 M6 M7 M9 M11 M12 N1 N14 15 | P1 P2 P3 P4 P5 P7 P8 P9 P10 P11 P12 P13 P14 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 95 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-8k-cb132_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-8k-cb132_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=hx8k-cb132 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-8k-cb132.mk 43 | 44 | set -ex 45 | make -f pinloc-8k-cb132.mk -j4 46 | python3 ../pinlocdb.py pinloc-8k-cb132_*.exp > ../pinloc-8k-cb132.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-8k-cm121.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-8k-cm121 4 | cd pinloc-8k-cm121 5 | 6 | pins=" 7 | A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 B11 9 | C1 C2 C3 C4 C7 C8 C9 C11 10 | D1 D2 D3 D5 D7 D9 D10 D11 11 | E1 E2 E3 E8 E9 E10 E11 12 | F1 F2 F3 F4 F9 F10 F11 13 | G1 G2 G3 G8 G9 G10 G11 14 | H1 H2 H3 H7 H9 H10 H11 15 | J1 J2 J3 J4 J5 J7 J8 J9 J10 J11 16 | K1 K2 K3 K4 K5 K6 K7 K9 K10 K11 17 | L1 L2 L3 L4 L5 L7 L8 L10 18 | " 19 | 20 | if [ $(echo $pins | wc -w) -ne 93 ]; then 21 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 22 | exit 1 23 | fi 24 | 25 | { 26 | echo -n "all:" 27 | for pin in $pins; do 28 | id="pinloc-8k-cm121_${pin}" 29 | echo -n " ${id}.exp" 30 | done 31 | echo 32 | 33 | for pin in $pins; do 34 | id="pinloc-8k-cm121_${pin}" 35 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 36 | echo "set_io y ${pin}" >> ${id}.pcf 37 | echo; echo "${id}.exp:" 38 | echo " ICEDEV=lp8k-cm121 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 39 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 40 | echo " ! grep '^Warning: pin' ${id}.log" 41 | echo " rm -rf ${id}.tmp" 42 | echo " mv ${id}.exp.new ${id}.exp" 43 | done 44 | } > pinloc-8k-cm121.mk 45 | 46 | set -ex 47 | make -f pinloc-8k-cm121.mk -j4 48 | python3 ../pinlocdb.py pinloc-8k-cm121_*.exp > ../pinloc-8k-cm121.txt 49 | 50 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-8k-cm225.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-8k-cm225 4 | cd pinloc-8k-cm225 5 | 6 | # Note: pin locations for hx8k-cm225 and lp8k-cm225 are identical 7 | 8 | pins=" 9 | A1 A2 A5 A6 A7 A8 A9 A10 A11 A15 10 | B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 11 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 12 | D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D13 D14 D15 13 | E2 E3 E4 E5 E6 E9 E10 E11 E13 E14 14 | F1 F2 F3 F4 F5 F7 F9 F11 F12 F13 F14 F15 15 | G1 G2 G3 G4 G5 G10 G11 G12 G13 G14 G15 16 | H1 H2 H3 H4 H5 H6 H11 H12 H13 H14 17 | J1 J2 J3 J4 J5 J10 J11 J12 J13 J14 J15 18 | K1 K3 K4 K5 K9 K11 K12 K13 K14 K15 19 | L1 L3 L4 L5 L6 L7 L9 L10 L11 L12 L13 L14 20 | M1 M2 M3 M4 M5 M6 M7 M8 M9 M11 M12 M13 M14 M15 21 | N2 N3 N4 N5 N6 N7 N9 N10 N12 22 | P1 P2 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 23 | R1 R2 R3 R4 R5 R6 R9 R10 R11 R12 R14 R15 24 | " 25 | 26 | if [ $(echo $pins | wc -w) -ne 178 ]; then 27 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 28 | exit 1 29 | fi 30 | 31 | { 32 | echo -n "all:" 33 | for pin in $pins; do 34 | id="pinloc-8k-cm225_${pin}" 35 | echo -n " ${id}.exp" 36 | done 37 | echo 38 | 39 | for pin in $pins; do 40 | id="pinloc-8k-cm225_${pin}" 41 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 42 | echo "set_io y ${pin}" >> ${id}.pcf 43 | echo; echo "${id}.exp:" 44 | echo " ICEDEV=hx8k-cm225 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 45 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 46 | echo " ! grep '^Warning: pin' ${id}.log" 47 | echo " rm -rf ${id}.tmp" 48 | echo " mv ${id}.exp.new ${id}.exp" 49 | done 50 | } > pinloc-8k-cm225.mk 51 | 52 | set -ex 53 | make -f pinloc-8k-cm225.mk -j4 54 | python3 ../pinlocdb.py pinloc-8k-cm225_*.exp > ../pinloc-8k-cm225.txt 55 | 56 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-8k-cm81.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-8k-cm81 4 | cd pinloc-8k-cm81 5 | 6 | pins=" 7 | A1 A2 A3 A4 A6 A7 A8 A9 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 9 | C1 C2 C3 C4 C5 C9 10 | D1 D2 D3 D5 D6 D7 D8 D9 11 | E1 E2 E3 E4 E5 E7 E8 12 | F1 F3 F7 F8 13 | G1 G2 G3 G4 G5 G6 G7 G8 G9 14 | H1 H2 H4 H5 H7 H9 15 | J1 J2 J3 J4 J8 J9 16 | " 17 | 18 | if [ $(echo $pins | wc -w) -ne 63 ]; then 19 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 20 | exit 1 21 | fi 22 | 23 | { 24 | echo -n "all:" 25 | for pin in $pins; do 26 | id="pinloc-8k-cm81_${pin}" 27 | echo -n " ${id}.exp" 28 | done 29 | echo 30 | 31 | for pin in $pins; do 32 | id="pinloc-8k-cm81_${pin}" 33 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 34 | echo "set_io y ${pin}" >> ${id}.pcf 35 | echo; echo "${id}.exp:" 36 | echo " ICEDEV=lp8k-cm81 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 37 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 38 | echo " ! grep '^Warning: pin' ${id}.log" 39 | echo " rm -rf ${id}.tmp" 40 | echo " mv ${id}.exp.new ${id}.exp" 41 | done 42 | } > pinloc-8k-cm81.mk 43 | 44 | set -ex 45 | make -f pinloc-8k-cm81.mk -j4 46 | python3 ../pinlocdb.py pinloc-8k-cm81_*.exp > ../pinloc-8k-cm81.txt 47 | 48 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-8k-ct256.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-8k-ct256 4 | cd pinloc-8k-ct256 5 | 6 | pins=" 7 | A1 A2 A5 A6 A7 A9 A10 A11 A15 A16 8 | B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16 9 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C16 10 | D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D13 D14 D15 D16 11 | E2 E3 E4 E5 E6 E9 E10 E11 E13 E14 E16 12 | F1 F2 F3 F4 F5 F7 F9 F11 F12 F13 F14 F15 F16 13 | G1 G2 G3 G4 G5 G10 G11 G12 G13 G14 G15 G16 14 | H1 H2 H3 H4 H5 H6 H11 H12 H13 H14 H16 15 | J1 J2 J3 J4 J5 J10 J11 J12 J13 J14 J15 J16 16 | K1 K3 K4 K5 K9 K11 K12 K13 K14 K15 K16 17 | L1 L3 L4 L5 L6 L7 L9 L10 L11 L12 L13 L14 L16 18 | M1 M2 M3 M4 M5 M6 M7 M8 M9 M11 M12 M13 M14 M15 M16 19 | N2 N3 N4 N5 N6 N7 N9 N10 N12 N16 20 | P1 P2 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 21 | R1 R2 R3 R4 R5 R6 R9 R10 R11 R12 R14 R15 R16 22 | T1 T2 T3 T5 T6 T7 T8 T9 T10 T11 T13 T14 T15 T16 23 | " 24 | 25 | if [ $(echo $pins | wc -w) -ne 206 ]; then 26 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 27 | exit 1 28 | fi 29 | 30 | { 31 | echo -n "all:" 32 | for pin in $pins; do 33 | id="pinloc-8k-ct256_${pin}" 34 | echo -n " ${id}.exp" 35 | done 36 | echo 37 | 38 | for pin in $pins; do 39 | id="pinloc-8k-ct256_${pin}" 40 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 41 | echo "set_io y ${pin}" >> ${id}.pcf 42 | echo; echo "${id}.exp:" 43 | echo " ICEDEV=hx8k-ct256 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 44 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 45 | echo " ! grep '^Warning: pin' ${id}.log" 46 | echo " rm -rf ${id}.tmp" 47 | echo " mv ${id}.exp.new ${id}.exp" 48 | done 49 | } > pinloc-8k-ct256.mk 50 | 51 | set -ex 52 | make -f pinloc-8k-ct256.mk -j4 53 | python3 ../pinlocdb.py pinloc-8k-ct256_*.exp > ../pinloc-8k-ct256.txt 54 | 55 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinloc-u4k-sg48.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p pinloc-u4k-sg48 4 | cd pinloc-u4k-sg48 5 | 6 | pins=" 7 | 2 3 4 6 9 10 11 12 8 | 13 14 15 16 17 18 19 20 21 23 9 | 25 26 27 28 31 32 34 35 36 10 | 37 38 42 43 44 45 46 47 48 11 | " 12 | 13 | if [ $(echo $pins | wc -w) -ne 36 ]; then 14 | echo "Incorrect number of pins:" $(echo $pins | wc -w) 15 | exit 1 16 | fi 17 | 18 | { 19 | echo -n "all:" 20 | for pin in $pins; do 21 | id="pinloc-u4k-sg48_${pin}" 22 | echo -n " ${id}.exp" 23 | done 24 | echo 25 | 26 | for pin in $pins; do 27 | id="pinloc-u4k-sg48_${pin}" 28 | echo "module top(output y); assign y = 0; endmodule" > ${id}.v 29 | echo "set_io y ${pin}" >> ${id}.pcf 30 | echo; echo "${id}.exp:" 31 | echo " ICEDEV=u4k-sg48 bash ../../icecube.sh ${id} > ${id}.log 2>&1" 32 | echo " ../../../icebox/icebox_explain.py ${id}.asc > ${id}.exp.new" 33 | echo " ! grep '^Warning: pin' ${id}.log" 34 | echo " rm -rf ${id}.tmp" 35 | echo " mv ${id}.exp.new ${id}.exp" 36 | done 37 | } > pinloc-u4k-sg48.mk 38 | 39 | set -ex 40 | make -f pinloc-u4k-sg48.mk -j4 41 | python3 ../pinlocdb.py pinloc-u4k-sg48_*.exp > ../pinloc-u4k-sg48.txt 42 | -------------------------------------------------------------------------------- /icefuzz/pinloc/pinlocdb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import re 4 | from sys import argv 5 | 6 | ieren_db = [ ] 7 | pinloc_db = [ ] 8 | 9 | for arg in argv[1:]: 10 | pin = re.search(r"_([^.]*)", arg).group(1) 11 | with open(arg, "r") as f: 12 | tile = [0, 0] 13 | iob = [0, 0, 0] 14 | ioctrl = [0, 0, 0] 15 | 16 | for line in f: 17 | match = re.match(r"^\.io_tile (\d+) (\d+)", line) 18 | if match: 19 | tile = [int(match.group(1)), int(match.group(2))] 20 | 21 | match = re.match(r"^IOB_(\d+)", line) 22 | if match: 23 | iob = tile + [int(match.group(1))] 24 | 25 | match = re.match(r"^IoCtrl REN_(\d+)", line) 26 | if match: 27 | ioctrl = tile + [int(match.group(1))] 28 | 29 | ieren_db.append(tuple(iob + ioctrl)) 30 | pinloc_db.append(tuple(['"' + pin + '"'] + iob)) 31 | 32 | print() 33 | print("# ieren_db") 34 | for entry in sorted(ieren_db): 35 | print(" (%2d, %2d, %d, %2d, %2d, %d)," % entry) 36 | 37 | print() 38 | print("# pinloc_db") 39 | for entry in sorted(pinloc_db, key=lambda n: re.sub(r"[0-9]+", lambda d: "%03d" % int(d.group(0)), n[0])): 40 | print(" (%5s, %2d, %2d, %d)," % entry) 41 | 42 | print() 43 | 44 | -------------------------------------------------------------------------------- /icefuzz/rename_dsps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys, os 4 | 5 | dsptype = None 6 | dsppath = sys.argv[1].replace(".vsb", ".dsp") 7 | 8 | if os.path.exists(dsppath): 9 | with open(dsppath, 'r') as f: 10 | dsptype = f.readline().strip() 11 | 12 | with open("tmedges.tmp", "a") as outfile: 13 | with open("tmedges_unrenamed.tmp", "r") as infile: 14 | for line in infile: 15 | if "SB_MAC16" in line: 16 | if dsptype is not None: 17 | outfile.write(line.replace("SB_MAC16", dsptype)) 18 | else: 19 | outfile.write(line) 20 | -------------------------------------------------------------------------------- /icefuzz/runloop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true; do 5 | echo; git diff cached_*.txt | diffstat 6 | echo; echo -n "[$(date '+%H:%M:%S')] Iteration $(( ++i )) " 7 | { echo; echo; echo; echo; echo; echo; echo "Iteration $i"; date; } >> runloop.log 8 | if make clean > >( gawk '{ print >> "runloop.log"; printf("x"); fflush(""); }'; ) 2>&1 && 9 | make -j6 > >( gawk '{ print >> "runloop.log"; printf("m"); fflush(""); }'; ) 2>&1 && 10 | make -j6 check > >( gawk '{ print >> "runloop.log"; if (NR % 100 == 0) printf("c"); fflush(""); }'; ) 2>&1 11 | then 12 | echo -n " OK" 13 | else 14 | echo " ERROR"; echo 15 | tail runloop.log 16 | exit 1 17 | fi 18 | done 19 | 20 | -------------------------------------------------------------------------------- /icefuzz/tests/.gitignore: -------------------------------------------------------------------------------- 1 | ioctrl.work 2 | intosc.work 3 | -------------------------------------------------------------------------------- /icefuzz/tests/all_luts_ffff.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YosysHQ/icestorm/f31c39cc2eadd0ab7f29f34becba1348ae9f8721/icefuzz/tests/all_luts_ffff.bin -------------------------------------------------------------------------------- /icefuzz/tests/bitop.pcf: -------------------------------------------------------------------------------- 1 | set_io a 1 2 | set_io b 10 3 | set_io y 11 4 | -------------------------------------------------------------------------------- /icefuzz/tests/bitop.v: -------------------------------------------------------------------------------- 1 | module top (input a, b, output y); 2 | assign y = a & b; 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/bram.pcf: -------------------------------------------------------------------------------- 1 | set_location ram 3 1 2 | -------------------------------------------------------------------------------- /icefuzz/tests/bram.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | input [15:0] wdata, 4 | output [15:0] rdata, 5 | input [7:0] addr 6 | ); 7 | SB_RAM40_4K #( 8 | .WRITE_MODE(0), 9 | .READ_MODE(0) 10 | ) ram ( 11 | .RDATA(rdata), 12 | .RADDR(addr), 13 | .RCLK(clk), 14 | .RCLKE(1'b1), 15 | .RE(1'b1), 16 | .WADDR(addr), 17 | .WCLK(clk), 18 | .WCLKE(1'b1), 19 | .WDATA(wdata), 20 | .WE(1'b1), 21 | .MASK(16'b0) 22 | ); 23 | 24 | defparam ram.INIT_0 = 256'h123456789abcdef00000dddd0000eeee00000012483569ac0111044400000001; 25 | defparam ram.INIT_1 = 256'h56789abcdef123400000dddd0000eeee00000012483569ac0111044401000002; 26 | defparam ram.INIT_2 = 256'habcdef12345678900000dddd0000eeee00000012483569ac0111044402000004; 27 | defparam ram.INIT_3 = 256'h00000000000000000000dddd0000eeee00000012483569ac0111044403000008; 28 | defparam ram.INIT_4 = 256'hffff000022220000444400006666000088880012483569ac0111044404000010; 29 | defparam ram.INIT_5 = 256'hffff000022220000444400006666000088880012483569ac0111044405000020; 30 | defparam ram.INIT_6 = 256'hffff000022220000444400006666000088880012483569ac0111044406000040; 31 | defparam ram.INIT_7 = 256'hffff000022220000444400006666000088880012483569ac0111044407000080; 32 | defparam ram.INIT_8 = 256'h0000111100003333000055550000777700000012483569ac0111044408000100; 33 | defparam ram.INIT_9 = 256'h0000111100003333000055550000777700000012483569ac0111044409000200; 34 | defparam ram.INIT_A = 256'h0000111100003333000055550000777700000012483569ac011104440a000400; 35 | defparam ram.INIT_B = 256'h0000111100003333000055550000777700000012483569ac011104440b000800; 36 | defparam ram.INIT_C = 256'h0123000099990000aaaa0000bbbb0000cccc0012483569ac011104440c001000; 37 | defparam ram.INIT_D = 256'h4567000099990000aaaa0000bbbb0000cccc0012483569ac011104440d002000; 38 | defparam ram.INIT_E = 256'h89ab000099990000aaaa0000bbbb0000cccc0012483569ac011104440e004000; 39 | defparam ram.INIT_F = 256'hcdef000099990000aaaa0000bbbb0000cccc0012483569ac011104440f008000; 40 | endmodule 41 | -------------------------------------------------------------------------------- /icefuzz/tests/carry.v: -------------------------------------------------------------------------------- 1 | module top (input a, b, ci, output co); 2 | SB_CARRY carry_cell ( 3 | .I0(a), 4 | .I1(b), 5 | .CI(ci), 6 | .CO(co) 7 | ); 8 | endmodule 9 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | colbuf_tile = None 6 | glbnet_tile = None 7 | 8 | for line in fileinput.input(): 9 | line = line.split() 10 | if len(line) == 0: 11 | continue 12 | if line[0] in [".io_tile", ".logic_tile", ".ramb_tile", ".ramt_tile"]: 13 | current_tile = (int(line[1]), int(line[2])) 14 | if line[0] == "ColBufCtrl": 15 | assert colbuf_tile is None 16 | colbuf_tile = current_tile 17 | if line[0] == "buffer" and line[1].startswith("glb_netwk_"): 18 | assert glbnet_tile is None 19 | glbnet_tile = current_tile 20 | 21 | print("(%2d, %2d, %2d, %2d)," % (colbuf_tile[0], colbuf_tile[1], glbnet_tile[0], glbnet_tile[1])) 22 | 23 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # for f in colbuf_io.work/*.exp colbuf_logic.work/*.exp colbuf_ram.work/*.exp; do 4 | # python3 colbuf.py $f 5 | # done | sort -u > colbuf.txt 6 | 7 | get_colbuf_data() 8 | { 9 | # tr -d '(,)' < colbuf.txt 10 | for x in {0..2} {4..9} {11..13}; do 11 | echo $x 4 $x 0 12 | echo $x 5 $x 8 13 | echo $x 12 $x 9 14 | echo $x 13 $x 17 15 | done 16 | for x in 3 10; do 17 | echo $x 3 $x 0 18 | echo $x 3 $x 4 19 | echo $x 5 $x 8 20 | echo $x 11 $x 9 21 | echo $x 11 $x 12 22 | echo $x 13 $x 17 23 | done 24 | } 25 | 26 | { 27 | echo "" 28 | for x in {1..13}; do 29 | echo "" 30 | done 31 | for y in {1..17}; do 32 | echo "" 33 | done 34 | for x in {0..13}; do 35 | echo "$x" 36 | done 37 | for y in {0..17}; do 38 | echo "$y" 39 | done 40 | while read x1 y1 x2 y2; do 41 | echo "" 42 | done < <( get_colbuf_data; ) 43 | while read x1 y1 x2 y2; do 44 | echo "" 45 | done < <( get_colbuf_data; ) 46 | echo "" 47 | } > colbuf.svg 48 | 49 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_384.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | colbuf_tile = None 6 | glbnet_tile = None 7 | 8 | for line in fileinput.input(): 9 | line = line.split() 10 | if len(line) == 0: 11 | continue 12 | if line[0] in [".io_tile", ".logic_tile"]: 13 | current_tile = (int(line[1]), int(line[2])) 14 | if line[0] == "ColBufCtrl": 15 | assert colbuf_tile is None 16 | colbuf_tile = current_tile 17 | if line[0] == "buffer" and line[1].startswith("glb_netwk_"): 18 | assert glbnet_tile is None 19 | glbnet_tile = current_tile 20 | 21 | if colbuf_tile is None: 22 | if glbnet_tile is None: print("( ? , ? , ? , ? ),") 23 | else: print("( ? , ? , %2d, %2d)," % (glbnet_tile[0], glbnet_tile[1])) 24 | elif glbnet_tile is None: 25 | if colbuf_tile is None: print("( ? , ? , ? , ? ),") 26 | else: print("(%2d, %2d, ? , ? )," % (colbuf_tile[0], colbuf_tile[1])) 27 | else: 28 | print("(%2d, %2d, %2d, %2d)," % (colbuf_tile[0], colbuf_tile[1], glbnet_tile[0], glbnet_tile[1])) 29 | 30 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_384.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in colbuf_io_384.work/*.exp colbuf_logic_384.work/*.exp; do 4 | echo $f >&2 5 | python3 colbuf_384.py $f 6 | done | sort -u > colbuf_384.txt 7 | 8 | get_colbuf_data() 9 | { 10 | tr -d '(,)' < colbuf_384.txt 11 | } 12 | 13 | { 14 | echo "" 15 | for x in {1..7}; do 16 | echo "" 17 | done 18 | for y in {1..9}; do 19 | echo "" 20 | done 21 | for x in {0..7}; do 22 | echo "$x" 23 | done 24 | for y in {0..9}; do 25 | echo "$y" 26 | done 27 | while read x1 y1 x2 y2; do 28 | echo "" 29 | done < <( get_colbuf_data; ) 30 | while read x1 y1 x2 y2; do 31 | echo "" 32 | done < <( get_colbuf_data; ) 33 | echo "" 34 | } > colbuf_384.svg 35 | 36 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in colbuf_io_5k.work/*.exp colbuf_logic_5k.work/*.exp colbuf_ram_5k.work/*.exp; do 4 | echo $f >&2 5 | python3 colbuf.py $f 6 | done | sort -u > colbuf_5k.txt 7 | 8 | get_colbuf_data() 9 | { 10 | tr -d '(,)' < colbuf_5k.txt 11 | # for x in {0..2} {4..9} {11..13}; do 12 | # echo $x 4 $x 0 13 | # echo $x 5 $x 8 14 | # echo $x 12 $x 9 15 | # echo $x 13 $x 17 16 | # done 17 | # for x in 3 10; do 18 | # echo $x 3 $x 0 19 | # echo $x 3 $x 4 20 | # echo $x 5 $x 8 21 | # echo $x 11 $x 9 22 | # echo $x 11 $x 12 23 | # echo $x 13 $x 17 24 | # done 25 | } 26 | 27 | { 28 | echo "" 29 | for x in {1..33}; do 30 | echo "" 31 | done 32 | for y in {1..33}; do 33 | echo "" 34 | done 35 | for x in {0..33}; do 36 | echo "$x" 37 | done 38 | for y in {0..33}; do 39 | echo "$y" 40 | done 41 | while read x1 y1 x2 y2; do 42 | echo "" 43 | done < <( get_colbuf_data; ) 44 | while read x1 y1 x2 y2; do 45 | echo "" 46 | done < <( get_colbuf_data; ) 47 | while read x1 y1 x2 y2; do 48 | echo "" 49 | done < <( get_colbuf_data; ) 50 | echo "" 51 | } > colbuf_8k.svg 52 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_8k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in colbuf_io_8k.work/*.exp colbuf_logic_8k.work/*.exp colbuf_ram_8k.work/*.exp; do 4 | echo $f >&2 5 | python3 colbuf.py $f 6 | done | sort -u > colbuf_8k.txt 7 | 8 | get_colbuf_data() 9 | { 10 | tr -d '(,)' < colbuf_8k.txt 11 | # for x in {0..2} {4..9} {11..13}; do 12 | # echo $x 4 $x 0 13 | # echo $x 5 $x 8 14 | # echo $x 12 $x 9 15 | # echo $x 13 $x 17 16 | # done 17 | # for x in 3 10; do 18 | # echo $x 3 $x 0 19 | # echo $x 3 $x 4 20 | # echo $x 5 $x 8 21 | # echo $x 11 $x 9 22 | # echo $x 11 $x 12 23 | # echo $x 13 $x 17 24 | # done 25 | } 26 | 27 | { 28 | echo "" 29 | for x in {1..33}; do 30 | echo "" 31 | done 32 | for y in {1..33}; do 33 | echo "" 34 | done 35 | for x in {0..33}; do 36 | echo "$x" 37 | done 38 | for y in {0..33}; do 39 | echo "$y" 40 | done 41 | while read x1 y1 x2 y2; do 42 | echo "" 43 | done < <( get_colbuf_data; ) 44 | while read x1 y1 x2 y2; do 45 | echo "" 46 | done < <( get_colbuf_data; ) 47 | while read x1 y1 x2 y2; do 48 | echo "" 49 | done < <( get_colbuf_data; ) 50 | echo "" 51 | } > colbuf_8k.svg 52 | 53 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io.work 6 | cd colbuf_io.work 7 | 8 | glb_pins="93 21 128 50 20 94 49 129" 9 | 10 | pins=" 11 | 1 2 3 4 7 8 9 10 11 12 19 22 23 24 25 26 28 29 31 32 33 34 12 | 37 38 41 42 43 44 45 47 48 52 56 58 60 61 62 63 64 13 | 73 74 75 76 78 79 80 81 87 88 90 91 95 96 97 98 101 102 104 105 106 107 14 | 112 113 114 115 116 117 118 119 120 121 122 134 135 136 137 138 139 141 142 143 144 15 | " 16 | pins="$( echo $pins )" 17 | 18 | for pin in $pins; do 19 | pf="colbuf_io_$pin" 20 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 21 | cat > ${pf}.v <<- EOT 22 | module top (input clk, data, output pin); 23 | SB_IO #( 24 | .PIN_TYPE(6'b 0101_00) 25 | ) pin_obuf ( 26 | .PACKAGE_PIN(pin), 27 | .OUTPUT_CLK(clk), 28 | .D_OUT_0(data) 29 | ); 30 | endmodule 31 | EOT 32 | echo "set_io pin $pin" > ${pf}.pcf 33 | echo "set_io clk $gpin" >> ${pf}.pcf 34 | bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 35 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 36 | rm -rf ${pf}.tmp 37 | done 38 | 39 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io_384.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io_384.work 6 | cd colbuf_io_384.work 7 | 8 | glb_pins="B4 C4 D2 D6 D7 E2 F3 F4" 9 | 10 | pins=" 11 | A1 A2 A3 A4 A5 A6 A7 12 | B1 B2 B3 B4 13 | C1 C2 C4 C5 C6 C7 14 | D1 D2 D3 D4 D6 D7 15 | E2 E6 E7 16 | F1 F2 F3 F4 F5 F6 F7 17 | G1 G3 G4 G6 18 | " 19 | pins="$( echo $pins )" 20 | 21 | for pin in $pins; do 22 | pf="colbuf_io_384_$pin" 23 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 24 | cat > ${pf}.v <<- EOT 25 | module top (input clk, data, output pin); 26 | SB_IO #( 27 | .PIN_TYPE(6'b 0101_00) 28 | ) pin_obuf ( 29 | .PACKAGE_PIN(pin), 30 | .OUTPUT_CLK(clk), 31 | .D_OUT_0(data) 32 | ); 33 | endmodule 34 | EOT 35 | echo "set_io pin $pin" > ${pf}.pcf 36 | echo "set_io clk $gpin" >> ${pf}.pcf 37 | ICEDEV=lp384-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 38 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 39 | rm -rf ${pf}.tmp 40 | done 41 | 42 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io_5k.work 6 | cd colbuf_io_5k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | pins=" 11 | 2 3 4 6 9 10 11 12 12 | 13 18 19 20 21 13 | 25 26 27 28 31 32 34 35 36 14 | 37 38 42 43 44 45 46 47 48 15 | " 16 | pins="$( echo $pins )" 17 | 18 | for pin in $pins; do 19 | pf="colbuf_io_5k_$pin" 20 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 21 | cat > ${pf}.v <<- EOT 22 | module top (input clk, data, output pin); 23 | SB_IO #( 24 | .PIN_TYPE(6'b 0101_00) 25 | ) pin_obuf ( 26 | .PACKAGE_PIN(pin), 27 | .OUTPUT_CLK(clk), 28 | .D_OUT_0(data) 29 | ); 30 | endmodule 31 | EOT 32 | echo "set_io pin $pin" > ${pf}.pcf 33 | echo "set_io clk $gpin" >> ${pf}.pcf 34 | ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 35 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 36 | rm -rf ${pf}.tmp 37 | done 38 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io_8k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io_8k.work 6 | cd colbuf_io_8k.work 7 | 8 | glb_pins="C8 F7 G1 H11 H16 J3 K9 R9" 9 | 10 | pins=" 11 | A1 A2 A5 A6 A7 A9 A10 A11 A15 A16 12 | B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16 13 | C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C16 14 | D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D13 D14 D15 D16 15 | E2 E3 E4 E5 E6 E9 E10 E11 E13 E14 E16 16 | F1 F2 F3 F4 F5 F7 F9 F11 F12 F13 F14 F15 F16 17 | G1 G2 G3 G4 G5 G10 G11 G12 G13 G14 G15 G16 18 | H1 H2 H3 H4 H5 H6 H11 H12 H13 H14 H16 19 | J1 J2 J3 J4 J5 J10 J11 J12 J13 J14 J15 J16 20 | K1 K3 K4 K5 K9 K11 K12 K13 K14 K15 K16 21 | L1 L3 L4 L5 L6 L7 L9 L10 L11 L12 L13 L14 L16 22 | M1 M2 M3 M4 M5 M6 M7 M8 M9 M11 M12 M13 M14 M15 M16 23 | N2 N3 N4 N5 N6 N7 N9 N10 N12 N16 24 | P1 P2 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 25 | R1 R2 R3 R4 R5 R6 R9 R10 R11 R12 R14 R15 R16 26 | T1 T2 T3 T5 T6 T7 T8 T9 T10 T11 T13 T14 T15 T16 27 | " 28 | pins="$( echo $pins )" 29 | 30 | for pin in $pins; do 31 | pf="colbuf_io_8k_$pin" 32 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 33 | cat > ${pf}.v <<- EOT 34 | module top (input clk, data, output pin); 35 | SB_IO #( 36 | .PIN_TYPE(6'b 0101_00) 37 | ) pin_obuf ( 38 | .PACKAGE_PIN(pin), 39 | .OUTPUT_CLK(clk), 40 | .D_OUT_0(data) 41 | ); 42 | endmodule 43 | EOT 44 | echo "set_io pin $pin" > ${pf}.pcf 45 | echo "set_io clk $gpin" >> ${pf}.pcf 46 | ICEDEV=hx8k-ct256 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 47 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 48 | rm -rf ${pf}.tmp 49 | done 50 | 51 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io_lm4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io_lm4k.work 6 | cd colbuf_io_lm4k.work 7 | 8 | glb_pins="A3 A4 D2 E2 E5 G3" 9 | 10 | pins=" 11 | A1 A2 A3 A4 A5 A6 A7 12 | B1 B2 B4 B6 B7 13 | C1 C3 C4 C6 C7 14 | D1 D2 D3 D6 D7 15 | E1 E2 E3 E4 E5 E7 16 | F2 F3 F4 F7 17 | G3 18 | " 19 | pins="$( echo $pins )" 20 | 21 | for pin in $pins; do 22 | pf="colbuf_io_lm4k_$pin" 23 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 24 | cat > ${pf}.v <<- EOT 25 | module top (input clk, data, output pin); 26 | SB_IO #( 27 | .PIN_TYPE(6'b 0101_00) 28 | ) pin_obuf ( 29 | .PACKAGE_PIN(pin), 30 | .OUTPUT_CLK(clk), 31 | .D_OUT_0(data) 32 | ); 33 | endmodule 34 | EOT 35 | echo "set_io pin $pin" > ${pf}.pcf 36 | echo "set_io clk $gpin" >> ${pf}.pcf 37 | ICEDEV=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 38 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 39 | rm -rf ${pf}.tmp 40 | done 41 | 42 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_io_u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_io_u4k.work 6 | cd colbuf_io_u4k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | pins=" 11 | 2 3 4 6 9 10 11 12 12 | 13 18 19 20 21 13 | 25 26 27 28 31 32 34 35 36 14 | 37 38 42 43 44 45 46 47 48 15 | " 16 | pins="$( echo $pins )" 17 | 18 | for pin in $pins; do 19 | pf="colbuf_io_u4k_$pin" 20 | gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; ) 21 | cat > ${pf}.v <<- EOT 22 | module top (input clk, data, output pin); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(clk), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_IO #( 34 | .PIN_TYPE(6'b 0101_00) 35 | ) pin_obuf ( 36 | .PACKAGE_PIN(pin), 37 | .OUTPUT_CLK(gc), 38 | .D_OUT_0(data) 39 | ); 40 | endmodule 41 | EOT 42 | echo "set_io pin $pin" > ${pf}.pcf 43 | echo "set_io clk $gpin" >> ${pf}.pcf 44 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 45 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 46 | rm -rf ${pf}.tmp 47 | done 48 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic.work 6 | cd colbuf_logic.work 7 | 8 | glb_pins="93 21 128 50 20 94 49 129" 9 | 10 | for x in 1 2 {4..9} 11 12; do 11 | for y in {1..16}; do 12 | pf="colbuf_logic_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | cat > ${pf}.v <<- EOT 15 | module top (input c, d, output q); 16 | SB_DFF dff ( 17 | .C(c), 18 | .D(d), 19 | .Q(q) 20 | ); 21 | endmodule 22 | EOT 23 | echo "set_location dff $x $y 0" > ${pf}.pcf 24 | echo "set_io c $gpin" >> ${pf}.pcf 25 | bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 26 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 27 | rm -rf ${pf}.tmp 28 | done; done 29 | 30 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic_384.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic_384.work 6 | cd colbuf_logic_384.work 7 | 8 | glb_pins="B4 C4 D2 D6 D7 E2 F3 F4" 9 | 10 | for x in 1 2 3 4 5 6; do 11 | for y in 1 2 3 4 5 6 7 8; do 12 | pf="colbuf_logic_384_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | cat > ${pf}.v <<- EOT 15 | module top (input c, d, output q); 16 | SB_DFF dff ( 17 | .C(c), 18 | .D(d), 19 | .Q(q) 20 | ); 21 | endmodule 22 | EOT 23 | echo "set_location dff $x $y 0" > ${pf}.pcf 24 | echo "set_io c $gpin" >> ${pf}.pcf 25 | ICEDEV=lp384-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 26 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 27 | rm -rf ${pf}.tmp 28 | done; done 29 | 30 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic_5k.work 6 | cd colbuf_logic_5k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | for x in {1..5} {7..18} {20..24}; do 11 | for y in {1..30}; do 12 | pf="colbuf_logic_5k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | cat > ${pf}.v <<- EOT 15 | module top (input c, d, output q); 16 | SB_DFF dff ( 17 | .C(c), 18 | .D(d), 19 | .Q(q) 20 | ); 21 | endmodule 22 | EOT 23 | echo "set_location dff $x $y 0" > ${pf}.pcf 24 | echo "set_io c $gpin" >> ${pf}.pcf 25 | ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 26 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 27 | rm -rf ${pf}.tmp 28 | done; done 29 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic_8k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic_8k.work 6 | cd colbuf_logic_8k.work 7 | 8 | glb_pins="C8 F7 G1 H11 H16 J3 K9 R9" 9 | 10 | for x in {1..7} {9..24} {26..32}; do 11 | for y in {1..32}; do 12 | pf="colbuf_logic_8k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | cat > ${pf}.v <<- EOT 15 | module top (input c, d, output q); 16 | SB_DFF dff ( 17 | .C(c), 18 | .D(d), 19 | .Q(q) 20 | ); 21 | endmodule 22 | EOT 23 | echo "set_location dff $x $y 0" > ${pf}.pcf 24 | echo "set_io c $gpin" >> ${pf}.pcf 25 | ICEDEV=hx8k-ct256 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 26 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 27 | rm -rf ${pf}.tmp 28 | done; done 29 | 30 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic_lm4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic_lm4k.work 6 | cd colbuf_logic_lm4k.work 7 | 8 | glb_pins="A3 A4 D2 E2 E5 G3" 9 | 10 | for y in {1..32}; do 11 | for y in {1..20}; do 12 | pf="colbuf_logic_lm4k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | cat > ${pf}.v <<- EOT 15 | module top (input c, d, output q); 16 | SB_DFF dff ( 17 | .C(c), 18 | .D(d), 19 | .Q(q) 20 | ); 21 | endmodule 22 | EOT 23 | echo "set_location dff $x $y 0" > ${pf}.pcf 24 | echo "set_io c $gpin" >> ${pf}.pcf 25 | ICEDEV=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 26 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 27 | rm -rf ${pf}.tmp 28 | done; done 29 | 30 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_logic_u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_logic_u4k.work 6 | cd colbuf_logic_u4k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | for x in {1..5} {7..18} {20..24}; do 11 | for y in {1..20}; do 12 | pf="colbuf_logic_u4k_${x}_${y}" 13 | [ -f ${pf}.exp ] && continue 14 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 15 | cat > ${pf}.v <<- EOT 16 | module top (input c, d, output q); 17 | SB_DFF dff ( 18 | .C(c), 19 | .D(d), 20 | .Q(q) 21 | ); 22 | endmodule 23 | EOT 24 | echo "set_location dff $x $y 0" > ${pf}.pcf 25 | echo "set_io c $gpin" >> ${pf}.pcf 26 | [ $x = 7 -a $y = 20 ] && continue 27 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 28 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 29 | rm -rf ${pf}.tmp 30 | done; done 31 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_ram.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_ram.work 6 | cd colbuf_ram.work 7 | 8 | glb_pins="93 21 128 50 20 94 49 129" 9 | 10 | for x in 3 10; do 11 | for y in {1..16}; do 12 | pf="colbuf_ram_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | if [ $((y % 2)) == 1 ]; then 15 | clkport="WCLK" 16 | other_clkport="RCLK" 17 | else 18 | clkport="RCLK" 19 | other_clkport="WCLK" 20 | fi 21 | cat > ${pf}.v <<- EOT 22 | module top (input c, oc, input [1:0] d, output [1:0] q); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(c), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_RAM40_4K #( 34 | .READ_MODE(3), 35 | .WRITE_MODE(3) 36 | ) ram40 ( 37 | .WADDR(11'b0), 38 | .RADDR(11'b0), 39 | .$clkport(gc), 40 | .$other_clkport(oc), 41 | .RDATA(q), 42 | .WDATA(d), 43 | .WE(1'b1), 44 | .WCLKE(1'b1), 45 | .RE(1'b1), 46 | .RCLKE(1'b1) 47 | ); 48 | endmodule 49 | EOT 50 | echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf 51 | echo "set_io oc 1" >> ${pf}.pcf 52 | echo "set_io c $gpin" >> ${pf}.pcf 53 | bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 54 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 55 | rm -rf ${pf}.tmp 56 | done; done 57 | 58 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_ram_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_ram_5k.work 6 | cd colbuf_ram_5k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | for x in 6 19; do 11 | for y in {1..30}; do 12 | pf="colbuf_ram_5k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | if [ $((y % 2)) == 1 ]; then 15 | clkport="WCLK" 16 | other_clkport="RCLK" 17 | else 18 | clkport="RCLK" 19 | other_clkport="WCLK" 20 | fi 21 | cat > ${pf}.v <<- EOT 22 | module top (input c, oc, input [1:0] d, output [1:0] q); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(c), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_RAM40_4K #( 34 | .READ_MODE(3), 35 | .WRITE_MODE(3) 36 | ) ram40 ( 37 | .WADDR(11'b0), 38 | .RADDR(11'b0), 39 | .$clkport(gc), 40 | .$other_clkport(oc), 41 | .RDATA(q), 42 | .WDATA(d), 43 | .WE(1'b1), 44 | .WCLKE(1'b1), 45 | .RE(1'b1), 46 | .RCLKE(1'b1) 47 | ); 48 | endmodule 49 | EOT 50 | echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf 51 | echo "set_io oc 1" >> ${pf}.pcf 52 | echo "set_io c $gpin" >> ${pf}.pcf 53 | ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 54 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 55 | rm -rf ${pf}.tmp 56 | done; done 57 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_ram_8k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_ram_8k.work 6 | cd colbuf_ram_8k.work 7 | 8 | glb_pins="C8 F7 G1 H11 H16 J3 K9 R9" 9 | 10 | for x in 8 25; do 11 | for y in {1..32}; do 12 | pf="colbuf_ram_8k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | if [ $((y % 2)) == 1 ]; then 15 | clkport="WCLK" 16 | other_clkport="RCLK" 17 | else 18 | clkport="RCLK" 19 | other_clkport="WCLK" 20 | fi 21 | cat > ${pf}.v <<- EOT 22 | module top (input c, oc, input [1:0] d, output [1:0] q); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(c), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_RAM40_4K #( 34 | .READ_MODE(3), 35 | .WRITE_MODE(3) 36 | ) ram40 ( 37 | .WADDR(11'b0), 38 | .RADDR(11'b0), 39 | .$clkport(gc), 40 | .$other_clkport(oc), 41 | .RDATA(q), 42 | .WDATA(d), 43 | .WE(1'b1), 44 | .WCLKE(1'b1), 45 | .RE(1'b1), 46 | .RCLKE(1'b1) 47 | ); 48 | endmodule 49 | EOT 50 | echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf 51 | echo "set_io oc 1" >> ${pf}.pcf 52 | echo "set_io c $gpin" >> ${pf}.pcf 53 | ICEDEV=hx8k-ct256 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 54 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 55 | rm -rf ${pf}.tmp 56 | done; done 57 | 58 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_ram_lm4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_ram_lm4k.work 6 | cd colbuf_ram_lm4k.work 7 | 8 | glb_pins="A3 A4 D2 E2 E5 G3" 9 | 10 | for x in 6 19; do 11 | for y in {1..20}; do 12 | pf="colbuf_ram_lm4k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | if [ $((y % 2)) == 1 ]; then 15 | clkport="WCLK" 16 | other_clkport="RCLK" 17 | else 18 | clkport="RCLK" 19 | other_clkport="WCLK" 20 | fi 21 | cat > ${pf}.v <<- EOT 22 | module top (input c, oc, input [1:0] d, output [1:0] q); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(c), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_RAM40_4K #( 34 | .READ_MODE(3), 35 | .WRITE_MODE(3) 36 | ) ram40 ( 37 | .WADDR(11'b0), 38 | .RADDR(11'b0), 39 | .$clkport(gc), 40 | .$other_clkport(oc), 41 | .RDATA(q), 42 | .WDATA(d), 43 | .WE(1'b1), 44 | .WCLKE(1'b1), 45 | .RE(1'b1), 46 | .RCLKE(1'b1) 47 | ); 48 | endmodule 49 | EOT 50 | echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf 51 | echo "set_io oc 1" >> ${pf}.pcf 52 | echo "set_io c $gpin" >> ${pf}.pcf 53 | ICEDEV=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 54 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 55 | rm -rf ${pf}.tmp 56 | done; done 57 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_ram_u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p colbuf_ram_u4k.work 6 | cd colbuf_ram_u4k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | for x in 6 19; do 11 | for y in {1..30}; do 12 | pf="colbuf_ram_u4k_${x}_${y}" 13 | gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; ) 14 | if [ $((y % 2)) == 1 ]; then 15 | clkport="WCLK" 16 | other_clkport="RCLK" 17 | else 18 | clkport="RCLK" 19 | other_clkport="WCLK" 20 | fi 21 | cat > ${pf}.v <<- EOT 22 | module top (input c, oc, input [1:0] d, output [1:0] q); 23 | wire gc; 24 | SB_GB_IO #( 25 | .PIN_TYPE(6'b 0000_00), 26 | .PULLUP(1'b0), 27 | .NEG_TRIGGER(1'b0), 28 | .IO_STANDARD("SB_LVCMOS") 29 | ) gbuf ( 30 | .PACKAGE_PIN(c), 31 | .GLOBAL_BUFFER_OUTPUT(gc) 32 | ); 33 | SB_RAM40_4K #( 34 | .READ_MODE(3), 35 | .WRITE_MODE(3) 36 | ) ram40 ( 37 | .WADDR(11'b0), 38 | .RADDR(11'b0), 39 | .$clkport(gc), 40 | .$other_clkport(oc), 41 | .RDATA(q), 42 | .WDATA(d), 43 | .WE(1'b1), 44 | .WCLKE(1'b1), 45 | .RE(1'b1), 46 | .RCLKE(1'b1) 47 | ); 48 | endmodule 49 | EOT 50 | echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf 51 | echo "set_io oc 1" >> ${pf}.pcf 52 | echo "set_io c $gpin" >> ${pf}.pcf 53 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 54 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 55 | rm -rf ${pf}.tmp 56 | done; done 57 | -------------------------------------------------------------------------------- /icefuzz/tests/colbuf_u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in colbuf_io_u4k.work/*.exp colbuf_logic_u4k.work/*.exp colbuf_ram_u4k.work/*.exp; do 4 | echo $f >&2 5 | python3 colbuf.py $f 6 | done | sort -u > colbuf_u4k.txt 7 | 8 | get_colbuf_data() 9 | { 10 | tr -d '(,)' < colbuf_u4k.txt 11 | # for x in {0..2} {4..9} {11..13}; do 12 | # echo $x 4 $x 0 13 | # echo $x 5 $x 8 14 | # echo $x 12 $x 9 15 | # echo $x 13 $x 17 16 | # done 17 | # for x in 3 10; do 18 | # echo $x 3 $x 0 19 | # echo $x 3 $x 4 20 | # echo $x 5 $x 8 21 | # echo $x 11 $x 9 22 | # echo $x 11 $x 12 23 | # echo $x 13 $x 17 24 | # done 25 | } 26 | 27 | { 28 | echo "" 29 | for x in {1..33}; do 30 | echo "" 31 | done 32 | for y in {1..33}; do 33 | echo "" 34 | done 35 | for x in {0..33}; do 36 | echo "$x" 37 | done 38 | for y in {0..33}; do 39 | echo "$y" 40 | done 41 | while read x1 y1 x2 y2; do 42 | echo "" 43 | done < <( get_colbuf_data; ) 44 | while read x1 y1 x2 y2; do 45 | echo "" 46 | done < <( get_colbuf_data; ) 47 | while read x1 y1 x2 y2; do 48 | echo "" 49 | done < <( get_colbuf_data; ) 50 | echo "" 51 | } > colbuf_u4k.svg 52 | -------------------------------------------------------------------------------- /icefuzz/tests/colbufs.pcf: -------------------------------------------------------------------------------- 1 | # set_io clk[0] J3 2 | # set_io clk[1] G1 3 | # set_io clk[2] R9 4 | # set_io clk[3] F7 5 | # set_io clk[4] K9 6 | # set_io clk[5] C8 7 | # set_io clk[6] H11 8 | # set_io clk[7] H16 9 | 10 | set_io clk[0] H16 11 | 12 | set_location bitslice[0].ram40_upper 8 11 0 13 | set_location bitslice[0].ram40_lower 25 5 0 14 | 15 | -------------------------------------------------------------------------------- /icefuzz/tests/colbufs.v: -------------------------------------------------------------------------------- 1 | module top #( 2 | parameter NUM_BITS = 1 3 | ) ( 4 | input [NUM_BITS-1:0] clk, 5 | output [NUM_BITS-1:0] y 6 | ); 7 | wire [NUM_BITS-1:0] t1, t2, t3; 8 | 9 | genvar i; 10 | generate for (i = 0; i < NUM_BITS; i = i+1) begin:bitslice 11 | SB_RAM40_4K #( 12 | .READ_MODE(0), 13 | .WRITE_MODE(0) 14 | ) ram40_upper ( 15 | .WADDR(8'b0), 16 | .RADDR(8'b0), 17 | .MASK(~16'b0), 18 | .WDATA(8'b0), 19 | .RDATA(t1[i]), 20 | .WE(1'b1), 21 | .WCLKE(1'b1), 22 | .WCLK(clk[i]), 23 | .RE(1'b1), 24 | .RCLKE(1'b1), 25 | .RCLK(clk[i]) 26 | ); 27 | 28 | SB_RAM40_4K #( 29 | .READ_MODE(0), 30 | .WRITE_MODE(0) 31 | ) ram40_lower ( 32 | .WADDR(8'b0), 33 | .RADDR(8'b0), 34 | .MASK(~16'b0), 35 | .WDATA(8'b0), 36 | .RDATA(t2[i]), 37 | .WE(1'b1), 38 | .WCLKE(1'b1), 39 | .WCLK(clk[i]), 40 | .RE(1'b1), 41 | .RCLKE(1'b1), 42 | .RCLK(clk[i]) 43 | ); 44 | 45 | SB_DFF dff ( 46 | .C(clk[i]), 47 | .D(t1[i] ^ t2[i]), 48 | .Q(t3[i]) 49 | ); 50 | 51 | SB_IO #( 52 | .PIN_TYPE(6'b 0101_01) 53 | ) out ( 54 | .PACKAGE_PIN(y[i]), 55 | .OUTPUT_CLK(clk[i]), 56 | .D_OUT_0(t3[i]) 57 | ); 58 | end endgenerate 59 | endmodule 60 | -------------------------------------------------------------------------------- /icefuzz/tests/cross_0.pcf: -------------------------------------------------------------------------------- 1 | 2 | # row 14, block 0 3 | set_io in_left 2 4 | set_io out_right 104 5 | 6 | # row 4, block 0 7 | set_io out_left 29 8 | set_io in_right 79 9 | 10 | # col 4, block 0 11 | set_io in_bottom 44 12 | set_io out_top 137 13 | 14 | # col 8, block 0 15 | set_io out_bottom 58 16 | set_io in_top 121 17 | 18 | -------------------------------------------------------------------------------- /icefuzz/tests/cross_0.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input in_left, in_right, in_top, in_bottom, 3 | output out_left, out_right, out_top, out_bottom 4 | ); 5 | assign out_left = in_right; 6 | assign out_right = in_left; 7 | assign out_top = in_bottom; 8 | assign out_bottom = in_top; 9 | endmodule 10 | -------------------------------------------------------------------------------- /icefuzz/tests/dsp_cbit/.gitignore: -------------------------------------------------------------------------------- 1 | work_dsp_cbit/ 2 | -------------------------------------------------------------------------------- /icefuzz/tests/dsp_cbit/dsp_cbits_up5k.txt: -------------------------------------------------------------------------------- 1 | DSP (0, 15): 2 | Missing (0, 16, CBIT_1) 3 | Missing (0, 16, CBIT_2) 4 | Missing (0, 16, CBIT_3) 5 | Missing (0, 16, CBIT_4) 6 | New: (0, 19, CBIT_3) 7 | New: (0, 19, CBIT_5) 8 | New: (0, 19, CBIT_4) 9 | New: (0, 19, CBIT_6) 10 | -------------------------------------------------------------------------------- /icefuzz/tests/example_hx8kboard.pcf: -------------------------------------------------------------------------------- 1 | set_io LED0 B5 2 | set_io LED1 B4 3 | set_io LED2 A2 4 | set_io LED3 A1 5 | set_io LED4 C5 6 | set_io LED5 C4 7 | set_io LED6 B3 8 | set_io LED7 C3 9 | set_io clk J3 10 | -------------------------------------------------------------------------------- /icefuzz/tests/example_hx8kboard.sdc: -------------------------------------------------------------------------------- 1 | create_clock -period 10.00 -name {top|clk} [get_ports {clk}] 2 | -------------------------------------------------------------------------------- /icefuzz/tests/example_hx8kboard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ICEDEV=hx8k-ct256 bash ../icecube.sh example_hx8kboard.v 3 | -------------------------------------------------------------------------------- /icefuzz/tests/example_hx8kboard.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED0, 4 | output LED1, 5 | output LED2, 6 | output LED3, 7 | output LED4, 8 | output LED5, 9 | output LED6, 10 | output LED7 11 | ); 12 | reg [31:0] counter = 0; 13 | wire [7:0] raddr = counter >> 22; 14 | always @(posedge clk) counter <= counter + 1; 15 | 16 | // Python 3 code for memory initialization: 17 | // 18 | // queue = list() 19 | // for i in range(256): 20 | // queue.append("%04x" % (i ^ (i >> 1))) 21 | // if i % 16 == 15: 22 | // print("256'h%s" % "".join(reversed(queue))) 23 | // queue = list() 24 | 25 | SB_RAM40_4K #( 26 | .READ_MODE(0), 27 | .WRITE_MODE(0), 28 | .INIT_0(256'h00080009000b000a000e000f000d000c00040005000700060002000300010000), 29 | .INIT_1(256'h00100011001300120016001700150014001c001d001f001e001a001b00190018), 30 | .INIT_2(256'h00380039003b003a003e003f003d003c00340035003700360032003300310030), 31 | .INIT_3(256'h00200021002300220026002700250024002c002d002f002e002a002b00290028), 32 | .INIT_4(256'h00680069006b006a006e006f006d006c00640065006700660062006300610060), 33 | .INIT_5(256'h00700071007300720076007700750074007c007d007f007e007a007b00790078), 34 | .INIT_6(256'h00580059005b005a005e005f005d005c00540055005700560052005300510050), 35 | .INIT_7(256'h00400041004300420046004700450044004c004d004f004e004a004b00490048), 36 | .INIT_8(256'h00c800c900cb00ca00ce00cf00cd00cc00c400c500c700c600c200c300c100c0), 37 | .INIT_9(256'h00d000d100d300d200d600d700d500d400dc00dd00df00de00da00db00d900d8), 38 | .INIT_A(256'h00f800f900fb00fa00fe00ff00fd00fc00f400f500f700f600f200f300f100f0), 39 | .INIT_B(256'h00e000e100e300e200e600e700e500e400ec00ed00ef00ee00ea00eb00e900e8), 40 | .INIT_C(256'h00a800a900ab00aa00ae00af00ad00ac00a400a500a700a600a200a300a100a0), 41 | .INIT_D(256'h00b000b100b300b200b600b700b500b400bc00bd00bf00be00ba00bb00b900b8), 42 | .INIT_E(256'h00980099009b009a009e009f009d009c00940095009700960092009300910090), 43 | .INIT_F(256'h00800081008300820086008700850084008c008d008f008e008a008b00890088) 44 | ) ram ( 45 | .RADDR(raddr), 46 | .RDATA({LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7}), 47 | .RE(1'b1), 48 | .RCLKE(1'b1), 49 | .RCLK(clk) 50 | ); 51 | endmodule 52 | -------------------------------------------------------------------------------- /icefuzz/tests/example_icestick.pcf: -------------------------------------------------------------------------------- 1 | set_io LED1 99 2 | set_io LED2 98 3 | set_io LED3 97 4 | set_io LED4 96 5 | set_io LED5 95 6 | set_io clk 21 7 | -------------------------------------------------------------------------------- /icefuzz/tests/example_icestick.sdc: -------------------------------------------------------------------------------- 1 | create_clock -period 10.00 -name {top|clk} [get_ports {clk}] 2 | -------------------------------------------------------------------------------- /icefuzz/tests/example_icestick.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bash ../icecube.sh example_icestick.v 3 | -------------------------------------------------------------------------------- /icefuzz/tests/example_icestick.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clk, 3 | output LED1, 4 | output LED2, 5 | output LED3, 6 | output LED4, 7 | output LED5 8 | ); 9 | 10 | localparam BITS = 5; 11 | localparam LOG2DELAY = 22; 12 | 13 | function [BITS-1:0] bin2gray(input [BITS-1:0] in); 14 | integer i; 15 | reg [BITS:0] temp; 16 | begin 17 | temp = in; 18 | for (i=0; i> LOG2DELAY); 29 | endmodule 30 | -------------------------------------------------------------------------------- /icefuzz/tests/glb-u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p glb_u4k.work 6 | cd glb_u4k.work 7 | 8 | glb_pins="20 35 37 44" 9 | 10 | for gpin in $glb_pins; do 11 | pf="glb_u4k_pin_$gpin" 12 | cat > ${pf}.v <<- EOT 13 | module top (input clk, data, output pin); 14 | wire gc; 15 | SB_GB_IO #( 16 | .PIN_TYPE(6'b 0000_00), 17 | .PULLUP(1'b0), 18 | .NEG_TRIGGER(1'b0), 19 | .IO_STANDARD("SB_LVCMOS") 20 | ) gbuf ( 21 | .PACKAGE_PIN(clk), 22 | .GLOBAL_BUFFER_OUTPUT(gc) 23 | ); 24 | SB_IO #( 25 | .PIN_TYPE(6'b 0101_00) 26 | ) pin_obuf ( 27 | .PACKAGE_PIN(pin), 28 | .OUTPUT_CLK(gc), 29 | .D_OUT_0(data) 30 | ); 31 | endmodule 32 | EOT 33 | echo "set_io clk $gpin" > ${pf}.pcf 34 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 35 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 36 | rm -rf ${pf}.tmp 37 | done 38 | 39 | oscs="HF LF" 40 | 41 | for osc in $oscs; do 42 | pf="glb_u4k_${osc}" 43 | cat > ${pf}.v <<- EOT 44 | module top (input data, output pin); 45 | wire clk; 46 | SB_${osc}OSC osc( 47 | .CLK${osc}PU(1'b1), 48 | .CLK${osc}EN(1'b1), 49 | .CLK${osc}(clk) 50 | ); 51 | SB_IO #( 52 | .PIN_TYPE(6'b 0101_00) 53 | ) pin_obuf ( 54 | .PACKAGE_PIN(pin), 55 | .OUTPUT_CLK(clk), 56 | .D_OUT_0(data) 57 | ); 58 | endmodule 59 | EOT 60 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 61 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 62 | rm -rf ${pf}.tmp 63 | done 64 | 65 | pf="glb_u4k_gbufin" 66 | cat > ${pf}.v <<- EOT 67 | module top (input [7:0] clk, data, output [7:0] pin); 68 | wire [7:0] gc; 69 | SB_GB gbufin[7:0] ( 70 | .USER_SIGNAL_TO_GLOBAL_BUFFER(clk), 71 | .GLOBAL_BUFFER_OUTPUT(gc) 72 | ); 73 | SB_IO #( 74 | .PIN_TYPE(6'b 0101_00) 75 | ) pin_obuf[7:0] ( 76 | .PACKAGE_PIN(pin), 77 | .OUTPUT_CLK(gc), 78 | .D_OUT_0(data) 79 | ); 80 | endmodule 81 | EOT 82 | # echo "set_io clk 10" > ${pf}.pcf 83 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 84 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 85 | rm -rf ${pf}.tmp 86 | -------------------------------------------------------------------------------- /icefuzz/tests/icegate.pcf: -------------------------------------------------------------------------------- 1 | set_io din_0 33 2 | set_io global 97 3 | set_io latch_in 112 4 | set_io pin_gb_io 0 9 0 5 | -------------------------------------------------------------------------------- /icefuzz/tests/icegate.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | inout pin, 3 | input latch_in, 4 | output din_0, 5 | output global 6 | ); 7 | SB_GB_IO #( 8 | .PIN_TYPE(6'b 0000_11), 9 | .PULLUP(1'b 0), 10 | .NEG_TRIGGER(1'b 0), 11 | .IO_STANDARD("SB_LVCMOS") 12 | ) \pin_gb_io ( 13 | .PACKAGE_PIN(pin), 14 | .LATCH_INPUT_VALUE(latch_in), 15 | .D_IN_0(din_0), 16 | .GLOBAL_BUFFER_OUTPUT(globals) 17 | ); 18 | endmodule 19 | -------------------------------------------------------------------------------- /icefuzz/tests/intosc.pcf: -------------------------------------------------------------------------------- 1 | set_io clkhfpu 2 2 | set_io clkhfen 3 3 | set_io clkhf 4 4 | -------------------------------------------------------------------------------- /icefuzz/tests/intosc.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input clkhfpu, 3 | input clkhfen, 4 | output clkhf 5 | ); 6 | SB_HFOSC #( 7 | 8 | .CLKHF_DIV("0b10") 9 | ) hfosc ( 10 | .CLKHFPU(clkhfpu), 11 | .CLKHFEN(clkhfen), 12 | .CLKHF(clkhf) 13 | ); 14 | endmodule 15 | -------------------------------------------------------------------------------- /icefuzz/tests/io_glb_netwk.pcf: -------------------------------------------------------------------------------- 1 | set_io in 1 2 | set_io out 2 3 | set_io pin[0] 20 # padin_4 4 | set_io pin[1] 21 # padin_1 5 | set_io pin[2] 49 # padin_6 6 | set_io pin[3] 50 # padin_3 7 | set_io pin[4] 93 # padin_0 8 | set_io pin[5] 94 # padin_5 9 | set_io pin[6] 128 # padin_2 10 | set_io pin[7] 129 # padin_7 11 | -------------------------------------------------------------------------------- /icefuzz/tests/io_glb_netwk.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | inout [7:0] pin, 3 | input in, 4 | output out 5 | ); 6 | wire [7:0] glbl, clk; 7 | reg [7:0] q; 8 | 9 | SB_GB_IO #( 10 | .PIN_TYPE(6'b 0000_11), 11 | .PULLUP(1'b0), 12 | .NEG_TRIGGER(1'b0), 13 | .IO_STANDARD("SB_LVCMOS") 14 | ) PIO[7:0] ( 15 | .PACKAGE_PIN(pin), 16 | .LATCH_INPUT_VALUE(1'b1), 17 | .CLOCK_ENABLE(), 18 | .INPUT_CLK(), 19 | .OUTPUT_CLK(), 20 | .OUTPUT_ENABLE(), 21 | .D_OUT_0(), 22 | .D_OUT_1(), 23 | .D_IN_0(), 24 | .D_IN_1(), 25 | .GLOBAL_BUFFER_OUTPUT(glbl) 26 | ); 27 | 28 | assign clk[0] = glbl[0]; // glb_netwk_4 29 | assign clk[1] = glbl[1]; // glb_netwk_1 30 | assign clk[2] = glbl[2]; // glb_netwk_6 31 | assign clk[3] = glbl[3]; // glb_netwk_3 32 | assign clk[4] = glbl[4]; // glb_netwk_0 33 | assign clk[5] = glbl[5]; // glb_netwk_5 34 | assign clk[6] = glbl[6]; // glb_netwk_2 35 | assign clk[7] = glbl[7]; // glb_netwk_7 36 | 37 | genvar i; 38 | generate for (i = 0; i < 8; i=i+1) begin 39 | always @(posedge clk[i]) q[i] <= in; 40 | end endgenerate 41 | assign out = ^{q, in}; 42 | endmodule 43 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p io_latched.work 6 | cd io_latched.work 7 | 8 | pins=" 9 | 1 2 3 4 7 8 9 10 11 12 19 22 23 24 25 26 28 29 31 32 33 34 10 | 37 38 41 42 43 44 45 47 48 52 56 58 60 61 62 63 64 11 | 73 74 75 76 78 79 80 81 87 88 90 91 95 96 97 98 101 102 104 105 106 107 12 | 112 113 114 115 116 117 118 119 120 121 122 134 135 136 137 138 139 141 142 143 144 13 | " 14 | pins="$( echo $pins )" 15 | 16 | for pin in $pins; do 17 | pf="io_latched_$pin" 18 | cp ../io_latched.v ${pf}.v 19 | read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) 20 | { 21 | echo "set_io pin $pin" 22 | echo "set_io latch_in $pin_latch" 23 | echo "set_io data_out $pin_data" 24 | } > ${pf}.pcf 25 | bash ../../icecube.sh ${pf}.v 26 | ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve 27 | done 28 | 29 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | inout pin, 3 | input latch_in, 4 | output data_out 5 | ); 6 | SB_IO #( 7 | .PIN_TYPE(6'b0000_11), 8 | .PULLUP(1'b0), 9 | .NEG_TRIGGER(1'b0), 10 | .IO_STANDARD("SB_LVCMOS") 11 | ) pin_ibuf ( 12 | .PACKAGE_PIN(pin), 13 | .LATCH_INPUT_VALUE(latch_in), 14 | .CLOCK_ENABLE(), 15 | .INPUT_CLK(), 16 | .OUTPUT_CLK(), 17 | .OUTPUT_ENABLE(), 18 | .D_OUT_0(), 19 | .D_OUT_1(), 20 | .D_IN_0(data_out), 21 | .D_IN_1() 22 | ); 23 | endmodule 24 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched_384.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p io_latched_384.work 6 | cd io_latched_384.work 7 | 8 | pins=" 9 | A1 A2 A3 A4 A5 A6 A7 10 | B1 B2 B3 B4 11 | C1 C2 C4 C5 C6 C7 12 | D1 D2 D3 D4 D6 D7 13 | E2 E6 E7 14 | F1 F2 F3 F4 F5 F6 F7 15 | G1 G3 G4 G6 16 | " 17 | pins="$( echo $pins )" 18 | 19 | for pin in $pins; do 20 | pf="io_latched_384_$pin" 21 | cp ../io_latched.v ${pf}.v 22 | read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) 23 | { 24 | echo "set_io pin $pin" 25 | echo "set_io latch_in $pin_latch" 26 | echo "set_io data_out $pin_data" 27 | } > ${pf}.pcf 28 | ICEDEV=lp384-cm49 bash ../../icecube.sh ${pf}.v 29 | ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve 30 | done 31 | 32 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p io_latched_5k.work 6 | cd io_latched_5k.work 7 | 8 | pins=" 9 | 2 3 4 6 9 10 11 12 10 | 13 18 19 20 21 23 11 | 25 26 27 28 31 32 34 35 36 12 | 37 38 42 43 44 45 46 47 48 13 | " 14 | pins="$( echo $pins )" 15 | 16 | for pin in $pins ; do 17 | pf="io_latched_$pin" 18 | cp ../io_latched.v ${pf}.v 19 | read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) 20 | { 21 | echo "set_io pin $pin" 22 | echo "set_io latch_in $pin_latch" 23 | echo "set_io data_out $pin_data" 24 | } > ${pf}.pcf 25 | ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v 26 | ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve 27 | done 28 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched_lm4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p io_latched_lm4k.work 6 | cd io_latched_lm4k.work 7 | 8 | pins=" 9 | A1 A2 A3 A4 A5 A6 A7 10 | B1 B2 B4 B6 B7 11 | C1 C3 C4 C6 C7 12 | D1 D2 D3 D6 D7 13 | E1 E2 E3 E4 E5 E7 14 | F2 F3 F4 F7 15 | G3 16 | " 17 | pins="$( echo $pins )" 18 | 19 | for pin in $pins; do 20 | pf="io_latched_$pin" 21 | cp ../io_latched.v ${pf}.v 22 | read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) 23 | { 24 | echo "set_io pin $pin" 25 | echo "set_io latch_in $pin_latch" 26 | echo "set_io data_out $pin_data" 27 | } > ${pf}.pcf 28 | ICEDEV=lm4k-cm49 bash ../../icecube.sh ${pf}.v 29 | ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve 30 | done 31 | 32 | -------------------------------------------------------------------------------- /icefuzz/tests/io_latched_u4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p io_latched_u4k.work 6 | cd io_latched_u4k.work 7 | 8 | pins=" 9 | 2 3 4 6 9 10 11 12 10 | 13 18 19 20 21 23 11 | 25 26 27 28 31 32 34 35 36 12 | 37 38 42 43 44 45 46 47 48 13 | " 14 | pins="$( echo $pins )" 15 | 16 | for pin in $pins ; do 17 | pf="io_latched_$pin" 18 | cp ../io_latched.v ${pf}.v 19 | read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) 20 | { 21 | echo "set_io pin $pin" 22 | echo "set_io latch_in $pin_latch" 23 | echo "set_io data_out $pin_data" 24 | } > ${pf}.pcf 25 | ICEDEV=u4k-sg48 bash ../../icecube.sh ${pf}.v 26 | ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve 27 | done 28 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | for line in fileinput.input(): 6 | line = line.split() 7 | if len(line) == 0: 8 | continue 9 | if line[0] == ".io_tile": 10 | current_tile = (int(line[1]), int(line[2])) 11 | if line[0] == "IoCtrl" and line[1] == "REN_0": 12 | ren = (current_tile[0], current_tile[1], 0) 13 | if line[0] == "IoCtrl" and line[1] == "REN_1": 14 | ren = (current_tile[0], current_tile[1], 1) 15 | if line[0] == "IOB_0": 16 | iob = (current_tile[0], current_tile[1], 0) 17 | if line[0] == "IOB_1": 18 | iob = (current_tile[0], current_tile[1], 1) 19 | 20 | print("(%2d, %2d, %2d, %2d, %2d, %2d)," % (iob[0], iob[1], iob[2], ren[0], ren[1], ren[2])) 21 | 22 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p ioctrl.work 6 | cd ioctrl.work 7 | 8 | pins=" 9 | 1 2 3 4 7 8 9 10 11 12 19 20 21 22 23 24 25 26 28 29 31 32 33 34 10 | 37 38 39 41 42 43 44 45 47 48 49 50 52 56 58 60 61 62 63 64 67 68 70 71 11 | 73 74 75 76 78 79 80 81 87 88 90 91 93 94 95 96 97 98 99 101 102 104 105 106 107 12 | 112 113 114 115 116 117 118 119 120 121 122 128 129 134 135 136 137 138 139 141 142 143 144 13 | " 14 | pins="$( echo $pins )" 15 | 16 | for pin in $pins; do 17 | pf="ioctrl_$pin" 18 | echo "module top (output pin); assign pin = 1; endmodule" > ${pf}.v 19 | echo "set_io pin $pin" > ${pf}.pcf 20 | bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 21 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 22 | done 23 | 24 | set +x 25 | echo "--snip--" 26 | for pin in $pins; do 27 | python3 ../ioctrl.py ioctrl_${pin}.exp 28 | done | tee ioctrl_db.txt 29 | echo "--snap--" 30 | 31 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_384.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | ren = None 6 | 7 | for line in fileinput.input(): 8 | line = line.split() 9 | if len(line) == 0: 10 | continue 11 | if line[0] == ".io_tile": 12 | current_tile = (int(line[1]), int(line[2])) 13 | if line[0] == "IoCtrl" and line[1] == "REN_0": 14 | ren = (current_tile[0], current_tile[1], 0) 15 | if line[0] == "IoCtrl" and line[1] == "REN_1": 16 | ren = (current_tile[0], current_tile[1], 1) 17 | if line[0] == "IOB_0": 18 | iob = (current_tile[0], current_tile[1], 0) 19 | if line[0] == "IOB_1": 20 | iob = (current_tile[0], current_tile[1], 1) 21 | 22 | if ren is None: 23 | print("(%2d, %2d, %2d, ? , ? , ? )," % (iob[0], iob[1], iob[2])) 24 | else: 25 | print("(%2d, %2d, %2d, %2d, %2d, %2d)," % (iob[0], iob[1], iob[2], ren[0], ren[1], ren[2])) 26 | 27 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_384.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p ioctrl_384.work 6 | cd ioctrl_384.work 7 | 8 | pins=" 9 | A1 A2 A3 A4 A5 A6 A7 10 | B1 B2 B3 B4 11 | C1 C2 C4 C5 C6 C7 12 | D1 D2 D3 D4 D6 D7 13 | E2 E6 E7 14 | F1 F2 F3 F4 F5 F6 F7 15 | G1 G3 G4 G6 16 | " 17 | pins="$( echo $pins )" 18 | 19 | for pin in $pins; do 20 | pf="ioctrl_384_$pin" 21 | echo "module top (output pin); assign pin = 1; endmodule" > ${pf}.v 22 | echo "set_io pin $pin" > ${pf}.pcf 23 | ICEDEV=lp384-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 24 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 25 | done 26 | 27 | set +x 28 | echo "--snip--" 29 | for pin in $pins; do 30 | python3 ../ioctrl_384.py ioctrl_384_${pin}.exp 31 | done | tee ioctrl_384_db.txt 32 | echo "--snap--" 33 | 34 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_5k.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | for line in fileinput.input(): 6 | line = line.split() 7 | if len(line) == 0: 8 | continue 9 | if line[0] == ".io_tile": 10 | current_tile = (int(line[1]), int(line[2])) 11 | if line[0] == "IoCtrl" and line[1] == "REN_0": 12 | ren = (current_tile[0], current_tile[1], 0) 13 | if line[0] == "IoCtrl" and line[1] == "REN_1": 14 | ren = (current_tile[0], current_tile[1], 1) 15 | if line[0] == "IOB_0": 16 | iob = (current_tile[0], current_tile[1], 0) 17 | if line[0] == "IOB_1": 18 | iob = (current_tile[0], current_tile[1], 1) 19 | 20 | print("(%2d, %2d, %2d, %2d, %2d, %2d)," % (iob[0], iob[1], iob[2], ren[0], ren[1], ren[2])) 21 | 22 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_5k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p ioctrl.work 6 | cd ioctrl.work 7 | 8 | pins="2 3 4 6 9 10 11 12 9 | 13 14 15 16 17 18 19 20 21 23 10 | 25 26 27 28 31 32 34 35 36 11 | 37 38 42 43 44 45 46 47 48 12 | " 13 | pins="$( echo $pins )" 14 | 15 | for pin in $pins; do 16 | pf="ioctrl_$pin" 17 | echo "module top (output pin); assign pin = 1; endmodule" > ${pf}.v 18 | echo "set_io pin $pin" > ${pf}.pcf 19 | bash ../../icecube.sh -up5k ${pf}.v > ${pf}.log 2>&1 20 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 21 | done 22 | 23 | set +x 24 | echo "--snip--" 25 | for pin in $pins; do 26 | python3 ../ioctrl_5k.py ioctrl_${pin}.exp 27 | done | tee ioctrl_db.txt 28 | echo "--snap--" 29 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_lm4k.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fileinput 4 | 5 | for line in fileinput.input(): 6 | line = line.split() 7 | if len(line) == 0: 8 | continue 9 | if line[0] == ".io_tile": 10 | current_tile = (int(line[1]), int(line[2])) 11 | if line[0] == "IoCtrl" and line[1] == "REN_0": 12 | ren = (current_tile[0], current_tile[1], 0) 13 | if line[0] == "IoCtrl" and line[1] == "REN_1": 14 | ren = (current_tile[0], current_tile[1], 1) 15 | if line[0] == "IOB_0": 16 | iob = (current_tile[0], current_tile[1], 0) 17 | if line[0] == "IOB_1": 18 | iob = (current_tile[0], current_tile[1], 1) 19 | 20 | print("(%2d, %2d, %2d, %2d, %2d, %2d)," % (iob[0], iob[1], iob[2], ren[0], ren[1], ren[2])) 21 | 22 | -------------------------------------------------------------------------------- /icefuzz/tests/ioctrl_lm4k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | mkdir -p ioctrl.work 6 | cd ioctrl.work 7 | 8 | pins=" 9 | A1 A2 A3 A4 A5 A6 A7 10 | B1 B2 B4 B6 B7 11 | C1 C3 C4 C6 C7 12 | D1 D2 D3 D6 D7 13 | E1 E2 E3 E4 E5 E6 E7 14 | F2 F3 F4 F5 F6 F7 15 | G3 G6 16 | " 17 | 18 | pins="$( echo $pins )" 19 | 20 | for pin in $pins; do 21 | pf="ioctrl_$pin" 22 | echo "module top (output pin); assign pin = 1; endmodule" > ${pf}.v 23 | echo "set_io pin $pin" > ${pf}.pcf 24 | bash ../../icecube.sh -lm4k ${pf}.v > ${pf}.log 2>&1 25 | ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp 26 | done 27 | 28 | set +x 29 | echo "--snip--" 30 | for pin in $pins; do 31 | python3 ../ioctrl_5k.py ioctrl_${pin}.exp 32 | done | tee ioctrl_db.txt 33 | echo "--snap--" 34 | -------------------------------------------------------------------------------- /icefuzz/tests/ip/.gitignore: -------------------------------------------------------------------------------- 1 | work_ip/ 2 | *.html 3 | -------------------------------------------------------------------------------- /icefuzz/tests/ip/make_html_table.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import ast, sys 3 | 4 | data = "" 5 | with open(sys.argv[1], 'r') as f: 6 | data = f.read() 7 | 8 | ip_dat = ast.literal_eval("{\n" + data + "}") 9 | 10 | def is_cbit(ident): 11 | if "_ENABLE" in ident or "DELAYED" in ident: 12 | return True 13 | else: 14 | return False 15 | 16 | def is_bus(ident): 17 | return ident.startswith("SB") 18 | 19 | ips = sorted(ip_dat) 20 | print ("\n", end='') 21 | for ip in ips: 22 | t, loc = ip 23 | x, y, z = loc 24 | print("" % (t, x, y, z), end='') 25 | print ("") 26 | 27 | # TODO: could group busses? 28 | for print_t in ["SB", "G", "CBIT"]: 29 | for n in sorted(ip_dat[ips[0]]): 30 | if is_bus(n) != (print_t == "SB"): 31 | continue 32 | if is_cbit(n) != (print_t == "CBIT"): 33 | continue 34 | print("", end='') 35 | em_o = "" 36 | em_c = "" 37 | if is_cbit(n): 38 | em_o = "" 39 | em_c = "" 40 | print("" % (em_o, n, em_c), end='') 41 | for ip in ips: 42 | entry = ip_dat[ip][n] 43 | x, y, name = entry 44 | print("" % (em_o, x, y, name, em_c), end='') 45 | print("") 46 | print ("
Signal%s
(%d, %d, %d)
%s%s%s%s(%d, %d, %s)%s
") 47 | -------------------------------------------------------------------------------- /icefuzz/tests/ip/up5k_LEDDA_IP_data.txt: -------------------------------------------------------------------------------- 1 | ("LEDDA_IP", (0, 31, 2)): { 2 | "LEDDADDR0": (0, 28, "lutff_4/in_0"), 3 | "LEDDADDR1": (0, 28, "lutff_5/in_0"), 4 | "LEDDADDR2": (0, 28, "lutff_6/in_0"), 5 | "LEDDADDR3": (0, 28, "lutff_7/in_0"), 6 | "LEDDCLK": (0, 29, "clk"), 7 | "LEDDCS": (0, 28, "lutff_2/in_0"), 8 | "LEDDDAT0": (0, 28, "lutff_2/in_1"), 9 | "LEDDDAT1": (0, 28, "lutff_3/in_1"), 10 | "LEDDDAT2": (0, 28, "lutff_4/in_1"), 11 | "LEDDDAT3": (0, 28, "lutff_5/in_1"), 12 | "LEDDDAT4": (0, 28, "lutff_6/in_1"), 13 | "LEDDDAT5": (0, 28, "lutff_7/in_1"), 14 | "LEDDDAT6": (0, 28, "lutff_0/in_0"), 15 | "LEDDDAT7": (0, 28, "lutff_1/in_0"), 16 | "LEDDDEN": (0, 28, "lutff_1/in_1"), 17 | "LEDDEXE": (0, 28, "lutff_0/in_1"), 18 | "LEDDON": (0, 29, "slf_op_0"), 19 | "PWMOUT0": (0, 28, "slf_op_4"), 20 | "PWMOUT1": (0, 28, "slf_op_5"), 21 | "PWMOUT2": (0, 28, "slf_op_6"), 22 | }, 23 | -------------------------------------------------------------------------------- /icefuzz/tests/lut_cascade.pcf: -------------------------------------------------------------------------------- 1 | set_location dst_lut 6 8 2 # SB_LUT4 (LogicCell: dst_lut_LC_0) 2 | set_location src_lut 6 8 1 # SB_LUT4 (LogicCell: src_lut_LC_1) 3 | -------------------------------------------------------------------------------- /icefuzz/tests/lut_cascade.v: -------------------------------------------------------------------------------- 1 | module top (input a, b, c, d, e, f, g, output y); 2 | wire cascade; 3 | 4 | SB_LUT4 #( 5 | .LUT_INIT(16'b 1100_1100_1100_1010) 6 | ) src_lut ( 7 | .O(cascade), 8 | .I0(a), 9 | .I1(b), 10 | .I2(c), 11 | .I3(d) 12 | ); 13 | 14 | SB_LUT4 #( 15 | .LUT_INIT(16'b 1000_0100_0010_0001) 16 | ) dst_lut ( 17 | .O(y), 18 | .I0(e), 19 | .I1(f), 20 | .I2(cascade), 21 | .I3(g) 22 | ); 23 | endmodule 24 | -------------------------------------------------------------------------------- /icefuzz/tests/osc/osc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os, sys 4 | 5 | device = "u4k" 6 | 7 | if not os.path.exists("./work_osc"): 8 | os.mkdir("./work_osc") 9 | 10 | def run(route_fabric): 11 | name = "./work_osc/osc_cbit_fabric_%d" % route_fabric 12 | with open(name+'.v',"w") as f: 13 | print(""" 14 | module top( 15 | input clkhfpu, 16 | input clkhfen, 17 | input clklfpu, 18 | input clklfen, 19 | output pin, 20 | output pin2, 21 | input data 22 | ); 23 | 24 | wire clkhf; 25 | SB_HFOSC #( 26 | .CLKHF_DIV("%s") 27 | ) hfosc ( 28 | .CLKHFPU(clkhfpu), 29 | .CLKHFEN(clkhfen), 30 | .CLKHF(clkhf) 31 | ); /* synthesis ROUTE_THROUGH_FABRIC = %d */ 32 | 33 | SB_IO #( 34 | .PIN_TYPE(6'b 0101_00) 35 | ) pin_obuf ( 36 | .PACKAGE_PIN(pin), 37 | .OUTPUT_CLK(clkhf), 38 | .D_OUT_0(data) 39 | ); 40 | 41 | wire clklf; 42 | SB_LFOSC lfosc ( 43 | .CLKLFPU(clklfpu), 44 | .CLKLFEN(clklfen), 45 | .CLKLF(clklf) 46 | ); /* synthesis ROUTE_THROUGH_FABRIC = %d */ 47 | 48 | SB_IO #( 49 | .PIN_TYPE(6'b 0101_00) 50 | ) pin2_obuf ( 51 | .PACKAGE_PIN(pin2), 52 | .OUTPUT_CLK(clklf), 53 | .D_OUT_0(data) 54 | ); 55 | 56 | endmodule 57 | """ % ( 58 | "0b11", route_fabric, route_fabric 59 | ), file=f) 60 | 61 | retval = os.system("bash ../../icecube.sh -" + device + " " + name+".v > ./work_osc/icecube.log 2>&1") 62 | if retval != 0: 63 | sys.stderr.write('ERROR: icecube returned non-zero error code\n') 64 | sys.exit(1) 65 | retval = os.system("../../../icebox/icebox_explain.py " + name+".asc > " + name+".exp") 66 | if retval != 0: 67 | sys.stderr.write('ERROR: icebox_explain returned non-zero error code\n') 68 | sys.exit(1) 69 | retval = os.system("../../../icebox/icebox_vlog.py " + name+".asc > " + name+".ve") 70 | if retval != 0: 71 | sys.stderr.write('ERROR: icebox_vlog returned non-zero error code\n') 72 | sys.exit(1) 73 | 74 | run(0) 75 | run(1) 76 | -------------------------------------------------------------------------------- /icefuzz/tests/pllauto/.gitignore: -------------------------------------------------------------------------------- 1 | work_pllauto/ -------------------------------------------------------------------------------- /icefuzz/tests/pllauto/pll_data_up5k.txt: -------------------------------------------------------------------------------- 1 | "PLLTYPE_1": (14, 31, "PLLCONFIG_1"), 2 | "PLLTYPE_2": (14, 31, "PLLCONFIG_3"), 3 | "PLLTYPE_0": (12, 31, "PLLCONFIG_5"), 4 | "FEEDBACK_PATH_0": (14, 31, "PLLCONFIG_5"), 5 | "FEEDBACK_PATH_1": (11, 31, "PLLCONFIG_9"), 6 | "FEEDBACK_PATH_2": (12, 31, "PLLCONFIG_1"), 7 | "PLLOUT_SELECT_A_0": (12, 31, "PLLCONFIG_6"), 8 | "PLLOUT_SELECT_A_1": (12, 31, "PLLCONFIG_7"), 9 | "PLLOUT_SELECT_B_0": (12, 31, "PLLCONFIG_2"), 10 | "PLLOUT_SELECT_B_1": (12, 31, "PLLCONFIG_3"), 11 | "SHIFTREG_DIV_MODE": (12, 31, "PLLCONFIG_4"), 12 | "FDA_FEEDBACK_0": (12, 31, "PLLCONFIG_9"), 13 | "FDA_FEEDBACK_1": (13, 31, "PLLCONFIG_1"), 14 | "FDA_FEEDBACK_2": (13, 31, "PLLCONFIG_2"), 15 | "FDA_FEEDBACK_3": (13, 31, "PLLCONFIG_3"), 16 | "FDA_RELATIVE_0": (13, 31, "PLLCONFIG_5"), 17 | "FDA_RELATIVE_1": (13, 31, "PLLCONFIG_6"), 18 | "FDA_RELATIVE_2": (13, 31, "PLLCONFIG_7"), 19 | "FDA_RELATIVE_3": (13, 31, "PLLCONFIG_8"), 20 | "DIVR_0": (10, 31, "PLLCONFIG_1"), 21 | "DIVR_1": (10, 31, "PLLCONFIG_2"), 22 | "DIVR_2": (10, 31, "PLLCONFIG_3"), 23 | "DIVR_3": (10, 31, "PLLCONFIG_4"), 24 | "DIVF_0": (10, 31, "PLLCONFIG_5"), 25 | "DIVF_1": (10, 31, "PLLCONFIG_6"), 26 | "DIVF_2": (10, 31, "PLLCONFIG_7"), 27 | "DIVF_3": (10, 31, "PLLCONFIG_8"), 28 | "DIVF_4": (10, 31, "PLLCONFIG_9"), 29 | "DIVF_5": (11, 31, "PLLCONFIG_1"), 30 | "DIVF_6": (11, 31, "PLLCONFIG_2"), 31 | "DIVQ_0": (11, 31, "PLLCONFIG_3"), 32 | "DIVQ_1": (11, 31, "PLLCONFIG_4"), 33 | "DIVQ_2": (11, 31, "PLLCONFIG_5"), 34 | "FILTER_RANGE_0": (11, 31, "PLLCONFIG_6"), 35 | "FILTER_RANGE_1": (11, 31, "PLLCONFIG_7"), 36 | "FILTER_RANGE_2": (11, 31, "PLLCONFIG_8"), 37 | "TEST_MODE": (12, 31, "PLLCONFIG_8"), 38 | "DELAY_ADJMODE_FB": (13, 31, "PLLCONFIG_4"), 39 | "DELAY_ADJMODE_REL": (13, 31, "PLLCONFIG_9"), 40 | -------------------------------------------------------------------------------- /icefuzz/tests/raminits.pcf: -------------------------------------------------------------------------------- 1 | set_location ram_0301 3 1 2 | set_location ram_0303 3 3 3 | set_location ram_0305 3 5 4 | set_location ram_0307 3 7 5 | set_location ram_0309 3 9 6 | set_location ram_0311 3 11 7 | set_location ram_0313 3 13 8 | set_location ram_0315 3 15 9 | set_location ram_1001 10 1 10 | set_location ram_1003 10 3 11 | set_location ram_1005 10 5 12 | set_location ram_1007 10 7 13 | set_location ram_1009 10 9 14 | set_location ram_1011 10 11 15 | set_location ram_1013 10 13 16 | set_location ram_1015 10 15 17 | -------------------------------------------------------------------------------- /icefuzz/tests/rgb_drv_cbit/.gitignore: -------------------------------------------------------------------------------- 1 | work_rgb_drv/ 2 | -------------------------------------------------------------------------------- /icefuzz/tests/rgb_drv_cbit/rgb_drv_data_u4k.txt: -------------------------------------------------------------------------------- 1 | "RGB_DRV_EN": (0, 18, "CBIT_5"), 2 | "LED_DRV_CUR_EN": (25, 19, "CBIT_5"), 3 | "RGB0_CURRENT_0": (0, 18, "CBIT_6"), 4 | "RGB0_CURRENT_1": (0, 18, "CBIT_7"), 5 | "RGB0_CURRENT_2": (0, 19, "CBIT_0"), 6 | "RGB0_CURRENT_3": (0, 19, "CBIT_1"), 7 | "RGB0_CURRENT_4": (0, 19, "CBIT_2"), 8 | "RGB0_CURRENT_5": (0, 19, "CBIT_3"), 9 | "RGB1_CURRENT_0": (0, 19, "CBIT_4"), 10 | "RGB1_CURRENT_1": (0, 19, "CBIT_5"), 11 | "RGB1_CURRENT_2": (0, 19, "CBIT_6"), 12 | "RGB1_CURRENT_3": (0, 19, "CBIT_7"), 13 | "RGB1_CURRENT_4": (0, 20, "CBIT_0"), 14 | "RGB1_CURRENT_5": (0, 20, "CBIT_1"), 15 | "RGB2_CURRENT_0": (0, 20, "CBIT_2"), 16 | "RGB2_CURRENT_1": (0, 20, "CBIT_3"), 17 | "RGB2_CURRENT_2": (0, 20, "CBIT_4"), 18 | "RGB2_CURRENT_3": (0, 20, "CBIT_5"), 19 | "RGB2_CURRENT_4": (0, 20, "CBIT_6"), 20 | "RGB2_CURRENT_5": (0, 20, "CBIT_7"), 21 | -------------------------------------------------------------------------------- /icefuzz/tests/rgba_drv_cbit/.gitignore: -------------------------------------------------------------------------------- 1 | work_rgba_drv/ 2 | -------------------------------------------------------------------------------- /icefuzz/tests/rgba_drv_cbit/rgba_drv_data_up5k.txt: -------------------------------------------------------------------------------- 1 | "RGBA_DRV_EN": (0, 28, "CBIT_5"), 2 | "RGB0_CURRENT_0": (0, 28, "CBIT_6"), 3 | "RGB0_CURRENT_1": (0, 28, "CBIT_7"), 4 | "RGB0_CURRENT_2": (0, 29, "CBIT_0"), 5 | "RGB0_CURRENT_3": (0, 29, "CBIT_1"), 6 | "RGB0_CURRENT_4": (0, 29, "CBIT_2"), 7 | "RGB0_CURRENT_5": (0, 29, "CBIT_3"), 8 | "RGB1_CURRENT_0": (0, 29, "CBIT_4"), 9 | "RGB1_CURRENT_1": (0, 29, "CBIT_5"), 10 | "RGB1_CURRENT_2": (0, 29, "CBIT_6"), 11 | "RGB1_CURRENT_3": (0, 29, "CBIT_7"), 12 | "RGB1_CURRENT_4": (0, 30, "CBIT_0"), 13 | "RGB1_CURRENT_5": (0, 30, "CBIT_1"), 14 | "RGB2_CURRENT_0": (0, 30, "CBIT_2"), 15 | "RGB2_CURRENT_1": (0, 30, "CBIT_3"), 16 | "RGB2_CURRENT_2": (0, 30, "CBIT_4"), 17 | "RGB2_CURRENT_3": (0, 30, "CBIT_5"), 18 | "RGB2_CURRENT_4": (0, 30, "CBIT_6"), 19 | "RGB2_CURRENT_5": (0, 30, "CBIT_7"), 20 | "CURRENT_MODE": (0, 28, "CBIT_4"), 21 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dff.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, output Q); 2 | SB_DFF ff (.C(C), .D(D), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffe.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, E, output Q); 2 | SB_DFFE ff (.C(C), .D(D), .E(E), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffer.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, E, R, output Q); 2 | SB_DFFER ff (.C(C), .D(D), .E(E), .R(R), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffes.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, E, S, output Q); 2 | SB_DFFES ff (.C(C), .D(D), .E(E), .S(S), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffesr.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, E, R, output Q); 2 | SB_DFFESR ff (.C(C), .D(D), .E(E), .R(R), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffess.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, E, S, output Q); 2 | SB_DFFESS ff (.C(C), .D(D), .E(E), .S(S), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffr.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, R, output Q); 2 | SB_DFFR ff (.C(C), .D(D), .R(R), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffs.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, S, output Q); 2 | SB_DFFS ff (.C(C), .D(D), .S(S), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffsr.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, R, output Q); 2 | SB_DFFSR ff (.C(C), .D(D), .R(R), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_dffss.v: -------------------------------------------------------------------------------- 1 | module top (input C, D, S, output Q); 2 | SB_DFFSS ff (.C(C), .D(D), .S(S), .Q(Q)); 3 | endmodule 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_gb.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input [7:0] a, 3 | output [7:0] y 4 | ); 5 | SB_GB gbufs [7:0] ( 6 | .USER_SIGNAL_TO_GLOBAL_BUFFER(a), 7 | .GLOBAL_BUFFER_OUTPUT(y) 8 | ); 9 | endmodule 10 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_gb_io.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | inout [7:0] pin, 3 | input latch_in, 4 | input clk_en, 5 | input clk_in, 6 | input clk_out, 7 | input oen, 8 | input dout_0, 9 | input dout_1, 10 | output [7:0] din_0, 11 | output [7:0] din_1, 12 | output [7:0] globals 13 | ); 14 | SB_GB_IO #( 15 | .PIN_TYPE(6'b 1100_00), 16 | .PULLUP(1'b0), 17 | .NEG_TRIGGER(1'b0), 18 | .IO_STANDARD("SB_LVCMOS") 19 | ) PINS [7:0] ( 20 | .PACKAGE_PIN(pin), 21 | .LATCH_INPUT_VALUE(latch_in), 22 | .CLOCK_ENABLE(clk_en), 23 | .INPUT_CLK(clk_in), 24 | .OUTPUT_CLK(clk_out), 25 | .OUTPUT_ENABLE(oen), 26 | .D_OUT_0(dout_0), 27 | .D_OUT_1(dout_1), 28 | .D_IN_0(din_0), 29 | .D_IN_1(din_1), 30 | .GLOBAL_BUFFER_OUTPUT(globals) 31 | ); 32 | endmodule 33 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_i2c.pcf: -------------------------------------------------------------------------------- 1 | set_io sbclki 2 2 | set_io sbrwi 3 3 | set_io sbstbi 4 4 | set_io sbadri0 6 5 | set_io sbadri1 9 6 | set_io sbadri7 10 7 | set_io sbdati0 11 8 | set_io sbdati1 12 9 | set_io sbdati7 13 10 | set_io sbdato0 14 11 | set_io sbdato1 15 12 | set_io sbdato7 16 13 | set_io sbacko 17 14 | set_io i2cirq 18 15 | set_io i2cwkup 19 16 | set_io scli 20 17 | set_io sdai 21 18 | set_io sclo 23 19 | set_io scloe 25 20 | set_io sdao 26 21 | set_io sdaoe 27 22 | set_io scli2 28 23 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_i2c.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input sbclki, sbrwi, sbstbi, 3 | input sbadri0, sbadri1, sbadri7, 4 | input sbdati0, sbdati1, sbdati7, 5 | output sbdato0, sbdato1, sbdato7, 6 | output sbacko, i2cirq, i2cwkup, 7 | input scli, sdai, scli2, 8 | output sclo, scloe, sdao, sdaoe 9 | ); 10 | 11 | SB_I2C #( 12 | .I2C_SLAVE_INIT_ADDR("0b1111100001"), 13 | .BUS_ADDR74("0b0001") 14 | ) i2c_ip ( 15 | .SBCLKI(sbclki), 16 | .SBRWI(sbrwi), 17 | .SBSTBI(sbstbi), 18 | 19 | .SBADRI0(sbadri0), 20 | .SBADRI1(sbadri1), 21 | .SBADRI7(sbadri7), 22 | 23 | .SBDATI0(sbdati0), 24 | .SBDATI1(sbdati1), 25 | .SBDATI7(sbdati7), 26 | 27 | .SBDATO0(sbdato0), 28 | .SBDATO1(sbdato1), 29 | 30 | .SBACKO(sbacko), 31 | .I2CIRQ(i2cirq), 32 | .I2CWKUP(i2cwkup), 33 | 34 | .SCLI(scli), 35 | .SCLO(sclo), 36 | .SCLOE(scloe), 37 | 38 | .SDAI(sdai), 39 | .SDAO(sdao), 40 | .SDAOE(sdaoe) 41 | ) 42 | /* synthesis SDA_INPUT_DELAYED=0 */ 43 | /* synthesis SDA_OUTPUT_DELAYED=0 */ 44 | /* synthesis SCL_INPUT_FILTERED=1 */ 45 | ; 46 | 47 | 48 | 49 | SB_I2C #( 50 | .I2C_SLAVE_INIT_ADDR("0b1111100010"), 51 | .BUS_ADDR74("0b0011") 52 | ) i2c_ip2 ( 53 | .SBCLKI(sbclki), 54 | .SBRWI(sbrwi), 55 | .SBSTBI(sbstbi), 56 | 57 | .SBADRI0(sbadri0), 58 | .SBADRI1(sbadri1), 59 | .SBADRI7(sbadri7), 60 | 61 | .SBDATI0(sbdati0), 62 | .SBDATI1(sbdati1), 63 | .SBDATI7(sbdati7), 64 | 65 | .SBDATO7(sbdato7), 66 | 67 | .SCLI(scli2) 68 | 69 | ) 70 | /* synthesis SDA_INPUT_DELAYED=0 */ 71 | /* synthesis SDA_OUTPUT_DELAYED=0 */ 72 | /* synthesis SCL_INPUT_FILTERED=1 */ 73 | ; 74 | endmodule 75 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_i2c_io.pcf: -------------------------------------------------------------------------------- 1 | set_io sbclki 2 2 | set_io sbrwi 3 3 | set_io sbstbi 4 4 | set_io sbadri0 6 5 | set_io sbadri1 9 6 | set_io sbadri7 10 7 | set_io sbdati0 11 8 | set_io sbdati1 12 9 | set_io sbdati7 13 10 | set_io sbdato0 14 11 | set_io sbdato1 15 12 | set_io sbdato7 16 13 | set_io sbacko 17 14 | set_io i2cirq 18 15 | set_io i2cwkup 19 16 | set_io scl 20 17 | set_io sda 21 18 | 19 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_i2c_io.v: -------------------------------------------------------------------------------- 1 | module top ( 2 | input sbclki, sbrwi, sbstbi, 3 | input sbadri0, sbadri1, sbadri7, 4 | input sbdati0, sbdati1, sbdati7, 5 | output sbdato0, sbdato1, sbdato7, 6 | output sbacko, i2cirq, i2cwkup, 7 | inout scl, sda 8 | ); 9 | 10 | wire scli, sclo, scloe, sdai, sdao, sdaoe; 11 | 12 | SB_I2C #( 13 | .I2C_SLAVE_INIT_ADDR("0b1111100010"), 14 | .BUS_ADDR74("0b0011") 15 | ) i2c_ip ( 16 | .SBCLKI(sbclki), 17 | .SBRWI(sbrwi), 18 | .SBSTBI(sbstbi), 19 | 20 | .SBADRI0(sbadri0), 21 | .SBADRI1(sbadri1), 22 | .SBADRI7(sbadri7), 23 | 24 | .SBDATI0(sbdati0), 25 | .SBDATI1(sbdati1), 26 | .SBDATI7(sbdati7), 27 | 28 | .SBDATO0(sbdato0), 29 | .SBDATO1(sbdato1), 30 | .SBDATO7(sbdato7), 31 | 32 | .SBACKO(sbacko), 33 | .I2CIRQ(i2cirq), 34 | .I2CWKUP(i2cwkup), 35 | 36 | .SCLI(scli), 37 | .SCLO(sclo), 38 | .SCLOE(scloe), 39 | 40 | .SDAI(sdai), 41 | .SDAO(sdao), 42 | .SDAOE(sdaoe) 43 | ) /* synthesis SCL_INPUT_FILTERED=1 */; 44 | 45 | SB_IO #( 46 | .PIN_TYPE(6'b101001), 47 | .PULLUP(1'b1) 48 | ) scl_io ( 49 | .PACKAGE_PIN(scl), 50 | .OUTPUT_ENABLE(scloe), 51 | .D_OUT_0(sclo), 52 | .D_IN_0(scli) 53 | ); 54 | 55 | 56 | SB_IO #( 57 | .PIN_TYPE(6'b101001), 58 | .PULLUP(1'b1) 59 | ) sda_io ( 60 | .PACKAGE_PIN(sda), 61 | .OUTPUT_ENABLE(sdaoe), 62 | .D_OUT_0(sdao), 63 | .D_IN_0(sdai) 64 | ); 65 | 66 | endmodule 67 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io.pcf: -------------------------------------------------------------------------------- 1 | # set_io pin 1 2 | set_io pin 2 3 | 4 | # set_io pin 5 | # set_io latch_in 6 | # set_io clk_in 7 | # set_io clk_out 8 | # set_io oen 9 | # set_io dout_0 10 | # set_io dout_1 11 | # set_io din_0 12 | # set_io din_1 13 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io.v: -------------------------------------------------------------------------------- 1 | `define CONN_INTERNAL_BITS 2 | 3 | `define PINTYPE 6'b010000 4 | // `define IOSTANDARD "SB_LVCMOS" 5 | `define IOSTANDARD "SB_LVDS_INPUT" 6 | 7 | // The following IO standards are just aliases for SB_LVCMOS 8 | // `define IOSTANDARD "SB_LVCMOS25_16" 9 | // `define IOSTANDARD "SB_LVCMOS25_12" 10 | // `define IOSTANDARD "SB_LVCMOS25_8" 11 | // `define IOSTANDARD "SB_LVCMOS25_4" 12 | // `define IOSTANDARD "SB_LVCMOS18_10" 13 | // `define IOSTANDARD "SB_LVCMOS18_8" 14 | // `define IOSTANDARD "SB_LVCMOS18_4" 15 | // `define IOSTANDARD "SB_LVCMOS18_2" 16 | // `define IOSTANDARD "SB_LVCMOS15_4" 17 | // `define IOSTANDARD "SB_LVCMOS15_2" 18 | // `define IOSTANDARD "SB_MDDR10" 19 | // `define IOSTANDARD "SB_MDDR8" 20 | // `define IOSTANDARD "SB_MDDR4" 21 | // `define IOSTANDARD "SB_MDDR2" 22 | 23 | `ifdef CONN_INTERNAL_BITS 24 | module top ( 25 | inout pin, 26 | input latch_in, 27 | input clk_in, 28 | input clk_out, 29 | input oen, 30 | input dout_0, 31 | input dout_1, 32 | output din_0, 33 | output din_1 34 | ); 35 | `else 36 | module top(pin); 37 | inout pin; 38 | wire latch_in = 0; 39 | wire clk_in = 0; 40 | wire clk_out = 0; 41 | wire oen = 0; 42 | wire dout_0 = 0; 43 | wire dout_1 = 0; 44 | wire din_0; 45 | wire din_1; 46 | `endif 47 | SB_IO #( 48 | .PIN_TYPE(`PINTYPE), 49 | .PULLUP(1'b0), 50 | .NEG_TRIGGER(1'b0), 51 | .IO_STANDARD(`IOSTANDARD) 52 | ) IO_PIN_I ( 53 | .PACKAGE_PIN(pin), 54 | .LATCH_INPUT_VALUE(latch_in), 55 | .CLOCK_ENABLE(clk_en), 56 | .INPUT_CLK(clk_in), 57 | .OUTPUT_CLK(clk_out), 58 | .OUTPUT_ENABLE(oen), 59 | .D_OUT_0(dout_0), 60 | .D_OUT_1(dout_1), 61 | .D_IN_0(din_0), 62 | .D_IN_1(din_1) 63 | ); 64 | endmodule 65 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_i3c.pcf: -------------------------------------------------------------------------------- 1 | set_io pin_23 23 2 | set_io pin_25 25 3 | 4 | set_io pin_23_puen 2 5 | set_io pin_23_wkpuen 3 6 | 7 | set_io pin_25_puen 4 8 | set_io pin_25_wkpuen 6 9 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_i3c.v: -------------------------------------------------------------------------------- 1 | 2 | module top ( 3 | inout pin_23, 4 | inout pin_25, 5 | input pin_23_puen, 6 | input pin_23_wkpuen, 7 | input pin_25_puen, 8 | input pin_25_wkpuen); 9 | 10 | (* PULLUP_RESISTOR = "3P3K" *) 11 | SB_IO_I3C #( 12 | .PIN_TYPE(6'b000001), 13 | .PULLUP(1'b1), 14 | .WEAK_PULLUP(1'b1), 15 | 16 | .NEG_TRIGGER(1'b0) 17 | ) IO_PIN_0 ( 18 | .PACKAGE_PIN(pin_23), 19 | .PU_ENB(pin_23_puen), 20 | .WEAK_PU_ENB(pin_23_wkpuen) 21 | ) ; 22 | 23 | (* PULLUP_RESISTOR = "3P3K" *) 24 | SB_IO_I3C #( 25 | .PIN_TYPE(6'b000001), 26 | .PULLUP(1'b1), 27 | .WEAK_PULLUP(1'b1), 28 | 29 | .NEG_TRIGGER(1'b0) 30 | ) IO_PIN_1 ( 31 | .PACKAGE_PIN(pin_25), 32 | .PU_ENB(pin_25_puen), 33 | .WEAK_PU_ENB(pin_25_wkpuen) 34 | ); 35 | endmodule 36 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_negclk.pcf: -------------------------------------------------------------------------------- 1 | set_io pin1 1 2 | set_io pin2 2 3 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_negclk.v: -------------------------------------------------------------------------------- 1 | module top(input clk, inout pin1, inout pin2); 2 | wire w; 3 | 4 | SB_IO #( 5 | .PIN_TYPE(6'b 0101_00), 6 | .PULLUP(1'b0), 7 | .NEG_TRIGGER(1'b1), 8 | .IO_STANDARD("SB_LVCMOS") 9 | ) IO_PIN_1 ( 10 | .PACKAGE_PIN(pin1), 11 | .LATCH_INPUT_VALUE(), 12 | .CLOCK_ENABLE(), 13 | .INPUT_CLK(clk), 14 | .OUTPUT_CLK(clk), 15 | .OUTPUT_ENABLE(), 16 | .D_OUT_0(1'b0), 17 | .D_OUT_1(1'b0), 18 | .D_IN_0(w), 19 | .D_IN_1() 20 | ); 21 | 22 | SB_IO #( 23 | .PIN_TYPE(6'b 0101_00), 24 | .PULLUP(1'b0), 25 | .NEG_TRIGGER(1'b1), 26 | .IO_STANDARD("SB_LVCMOS") 27 | ) IO_PIN_2 ( 28 | .PACKAGE_PIN(pin2), 29 | .LATCH_INPUT_VALUE(), 30 | .CLOCK_ENABLE(), 31 | .INPUT_CLK(clk), 32 | .OUTPUT_CLK(clk), 33 | .OUTPUT_ENABLE(), 34 | .D_OUT_0(w), 35 | .D_OUT_1(1'b0), 36 | .D_IN_0(), 37 | .D_IN_1() 38 | ); 39 | endmodule 40 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_od.pcf: -------------------------------------------------------------------------------- 1 | # set_io pin 1 2 | set_io pin 39 3 | 4 | # set_io pin 5 | # set_io latch_in 6 | # set_io clk_in 7 | # set_io clk_out 8 | # set_io oen 9 | # set_io dout_0 10 | # set_io dout_1 11 | # set_io din_0 12 | # set_io din_1 13 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_io_od.v: -------------------------------------------------------------------------------- 1 | //`define CONN_INTERNAL_BITS 2 | 3 | `define PINTYPE 6'b010001 4 | // `define IOSTANDARD "SB_LVCMOS" 5 | `define IOSTANDARD "SB_LVCMOS" 6 | 7 | // The following IO standards are just aliases for SB_LVCMOS 8 | // `define IOSTANDARD "SB_LVCMOS25_16" 9 | // `define IOSTANDARD "SB_LVCMOS25_12" 10 | // `define IOSTANDARD "SB_LVCMOS25_8" 11 | // `define IOSTANDARD "SB_LVCMOS25_4" 12 | // `define IOSTANDARD "SB_LVCMOS18_10" 13 | // `define IOSTANDARD "SB_LVCMOS18_8" 14 | // `define IOSTANDARD "SB_LVCMOS18_4" 15 | // `define IOSTANDARD "SB_LVCMOS18_2" 16 | // `define IOSTANDARD "SB_LVCMOS15_4" 17 | // `define IOSTANDARD "SB_LVCMOS15_2" 18 | // `define IOSTANDARD "SB_MDDR10" 19 | // `define IOSTANDARD "SB_MDDR8" 20 | // `define IOSTANDARD "SB_MDDR4" 21 | // `define IOSTANDARD "SB_MDDR2" 22 | 23 | `ifdef CONN_INTERNAL_BITS 24 | module top ( 25 | inout pin, 26 | input latch_in, 27 | input clk_in, 28 | input clk_out, 29 | input oen, 30 | input dout_0, 31 | input dout_1, 32 | output din_0, 33 | output din_1 34 | ); 35 | `else 36 | module top(pin); 37 | inout pin; 38 | wire latch_in = 0; 39 | wire clk_in = 0; 40 | wire clk_out = 0; 41 | wire oen = 0; 42 | wire dout_0 = 0; 43 | wire dout_1 = 0; 44 | wire din_0; 45 | wire din_1; 46 | `endif 47 | SB_IO_OD #( 48 | .PIN_TYPE(`PINTYPE), 49 | .NEG_TRIGGER(1'b0) 50 | ) IO_PIN_I ( 51 | .PACKAGEPIN(pin), 52 | .LATCHINPUTVALUE(latch_in), 53 | .CLOCKENABLE(clk_en), 54 | .INPUTCLK(clk_in), 55 | .OUTPUTCLK(clk_out), 56 | .OUTPUTENABLE(oen), 57 | .DOUT0(dout_0), 58 | .DOUT1(dout_1), 59 | .DIN0(din_0), 60 | .DIN1(din_1) 61 | ); 62 | endmodule 63 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_mac16.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input clk, 3 | input rst, 4 | input [7:0] a, 5 | input [7:0] b, 6 | output [15:0] y); 7 | wire co; 8 | wire [31:0] out; 9 | SB_MAC16 i_sbmac16 10 | ( 11 | .A(a), 12 | .B(b), 13 | .C(8'd0), 14 | .D(8'd0), 15 | .O(out), 16 | .CLK(clk), 17 | .IRSTTOP(rst), 18 | .IRSTBOT(rst), 19 | .ORSTTOP(rst), 20 | .ORSTBOT(rst), 21 | .AHOLD(1'b0), 22 | .BHOLD(1'b0), 23 | .CHOLD(1'b0), 24 | .DHOLD(1'b0), 25 | .OHOLDTOP(1'b0), 26 | .OHOLDBOT(1'b0), 27 | .OLOADTOP(1'b0), 28 | .OLOADBOT(1'b0), 29 | .ADDSUBTOP(1'b0), 30 | .ADDSUBBOT(1'b0), 31 | .CO(co), 32 | .CI(1'b0), 33 | .ACCUMCI(), 34 | .ACCUMCO(), 35 | .SIGNEXTIN(), 36 | .SIGNEXTOUT() 37 | ); 38 | 39 | //Config: mult_8x8_pipeline_unsigned 40 | 41 | defparam i_sbmac16. B_SIGNED = 1'b0; 42 | defparam i_sbmac16. A_SIGNED = 1'b0; 43 | defparam i_sbmac16. MODE_8x8 = 1'b1; 44 | 45 | defparam i_sbmac16. BOTADDSUB_CARRYSELECT = 2'b00; 46 | defparam i_sbmac16. BOTADDSUB_UPPERINPUT = 1'b0; 47 | defparam i_sbmac16. BOTADDSUB_LOWERINPUT = 2'b00; 48 | defparam i_sbmac16. BOTOUTPUT_SELECT = 2'b10; 49 | 50 | defparam i_sbmac16. TOPADDSUB_CARRYSELECT = 2'b00; 51 | defparam i_sbmac16. TOPADDSUB_UPPERINPUT = 1'b0; 52 | defparam i_sbmac16. TOPADDSUB_LOWERINPUT = 2'b00; 53 | defparam i_sbmac16. TOPOUTPUT_SELECT = 2'b10; 54 | 55 | defparam i_sbmac16. PIPELINE_16x16_MULT_REG2 = 1'b0; 56 | defparam i_sbmac16. PIPELINE_16x16_MULT_REG1 = 1'b1; 57 | defparam i_sbmac16. BOT_8x8_MULT_REG = 1'b1; 58 | defparam i_sbmac16. TOP_8x8_MULT_REG = 1'b1; 59 | defparam i_sbmac16. D_REG = 1'b0; 60 | defparam i_sbmac16. B_REG = 1'b1; 61 | defparam i_sbmac16. A_REG = 1'b1; 62 | defparam i_sbmac16. C_REG = 1'b0; 63 | 64 | assign y = out[15:0]; 65 | endmodule -------------------------------------------------------------------------------- /icefuzz/tests/sb_pll40_2_pad.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input PACKAGEPIN, 3 | output [1:0] PLLOUTCORE, 4 | output [1:0] PLLOUTGLOBAL, 5 | input EXTFEEDBACK, 6 | input [7:0] DYNAMICDELAY, 7 | output LOCK, 8 | input BYPASS, 9 | input RESETB, 10 | input LATCHINPUTVALUE, 11 | 12 | //Test Pins 13 | output SDO, 14 | input SDI, 15 | input SCLK 16 | ); 17 | SB_PLL40_2_PAD #( 18 | .FEEDBACK_PATH("DELAY"), 19 | // .FEEDBACK_PATH("SIMPLE"), 20 | // .FEEDBACK_PATH("PHASE_AND_DELAY"), 21 | // .FEEDBACK_PATH("EXTERNAL"), 22 | 23 | .DELAY_ADJUSTMENT_MODE_FEEDBACK("FIXED"), 24 | // .DELAY_ADJUSTMENT_MODE_FEEDBACK("DYNAMIC"), 25 | 26 | .DELAY_ADJUSTMENT_MODE_RELATIVE("FIXED"), 27 | // .DELAY_ADJUSTMENT_MODE_RELATIVE("DYNAMIC"), 28 | 29 | .PLLOUT_SELECT_PORTB("GENCLK"), 30 | // .PLLOUT_SELECT_PORTB("GENCLK_HALF"), 31 | // .PLLOUT_SELECT_PORTB("SHIFTREG_90deg"), 32 | // .PLLOUT_SELECT_PORTB("SHIFTREG_0deg"), 33 | 34 | .SHIFTREG_DIV_MODE(1'b0), 35 | .FDA_FEEDBACK(4'b1111), 36 | .FDA_RELATIVE(4'b1111), 37 | .DIVR(4'b0000), 38 | .DIVF(7'b0000000), 39 | .DIVQ(3'b001), 40 | .FILTER_RANGE(3'b000), 41 | .ENABLE_ICEGATE_PORTA(1'b0), 42 | .ENABLE_ICEGATE_PORTB(1'b0), 43 | .TEST_MODE(1'b0) 44 | ) uut ( 45 | .PACKAGEPIN (PACKAGEPIN ), 46 | .PLLOUTCOREA (PLLOUTCORE [0]), 47 | .PLLOUTGLOBALA (PLLOUTGLOBAL[0]), 48 | .PLLOUTCOREB (PLLOUTCORE [1]), 49 | .PLLOUTGLOBALB (PLLOUTGLOBAL[1]), 50 | .EXTFEEDBACK (EXTFEEDBACK ), 51 | .DYNAMICDELAY (DYNAMICDELAY ), 52 | .LOCK (LOCK ), 53 | .BYPASS (BYPASS ), 54 | .RESETB (RESETB ), 55 | .LATCHINPUTVALUE(LATCHINPUTVALUE), 56 | .SDO (SDO ), 57 | .SDI (SDI ), 58 | .SCLK (SCLK ) 59 | ); 60 | endmodule 61 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_pll40_2f_core.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input REFERENCECLK, 3 | output [1:0] PLLOUTCORE, 4 | output [1:0] PLLOUTGLOBAL, 5 | input EXTFEEDBACK, 6 | input [7:0] DYNAMICDELAY, 7 | output LOCK, 8 | input BYPASS, 9 | input RESETB, 10 | input LATCHINPUTVALUE, 11 | 12 | //Test Pins 13 | output SDO, 14 | input SDI, 15 | input SCLK 16 | ); 17 | SB_PLL40_2F_CORE #( 18 | .FEEDBACK_PATH("DELAY"), 19 | // .FEEDBACK_PATH("SIMPLE"), 20 | // .FEEDBACK_PATH("PHASE_AND_DELAY"), 21 | // .FEEDBACK_PATH("EXTERNAL"), 22 | 23 | .DELAY_ADJUSTMENT_MODE_FEEDBACK("FIXED"), 24 | // .DELAY_ADJUSTMENT_MODE_FEEDBACK("DYNAMIC"), 25 | 26 | .DELAY_ADJUSTMENT_MODE_RELATIVE("FIXED"), 27 | // .DELAY_ADJUSTMENT_MODE_RELATIVE("DYNAMIC"), 28 | 29 | .PLLOUT_SELECT_PORTA("GENCLK"), 30 | // .PLLOUT_SELECT_PORTA("GENCLK_HALF"), 31 | // .PLLOUT_SELECT_PORTA("SHIFTREG_90deg"), 32 | // .PLLOUT_SELECT_PORTA("SHIFTREG_0deg"), 33 | 34 | .PLLOUT_SELECT_PORTB("GENCLK"), 35 | // .PLLOUT_SELECT_PORTB("GENCLK_HALF"), 36 | // .PLLOUT_SELECT_PORTB("SHIFTREG_90deg"), 37 | // .PLLOUT_SELECT_PORTB("SHIFTREG_0deg"), 38 | 39 | .SHIFTREG_DIV_MODE(1'b0), 40 | .FDA_FEEDBACK(4'b1111), 41 | .FDA_RELATIVE(4'b1111), 42 | .DIVR(4'b0000), 43 | .DIVF(7'b0000000), 44 | .DIVQ(3'b001), 45 | .FILTER_RANGE(3'b000), 46 | .ENABLE_ICEGATE_PORTA(1'b0), 47 | .ENABLE_ICEGATE_PORTB(1'b0), 48 | .TEST_MODE(1'b0) 49 | ) uut ( 50 | .REFERENCECLK (REFERENCECLK ), 51 | .PLLOUTCOREA (PLLOUTCORE [0]), 52 | .PLLOUTGLOBALA (PLLOUTGLOBAL[0]), 53 | .PLLOUTCOREB (PLLOUTCORE [1]), 54 | .PLLOUTGLOBALB (PLLOUTGLOBAL[1]), 55 | .EXTFEEDBACK (EXTFEEDBACK ), 56 | .DYNAMICDELAY (DYNAMICDELAY ), 57 | .LOCK (LOCK ), 58 | .BYPASS (BYPASS ), 59 | .RESETB (RESETB ), 60 | .LATCHINPUTVALUE(LATCHINPUTVALUE), 61 | .SDO (SDO ), 62 | .SDI (SDI ), 63 | .SCLK (SCLK ) 64 | ); 65 | endmodule 66 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_pll40_2f_pad.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input PACKAGEPIN, 3 | output [1:0] PLLOUTCORE, 4 | output [1:0] PLLOUTGLOBAL, 5 | input EXTFEEDBACK, 6 | input [7:0] DYNAMICDELAY, 7 | output LOCK, 8 | input BYPASS, 9 | input RESETB, 10 | input LATCHINPUTVALUE, 11 | 12 | //Test Pins 13 | output SDO, 14 | input SDI, 15 | input SCLK 16 | ); 17 | SB_PLL40_2F_PAD #( 18 | .FEEDBACK_PATH("DELAY"), 19 | // .FEEDBACK_PATH("SIMPLE"), 20 | // .FEEDBACK_PATH("PHASE_AND_DELAY"), 21 | // .FEEDBACK_PATH("EXTERNAL"), 22 | 23 | .DELAY_ADJUSTMENT_MODE_FEEDBACK("FIXED"), 24 | // .DELAY_ADJUSTMENT_MODE_FEEDBACK("DYNAMIC"), 25 | 26 | .DELAY_ADJUSTMENT_MODE_RELATIVE("FIXED"), 27 | // .DELAY_ADJUSTMENT_MODE_RELATIVE("DYNAMIC"), 28 | 29 | .PLLOUT_SELECT_PORTA("GENCLK"), 30 | // .PLLOUT_SELECT_PORTA("GENCLK_HALF"), 31 | // .PLLOUT_SELECT_PORTA("SHIFTREG_90deg"), 32 | // .PLLOUT_SELECT_PORTA("SHIFTREG_0deg"), 33 | 34 | .PLLOUT_SELECT_PORTB("GENCLK"), 35 | // .PLLOUT_SELECT_PORTB("GENCLK_HALF"), 36 | // .PLLOUT_SELECT_PORTB("SHIFTREG_90deg"), 37 | // .PLLOUT_SELECT_PORTB("SHIFTREG_0deg"), 38 | 39 | .SHIFTREG_DIV_MODE(1'b0), 40 | .FDA_FEEDBACK(4'b1111), 41 | .FDA_RELATIVE(4'b1111), 42 | .DIVR(4'b0000), 43 | .DIVF(7'b0000000), 44 | .DIVQ(3'b001), 45 | .FILTER_RANGE(3'b000), 46 | .ENABLE_ICEGATE_PORTA(1'b0), 47 | .ENABLE_ICEGATE_PORTB(1'b0), 48 | .TEST_MODE(1'b0) 49 | ) uut ( 50 | .PACKAGEPIN (PACKAGEPIN ), 51 | .PLLOUTCOREA (PLLOUTCORE [0]), 52 | .PLLOUTGLOBALA (PLLOUTGLOBAL[0]), 53 | .PLLOUTCOREB (PLLOUTCORE [1]), 54 | .PLLOUTGLOBALB (PLLOUTGLOBAL[1]), 55 | .EXTFEEDBACK (EXTFEEDBACK ), 56 | .DYNAMICDELAY (DYNAMICDELAY ), 57 | .LOCK (LOCK ), 58 | .BYPASS (BYPASS ), 59 | .RESETB (RESETB ), 60 | .LATCHINPUTVALUE(LATCHINPUTVALUE), 61 | .SDO (SDO ), 62 | .SDI (SDI ), 63 | .SCLK (SCLK ) 64 | ); 65 | endmodule 66 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_pll40_core.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input REFERENCECLK, 3 | output PLLOUTCORE, 4 | output PLLOUTGLOBAL, 5 | input EXTFEEDBACK, 6 | input [7:0] DYNAMICDELAY, 7 | output LOCK, 8 | input BYPASS, 9 | input RESETB, 10 | input LATCHINPUTVALUE, 11 | 12 | //Test Pins 13 | output SDO, 14 | input SDI, 15 | input SCLK 16 | ); 17 | SB_PLL40_CORE #( 18 | .FEEDBACK_PATH("DELAY"), 19 | // .FEEDBACK_PATH("SIMPLE"), 20 | // .FEEDBACK_PATH("PHASE_AND_DELAY"), 21 | // .FEEDBACK_PATH("EXTERNAL"), 22 | 23 | .DELAY_ADJUSTMENT_MODE_FEEDBACK("FIXED"), 24 | // .DELAY_ADJUSTMENT_MODE_FEEDBACK("DYNAMIC"), 25 | 26 | .DELAY_ADJUSTMENT_MODE_RELATIVE("FIXED"), 27 | // .DELAY_ADJUSTMENT_MODE_RELATIVE("DYNAMIC"), 28 | 29 | .PLLOUT_SELECT("GENCLK"), 30 | // .PLLOUT_SELECT("GENCLK_HALF"), 31 | // .PLLOUT_SELECT("SHIFTREG_90deg"), 32 | // .PLLOUT_SELECT("SHIFTREG_0deg"), 33 | 34 | .SHIFTREG_DIV_MODE(1'b0), 35 | .FDA_FEEDBACK(4'b1111), 36 | .FDA_RELATIVE(4'b1111), 37 | .DIVR(4'b0000), 38 | .DIVF(7'b0000000), 39 | .DIVQ(3'b001), 40 | .FILTER_RANGE(3'b000), 41 | .ENABLE_ICEGATE(1'b0), 42 | .TEST_MODE(1'b0) 43 | ) uut ( 44 | .REFERENCECLK (REFERENCECLK ), 45 | .PLLOUTCORE (PLLOUTCORE ), 46 | .PLLOUTGLOBAL (PLLOUTGLOBAL ), 47 | .EXTFEEDBACK (EXTFEEDBACK ), 48 | .DYNAMICDELAY (DYNAMICDELAY ), 49 | .LOCK (LOCK ), 50 | .BYPASS (BYPASS ), 51 | .RESETB (RESETB ), 52 | .LATCHINPUTVALUE(LATCHINPUTVALUE), 53 | .SDO (SDO ), 54 | .SDI (SDI ), 55 | .SCLK (SCLK ) 56 | ); 57 | endmodule 58 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_pll40_pad.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input PACKAGEPIN, 3 | output PLLOUTCORE, 4 | output PLLOUTGLOBAL, 5 | input EXTFEEDBACK, 6 | input [7:0] DYNAMICDELAY, 7 | output LOCK, 8 | input BYPASS, 9 | input RESETB, 10 | input LATCHINPUTVALUE, 11 | 12 | //Test Pins 13 | output SDO, 14 | input SDI, 15 | input SCLK 16 | ); 17 | SB_PLL40_PAD #( 18 | .FEEDBACK_PATH("DELAY"), 19 | // .FEEDBACK_PATH("SIMPLE"), 20 | // .FEEDBACK_PATH("PHASE_AND_DELAY"), 21 | // .FEEDBACK_PATH("EXTERNAL"), 22 | 23 | .DELAY_ADJUSTMENT_MODE_FEEDBACK("FIXED"), 24 | // .DELAY_ADJUSTMENT_MODE_FEEDBACK("DYNAMIC"), 25 | 26 | .DELAY_ADJUSTMENT_MODE_RELATIVE("FIXED"), 27 | // .DELAY_ADJUSTMENT_MODE_RELATIVE("DYNAMIC"), 28 | 29 | .PLLOUT_SELECT("GENCLK"), 30 | // .PLLOUT_SELECT("GENCLK_HALF"), 31 | // .PLLOUT_SELECT("SHIFTREG_90deg"), 32 | // .PLLOUT_SELECT("SHIFTREG_0deg"), 33 | 34 | .SHIFTREG_DIV_MODE(1'b0), 35 | .FDA_FEEDBACK(4'b1111), 36 | .FDA_RELATIVE(4'b1111), 37 | .DIVR(4'b0000), 38 | .DIVF(7'b0000000), 39 | .DIVQ(3'b001), 40 | .FILTER_RANGE(3'b000), 41 | .ENABLE_ICEGATE(1'b0), 42 | .TEST_MODE(1'b0) 43 | ) uut ( 44 | .PACKAGEPIN (PACKAGEPIN ), 45 | .PLLOUTCORE (PLLOUTCORE ), 46 | .PLLOUTGLOBAL (PLLOUTGLOBAL ), 47 | .EXTFEEDBACK (EXTFEEDBACK ), 48 | .DYNAMICDELAY (DYNAMICDELAY ), 49 | .LOCK (LOCK ), 50 | .BYPASS (BYPASS ), 51 | .RESETB (RESETB ), 52 | .LATCHINPUTVALUE(LATCHINPUTVALUE), 53 | .SDO (SDO ), 54 | .SDI (SDI ), 55 | .SCLK (SCLK ) 56 | ); 57 | endmodule 58 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_ram40.pcf: -------------------------------------------------------------------------------- 1 | set_location lut 7 21 0 2 | set_location ram40_00 8 21 0 3 | set_location ram40_12 8 19 0 4 | set_location ram40_33 8 17 0 5 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_ram40.v: -------------------------------------------------------------------------------- 1 | // ICEDEV=hx8k-ct256 bash ../icecube.sh sb_ram40.v 2 | // ../../icebox/icebox_vlog.py -P sb_ram40.psb sb_ram40.txt 3 | // ../../icebox/icebox_explain.py -t '7 21' sb_ram40.txt 4 | 5 | module top ( 6 | input [10:0] WADDR, 7 | input [10:0] RADDR, 8 | input [15:0] MASK, 9 | input [15:0] WDATA, 10 | output [15:0] RDATA_0, 11 | output [ 7:0] RDATA_1, 12 | output [ 1:0] RDATA_3, 13 | input WE, WCLKE, WCLK, 14 | input RE, RCLKE, RCLK, 15 | output X 16 | ); 17 | // Write Mode 0: 8 Bit ADDR, 16 Bit DATA, MASK 18 | // Write Mode 1: 9 Bit ADDR, 8 Bit DATA, NO MASK 19 | // Write Mode 2: 10 Bit ADDR, 4 Bit DATA, NO MASK 20 | // Write Mode 3: 11 Bit ADDR, 2 Bit DATA, NO MASK 21 | 22 | SB_RAM40_4K #( 23 | .READ_MODE(0), 24 | .WRITE_MODE(0) 25 | ) ram40_00 ( 26 | .WADDR(WADDR[7:0]), 27 | .RADDR(RADDR[7:0]), 28 | .MASK(MASK), 29 | .WDATA(WDATA), 30 | .RDATA(RDATA_0), 31 | .WE(WE), 32 | .WCLKE(WCLKE), 33 | .WCLK(WCLK), 34 | .RE(RE), 35 | .RCLKE(RCLKE), 36 | .RCLK(RCLK) 37 | ); 38 | 39 | SB_RAM40_4K #( 40 | .READ_MODE(1), 41 | .WRITE_MODE(2) 42 | ) ram40_12 ( 43 | .WADDR(WADDR[9:0]), 44 | .RADDR(RADDR[8:0]), 45 | .WDATA(WDATA[3:0]), 46 | .RDATA(RDATA_1), 47 | .WE(WE), 48 | .WCLKE(WCLKE), 49 | .WCLK(WCLK), 50 | .RE(RE), 51 | .RCLKE(RCLKE), 52 | .RCLK(RCLK) 53 | ); 54 | 55 | SB_RAM40_4K #( 56 | .READ_MODE(3), 57 | .WRITE_MODE(3) 58 | ) ram40_33 ( 59 | .WADDR(WADDR), 60 | .RADDR(RADDR), 61 | .WDATA(WDATA[1:0]), 62 | .RDATA(RDATA_3), 63 | .WE(WE), 64 | .WCLKE(WCLKE), 65 | .WCLK(WCLK), 66 | .RE(RE), 67 | .RCLKE(RCLKE), 68 | .RCLK(RCLK) 69 | ); 70 | 71 | SB_LUT4 #( 72 | .LUT_INIT(16'b 1000_0000_0000_0000) 73 | ) lut ( 74 | .O(X), 75 | .I0(RDATA_0[0]), 76 | .I1(RDATA_0[6]), 77 | .I2(RDATA_0[8]), 78 | .I3(RDATA_0[14]) 79 | ); 80 | endmodule 81 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_rgb_drv.pcf: -------------------------------------------------------------------------------- 1 | set_io r_led 39 2 | set_io g_led 40 3 | set_io b_led 41 4 | set_io r_in 25 5 | set_io g_in 26 6 | set_io b_in 27 7 | set_io en 28 8 | set_io rgbleden 31 9 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_rgb_drv.v: -------------------------------------------------------------------------------- 1 | module top 2 | ( 3 | input en, 4 | input rgbleden, 5 | input r_in, 6 | input g_in, 7 | input b_in, 8 | output r_led, 9 | output g_led, 10 | output b_led); 11 | 12 | wire ledpu; 13 | 14 | SB_LED_DRV_CUR 15 | LED_DRV_CUR(.EN(en), 16 | .LEDPU(ledpu)); 17 | 18 | wire rgbpu; 19 | 20 | SB_RGB_DRV 21 | RGB_DRV(.RGBLEDEN(rgbleden), 22 | .RGBPU(rgbpu), 23 | .RGB0PWM(r_in), 24 | .RGB1PWM(g_in), 25 | .RGB2PWM(b_in), 26 | .RGB0(r_led), 27 | .RGB1(g_led), 28 | .RGB2(b_led)); 29 | 30 | defparam RGB_DRV.RGB0_CURRENT = "0b000011"; 31 | defparam RGB_DRV.RGB1_CURRENT = "0b001111"; 32 | defparam RGB_DRV.RGB2_CURRENT = "0b111111"; 33 | 34 | assign rgbpu = ledpu; 35 | 36 | endmodule 37 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_rgba_drv.pcf: -------------------------------------------------------------------------------- 1 | set_io r_led 39 2 | set_io g_led 40 3 | set_io b_led 41 4 | -------------------------------------------------------------------------------- /icefuzz/tests/sb_rgba_drv.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input r_in, 3 | input g_in, 4 | input b_in, 5 | output r_led, 6 | output g_led, 7 | output b_led); 8 | 9 | wire curren; 10 | wire rgbleden; 11 | 12 | SB_RGBA_DRV RGBA_DRIVER ( 13 | .CURREN(curren), 14 | .RGBLEDEN(rgbleden), 15 | .RGB0PWM(r_in), 16 | .RGB1PWM(r_in), 17 | .RGB2PWM(r_in), 18 | .RGB0(r_led), 19 | .RGB1(g_led), 20 | .RGB2(b_led) 21 | ); 22 | 23 | defparam RGBA_DRIVER.CURRENT_MODE = "0b0"; 24 | defparam RGBA_DRIVER.RGB0_CURRENT = "0b000011"; 25 | defparam RGBA_DRIVER.RGB1_CURRENT = "0b001111"; 26 | defparam RGBA_DRIVER.RGB2_CURRENT = "0b111111"; 27 | 28 | assign curren = 1'b1; 29 | assign rgbleden = 1'b1; 30 | 31 | 32 | endmodule -------------------------------------------------------------------------------- /icefuzz/tests/sb_spram256ka.v: -------------------------------------------------------------------------------- 1 | module top( 2 | input clk, 3 | input [13:0] addr, 4 | input [7:0] din, 5 | input wren, 6 | input cs, 7 | output [7:0] dout 8 | ); 9 | 10 | SB_SPRAM256KA spram_i 11 | ( 12 | .ADDRESS(addr), 13 | .DATAIN(din), 14 | .MASKWREN(4'b1111), 15 | .WREN(wren), 16 | .CHIPSELECT(cs), 17 | .CLOCK(clk), 18 | .STANDBY(1'b0), 19 | .SLEEP(1'b0), 20 | .POWEROFF(1'b0), 21 | .DATAOUT(dout) 22 | ); 23 | 24 | 25 | endmodule -------------------------------------------------------------------------------- /icefuzz/tests/sb_warmboot.v: -------------------------------------------------------------------------------- 1 | module top(input boot, s0, s1); 2 | SB_WARMBOOT warmboot ( 3 | .BOOT(boot), 4 | .S0(s0), 5 | .S1(s1) 6 | ); 7 | endmodule 8 | -------------------------------------------------------------------------------- /icefuzz/tests/spram/.gitignore: -------------------------------------------------------------------------------- 1 | work_spram/ 2 | -------------------------------------------------------------------------------- /icefuzz/tests/test_pio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | lattice_simlib="/opt/lscc/iCEcube2.2014.12/verilog/sb_ice_syn.v" 5 | 6 | mkdir -p test_pio.work 7 | cd test_pio.work 8 | 9 | for NEGTRIG in 0 1; do 10 | for INTYPE in 00 01 10 11; do 11 | for OUTTYPE in 0000 0110 1010 1110 0101 1001 1101 \ 12 | 0100 1000 1100 0111 1011 1111; do 13 | pf="test_pio_${OUTTYPE}${INTYPE}${NEGTRIG}" 14 | echo "Testing ${pf}..." 15 | if ! test -f ${pf}.bin; then 16 | cat > ${pf}.v <<- EOT 17 | module top ( 18 | inout pin, 19 | input latch_in, 20 | input clk_en, 21 | input clk_in, 22 | input clk_out, 23 | input oen, 24 | input dout_0, 25 | input dout_1, 26 | output din_0, 27 | output din_1, 28 | output global 29 | ); 30 | SB_GB_IO #( 31 | .PIN_TYPE(6'b${OUTTYPE}${INTYPE}), 32 | .PULLUP(1'b0), 33 | .NEG_TRIGGER(1'b${NEGTRIG}), 34 | .IO_STANDARD("SB_LVCMOS") 35 | ) pin_gb_io ( 36 | .PACKAGE_PIN(pin), 37 | .GLOBAL_BUFFER_OUTPUT(global), 38 | .LATCH_INPUT_VALUE(latch_in), 39 | .CLOCK_ENABLE(clk_en), 40 | .INPUT_CLK(clk_in), 41 | .OUTPUT_CLK(clk_out), 42 | .OUTPUT_ENABLE(oen), 43 | .D_OUT_0(dout_0), 44 | .D_OUT_1(dout_1), 45 | .D_IN_0(din_0), 46 | .D_IN_1(din_1) 47 | ); 48 | endmodule 49 | EOT 50 | bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 51 | fi 52 | python3 ../../../icebox/icebox_vlog.py -P ${pf}.psb ${pf}.asc > ${pf}_out.v 53 | iverilog -D"VCDFILE=\"${pf}_tb.vcd\"" -DINTYPE=${INTYPE} -o ${pf}_tb \ 54 | -s testbench ../test_pio_tb.v ${pf}.v ${pf}_out.v $lattice_simlib 2> /dev/null 55 | ./${pf}_tb > ${pf}_tb.txt 56 | if grep ERROR ${pf}_tb.txt; then exit 1; fi 57 | done; done; done 58 | 59 | echo "All tests passed." 60 | 61 | -------------------------------------------------------------------------------- /icefuzz/timings_loop.sh: -------------------------------------------------------------------------------- 1 | while true; do 2 | rm -rf data_5k_*.txt work_5k_* 3 | make DEVICECLASS=5k -j3 4 | make DEVICECLASS=5k timings 5 | done 6 | -------------------------------------------------------------------------------- /icefuzz/tmedges.ys: -------------------------------------------------------------------------------- 1 | hierarchy -generate LogicCell40 i:in* i:*in i:clk i:ce i:sr o:*out 2 | hierarchy -generate ICE_GB i:USERSIGNALTOGLOBALBUFFER o:GLOBALBUFFEROUTPUT 3 | hierarchy -generate PRE_IO_GBUF i:PADSIGNALTOGLOBALBUFFER o:GLOBALBUFFEROUTPUT 4 | hierarchy -generate VCC o:* 5 | hierarchy -generate GND o:* 6 | hierarchy -generate IO_PAD i:OE i:DIN o:DOUT io:PACKAGEPIN 7 | hierarchy -generate PRE_IO o:PADOEN o:PADOUT i:PADIN i:CLOCKENABLE o:DIN0 o:DIN1 \ 8 | i:DOUT0 i:DOUT1 i:INPUTCLK i:LATCHINPUTVALUE i:OUTPUTCLK i:OUTPUTENABLE 9 | hierarchy -generate *PLL40* i:PACKAGEPIN i:BYPASS i:DYNAMICDELAY i:EXTFEEDBACK i:LATCHINPUTVALUE \ 10 | o:LOCK o:PLLOUT* i:REFERENCECLK i:RESETB i:SCLK i:SDI o:SDO i:PLLIN 11 | hierarchy -generate SB_RAM40_4K o:RDATA i:RADDR i:WADDR i:MASK i:WDATA i:RCLKE i:RCLK i:RE i:WCLKE i:WCLK i:WE 12 | hierarchy -generate SB_MAC16 i:CLK i:CE i:C i:A i:B i:D i:AHOLD i:BHOLD i:CHOLD i:DHOLD i:IRSTTOP i:IRSTBOT \ 13 | i:ORSTTOP i:ORSTBOT i:OLOADTOP i:OLOADBOT i:ADDSUBTOP i:ADDSUBBOT i:OHOLDTOP i:OHOLDBOT i:CI i:ACCUMCI \ 14 | i:SIGNEXTIN o:O o:CO o:ACCUMCO o:SIGNEXTOUT 15 | hierarchy -generate SB_SPRAM256KA i:ADDRESS i:DATAIN i:MASKWREN i:WREN i:CHIPSELECT i:CLOCK i:STANDBY i:SLEEP \ 16 | i:POWEROFF i:DATAOUT 17 | hierarchy -generate SB_RGBA_DRV i:CURREN i:RGBLEDEN i:RGB*PWM o:RGB* 18 | hierarchy -generate SB_LED_DRV_CUR i:EN o:LEDPU 19 | hierarchy -generate SB_RGB_DRV i:RGBPU i:RGBLEDEN i:RGB*PWM o:RGB* 20 | hierarchy -generate SB_LFOSC i:CLKLFPU i:CLKLFEN o:CLKLF 21 | hierarchy -generate SB_HFOSC i:CLKHFPU i:CLKHFEN o:CLKHF 22 | hierarchy -generate SB_LEDDA_IP i:LEDDCS i:LEDDCLK i:LEDDDAT* i:LEDDADDR* i:LEDDDEN i:LEDDEXE i:LEDDRST o:PWMOUT* o:LEDDON 23 | 24 | hierarchy -generate ICE_CARRY_IN_MUX i:*in o:*out 25 | hierarchy -generate *Mux* i:I o:O 26 | hierarchy -generate DummyBuf i:I o:O 27 | hierarchy -generate Odrv* i:I o:O 28 | hierarchy -generate Sp12to4 i:I o:O 29 | hierarchy -generate INV i:I o:O 30 | hierarchy -generate gio2CtrlBuf i:I o:O 31 | hierarchy -generate CascadeBuf i:I o:O 32 | 33 | hierarchy -generate SMCCLK o:CLK 34 | 35 | hierarchy -check 36 | tee -o tmedges_unrenamed.tmp edgetypes 37 | -------------------------------------------------------------------------------- /icemulti/.gitignore: -------------------------------------------------------------------------------- 1 | icemulti 2 | icemulti.exe 3 | icemulti.wasm 4 | icemulti.o 5 | icemulti.d 6 | -------------------------------------------------------------------------------- /icemulti/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | ifeq ($(STATIC),1) 4 | LDFLAGS += -static 5 | endif 6 | 7 | all: $(PROGRAM_PREFIX)icemulti$(EXE) 8 | 9 | $(PROGRAM_PREFIX)icemulti$(EXE): icemulti.o 10 | $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) 11 | 12 | install: all 13 | mkdir -p $(DESTDIR)$(PREFIX)/bin 14 | cp $(PROGRAM_PREFIX)icemulti$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icemulti$(EXE) 15 | 16 | uninstall: 17 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icemulti$(EXE) 18 | 19 | clean: 20 | rm -f $(PROGRAM_PREFIX)icemulti$(EXE) 21 | rm -f $(PROGRAM_PREFIX)icemulti.exe 22 | rm -f *.o *.d 23 | 24 | -include *.d 25 | 26 | .PHONY: all install uninstall clean 27 | 28 | -------------------------------------------------------------------------------- /icepack/.gitignore: -------------------------------------------------------------------------------- 1 | icepack 2 | icepack.exe 3 | icepack.wasm 4 | iceunpack 5 | iceunpack.exe 6 | iceunpack.wasm 7 | icepack.o 8 | icepack.d 9 | -------------------------------------------------------------------------------- /icepack/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc 3 | 4 | ifeq ($(STATIC),1) 5 | LDFLAGS += -static 6 | endif 7 | 8 | all: $(PROGRAM_PREFIX)icepack$(EXE) $(PROGRAM_PREFIX)iceunpack$(EXE) 9 | 10 | $(PROGRAM_PREFIX)icepack$(EXE): icepack.o 11 | $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) 12 | 13 | $(PROGRAM_PREFIX)iceunpack$(EXE): $(PROGRAM_PREFIX)icepack$(EXE) 14 | ln -sf $(PROGRAM_PREFIX)icepack$(EXE) $(PROGRAM_PREFIX)iceunpack$(EXE) 15 | 16 | $(PROGRAM_PREFIX)iceunpack.exe: 17 | # no iceunpack.exe, use icepack -u 18 | 19 | install: all 20 | mkdir -p $(DESTDIR)$(PREFIX)/bin 21 | cp $(PROGRAM_PREFIX)icepack$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icepack$(EXE) 22 | ln -sf $(PROGRAM_PREFIX)icepack$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceunpack$(EXE) 23 | 24 | uninstall: 25 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icepack$(EXE) 26 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceunpack$(EXE) 27 | 28 | clean: 29 | rm -f $(PROGRAM_PREFIX)icepack$(EXE) 30 | rm -f $(PROGRAM_PREFIX)iceunpack$(EXE) 31 | rm -f $(PROGRAM_PREFIX)icepack.exe 32 | rm -f *.o *.d 33 | 34 | -include *.d 35 | 36 | .PHONY: all install uninstall clean 37 | 38 | -------------------------------------------------------------------------------- /icepll/.gitignore: -------------------------------------------------------------------------------- 1 | icepll 2 | icepll.exe 3 | icepll.wasm 4 | icepll.o 5 | icepll.d 6 | -------------------------------------------------------------------------------- /icepll/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | ifeq ($(STATIC),1) 4 | LDFLAGS += -static 5 | endif 6 | 7 | all: $(PROGRAM_PREFIX)icepll$(EXE) 8 | 9 | $(PROGRAM_PREFIX)icepll$(EXE): icepll.o 10 | $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) 11 | 12 | install: all 13 | mkdir -p $(DESTDIR)$(PREFIX)/bin 14 | cp $(PROGRAM_PREFIX)icepll$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icepll$(EXE) 15 | 16 | uninstall: 17 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icepll$(EXE) 18 | 19 | clean: 20 | rm -f $(PROGRAM_PREFIX)icepll$(EXE) 21 | rm -f $(PROGRAM_PREFIX)icepll.exe 22 | rm -f *.o *.d 23 | 24 | -include *.d 25 | 26 | .PHONY: all install uninstall clean 27 | 28 | -------------------------------------------------------------------------------- /iceprog/.gitignore: -------------------------------------------------------------------------------- 1 | iceprog 2 | *.exe 3 | *.o 4 | *.d 5 | -------------------------------------------------------------------------------- /iceprog/Makefile: -------------------------------------------------------------------------------- 1 | include ../config.mk 2 | 3 | ifeq ($(STATIC),1) 4 | LDFLAGS += -static 5 | LDLIBS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors --static --libs $$pkg && exit; done; echo -lftdi; ) 6 | CFLAGS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors --static --cflags $$pkg && exit; done; ) 7 | else 8 | LDLIBS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors --libs $$pkg && exit; done; echo -lftdi; ) 9 | CFLAGS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors --cflags $$pkg && exit; done; ) 10 | endif 11 | 12 | all: $(PROGRAM_PREFIX)iceprog$(EXE) 13 | 14 | $(PROGRAM_PREFIX)iceprog$(EXE): iceprog.o mpsse.o 15 | $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) 16 | 17 | install: all 18 | mkdir -p $(DESTDIR)$(PREFIX)/bin 19 | cp $(PROGRAM_PREFIX)iceprog$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceprog$(EXE) 20 | 21 | uninstall: 22 | rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceprog$(EXE) 23 | 24 | clean: 25 | rm -f $(PROGRAM_PREFIX)iceprog 26 | rm -f $(PROGRAM_PREFIX)iceprog.exe 27 | rm -f *.o *.d 28 | 29 | -include *.d 30 | 31 | .PHONY: all install uninstall clean 32 | 33 | -------------------------------------------------------------------------------- /iceprog/mpsse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iceprog -- simple programming tool for FTDI-based Lattice iCE programmers 3 | * 4 | * Copyright (C) 2015 Claire Xenia Wolf 5 | * Copyright (C) 2018 Piotr Esden-Tempski 6 | * 7 | * Permission to use, copy, modify, and/or distribute this software for any 8 | * purpose with or without fee is hereby granted, provided that the above 9 | * copyright notice and this permission notice appear in all copies. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | */ 19 | 20 | #ifndef MPSSE_H 21 | #define MPSSE_H 22 | 23 | #include 24 | 25 | void mpsse_check_rx(void); 26 | void mpsse_error(int status); 27 | uint8_t mpsse_recv_byte(void); 28 | void mpsse_send_byte(uint8_t data); 29 | void mpsse_send_spi(uint8_t *data, int n); 30 | void mpsse_xfer_spi(uint8_t *data, int n); 31 | uint8_t mpsse_xfer_spi_bits(uint8_t data, int n); 32 | void mpsse_set_gpio(uint8_t gpio, uint8_t direction); 33 | int mpsse_readb_low(void); 34 | int mpsse_readb_high(void); 35 | void mpsse_send_dummy_bytes(uint8_t n); 36 | void mpsse_send_dummy_bit(void); 37 | void mpsse_init(int ifnum, const char *devstr, bool slow_clock); 38 | void mpsse_close(void); 39 | 40 | #endif /* MPSSE_H */ 41 | -------------------------------------------------------------------------------- /icetime/.gitignore: -------------------------------------------------------------------------------- 1 | icetime 2 | icetime.exe 3 | timings.inc 4 | timings-*.cc 5 | test[0-9]* 6 | *.d 7 | *.o 8 | -------------------------------------------------------------------------------- /icetime/show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | yosys -p ' 6 | cd equiv 7 | equiv_mark 8 | select -write equiv_graph.segs w:seg_*_gate a:equiv_region!=0 %i 9 | show -prefix equiv_graph -format dot a:equiv_region!=0 %co2 a:equiv_region!=0 %ci2 10 | ' $1.il 11 | 12 | ./icetime -P tq144 -p $1.pcf $1.asc $( sed 's,_gate$,,; s,.*_,-g ,;' < equiv_graph.segs ) > /dev/null 13 | 14 | { 15 | egrep -v '^}' icetime_graph.dot 16 | egrep -v '^(digraph|label=|})' equiv_graph.dot 17 | 18 | for seg in $( sed 's,equiv/,,' equiv_graph.segs ); do 19 | n=$( awk "/$seg/ { print \$1; }" equiv_graph.dot ) 20 | s=$( echo $seg | sed 's,_[0-9]*_gate$,,' ) 21 | echo " $n:s -> $s:n [style=bold];" 22 | done 23 | echo "}" 24 | } > $1.dot 25 | 26 | rm -f equiv_graph.segs 27 | rm -f equiv_graph.dot 28 | rm -f icetime_graph.dot 29 | 30 | --------------------------------------------------------------------------------