diff options
author | eine <6628437+eine@users.noreply.github.com> | 2020-01-19 03:25:43 +0000 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2020-01-19 04:25:43 +0100 |
commit | 910073d647e55d133494429d8c3a4bacffc32428 (patch) | |
tree | 6b1e616a1f670d44b03c1239ab5cba8aff15b909 | |
parent | 175123cda990ee2b5cfac461bd8ec44956da302a (diff) | |
download | ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.gz ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.bz2 ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.zip |
migrate from Travis to GHA and rework examples (#78)
* migrate from Travis to GHA
* rework examples
-rw-r--r-- | .github/workflows/push.yml | 18 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rwxr-xr-x | ci.sh (renamed from travis.sh) | 52 | ||||
-rw-r--r-- | examples/ice40hx8k/leds.vhdl (renamed from ice40hx8k/leds.vhdl) | 0 | ||||
-rw-r--r-- | examples/ice40hx8k/pinmap.pcf (renamed from ice40hx8k/pinmap.pcf) | 0 | ||||
-rw-r--r-- | examples/ice40hx8k/spin1.vhdl (renamed from ice40hx8k/spin1.vhdl) | 0 | ||||
-rw-r--r-- | examples/ice40hx8k/spin2.vhdl (renamed from ice40hx8k/spin2.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/blink.vhdl (renamed from icestick/blink.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/fixed1.vhdl (renamed from icestick/fixed1.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/leds.pcf (renamed from icestick/leds.pcf) | 0 | ||||
-rw-r--r-- | examples/icestick/leds.vhdl (renamed from icestick/leds.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/multi1.vhdl (renamed from icestick/multi1.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/multi2.vhdl (renamed from icestick/multi2.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/rotate1.vhdl (renamed from icestick/rotate1.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/rotate2.vhdl (renamed from icestick/rotate2.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/rotate3.vhdl (renamed from icestick/rotate3.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/rotate4.vhdl (renamed from icestick/rotate4.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/spin1.vhdl (renamed from icestick/spin1.vhdl) | 0 | ||||
-rw-r--r-- | examples/icestick/spin2.vhdl (renamed from icestick/spin2.vhdl) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/README.md (renamed from icestick/uart/README.md) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/hdl/uart_rx.vhd (renamed from icestick/uart/hdl/uart_rx.vhd) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/hdl/uart_top.vhd (renamed from icestick/uart/hdl/uart_top.vhd) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/hdl/uart_tx.vhd (renamed from icestick/uart/hdl/uart_tx.vhd) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/syn/constraints/uart.pcf (renamed from icestick/uart/syn/constraints/uart.pcf) | 0 | ||||
-rwxr-xr-x | examples/icestick/uart/syn/synth.sh (renamed from icestick/uart/syn/synth.sh) | 0 | ||||
-rw-r--r-- | examples/icezum/Makefile | 23 | ||||
-rw-r--r-- | examples/icezum/blink.vhdl | 35 | ||||
-rw-r--r-- | examples/icezum/counter.vhdl (renamed from icezum/counter-8bits/counter8.vhdl) | 21 | ||||
-rw-r--r-- | examples/icezum/icezum.pcf (renamed from icezum/blink/blink.pcf) | 24 | ||||
-rw-r--r-- | examples/icezum/led_on.vhdl (renamed from icezum/led_on/led_on.vhdl) | 5 | ||||
-rw-r--r-- | examples/icezum/pushbutton.vhdl (renamed from icezum/pushbutton/pushbutton.vhdl) | 12 | ||||
-rwxr-xr-x | examples/icezum/test.sh | 13 | ||||
-rw-r--r-- | icezum/blink/Makefile | 32 | ||||
-rw-r--r-- | icezum/blink/README.md | 16 | ||||
-rw-r--r-- | icezum/blink/blink.vhdl | 35 | ||||
-rw-r--r-- | icezum/counter-8bits/Makefile | 32 | ||||
-rw-r--r-- | icezum/counter-8bits/README.md | 16 | ||||
-rw-r--r-- | icezum/counter-8bits/counter8.pcf | 9 | ||||
-rw-r--r-- | icezum/led_on/Makefile | 31 | ||||
-rw-r--r-- | icezum/led_on/README.md | 16 | ||||
-rw-r--r-- | icezum/led_on/led_on.pcf | 9 | ||||
-rw-r--r-- | icezum/pushbutton/Makefile | 32 | ||||
-rw-r--r-- | icezum/pushbutton/README.md | 17 | ||||
-rw-r--r-- | icezum/pushbutton/pushbutton.pcf | 7 | ||||
-rw-r--r-- | icezum/pushbutton_and/Makefile | 32 | ||||
-rw-r--r-- | icezum/pushbutton_and/README.md | 17 | ||||
-rw-r--r-- | icezum/pushbutton_and/pushbutton_and.pcf | 4 | ||||
-rw-r--r-- | icezum/pushbutton_and/pushbutton_and.vhdl | 18 | ||||
-rwxr-xr-x | testsuite/examples/test-ice40hx8k/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/examples/test-icestick/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/examples/test-icezum/testsuite.sh | 10 | ||||
-rw-r--r-- | testsuite/testenv.sh | 12 | ||||
-rw-r--r-- | utils.sh | 56 |
53 files changed, 174 insertions, 439 deletions
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..fc405ef --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,18 @@ +name: 'push' + +on: + push: + schedule: + - cron: '0 0 * * 5' + +env: + CI: true + DOCKER_BUILDKIT: 1 + +jobs: + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: ./ci.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9940b13..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -os: linux -services: docker -language: minimal -install: skip -script: ./travis.sh @@ -5,10 +5,8 @@ set -e cd "$(dirname $0)" . ./utils.sh -prefix='/opt/ghdl' - #-- -travis_start "ghdl" "[Build] ghdl/synth:latest" "$ANSI_MAGENTA" +gstart "[Build] ghdl/synth:latest" "$ANSI_MAGENTA" case "$TRAVIS_COMMIT_MESSAGE" in "*[stable]*") @@ -22,8 +20,8 @@ case "$TRAVIS_COMMIT_MESSAGE" in esac echo "GHDL_URL: $GHDL_URL" -docker build -t ghdl/synth:latest - <<-EOF -FROM ghdl/build:buster-mcode AS build +docker build -t tmp - <<-EOF +FROM ghdl/build:buster-mcode RUN apt-get update -qq \ && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ @@ -35,60 +33,58 @@ RUN apt-get update -qq \ RUN mkdir -p ghdl && cd ghdl \ && curl -fsSL "$GHDL_URL" | tar xzf - --strip-components=1 \ - && ./configure --prefix="$prefix" --enable-libghdl --enable-synth \ + && ./configure --enable-libghdl --enable-synth \ && make all \ - && make install + && make DESTDIR=/opt/ghdl install +EOF +docker build -t ghdl/synth:latest - <<-EOF FROM ghdl/run:buster-mcode -COPY --from=build $prefix $prefix -ENV PATH $prefix/bin:\$PATH +COPY --from=tmp /opt/ghdl / EOF -travis_finish "ghdl" +gend #-- -travis_start "ghdlsynth" "[Build] ghdl/synth:beta" "$ANSI_MAGENTA" +gstart "[Build] ghdl/synth:beta" "$ANSI_MAGENTA" docker build -t ghdl/synth:beta . -f- <<-EOF -FROM ghdl/synth:yosys-gnat AS build -COPY --from=ghdl/synth:latest $prefix $prefix +FROM ghdl/cache:yosys-gnat AS build +COPY --from=tmp /opt/ghdl /opt/ghdl COPY . /ghdlsynth -RUN cd /ghdlsynth \ - && export PATH=\$PATH:$prefix/bin \ +RUN cp -vr /opt/ghdl/* / \ + && cd /ghdlsynth \ && make \ - && cp ghdl.so $prefix/lib/ghdl_yosys.so + && cp ghdl.so /opt/ghdl/usr/local/lib/ghdl_yosys.so -FROM ghdl/synth:yosys-gnat -COPY --from=build $prefix $prefix -ENV PATH $prefix/bin:\$PATH +FROM ghdl/cache:yosys-gnat +COPY --from=build /opt/ghdl / RUN yosys-config --exec mkdir -p --datdir/plugins \ - && yosys-config --exec ln -s $prefix/lib/ghdl_yosys.so --datdir/plugins/ghdl.so + && yosys-config --exec ln -s /usr/local/lib/ghdl_yosys.so --datdir/plugins/ghdl.so EOF -travis_finish "ghdlsynth" +gend #--- -travis_start "formal" "[Build] ghdl/synth:formal" "$ANSI_MAGENTA" +gstart "[Build] ghdl/synth:formal" "$ANSI_MAGENTA" docker build -t ghdl/synth:formal . -f- <<-EOF FROM ghdl/synth:beta -COPY --from=ghdl/cache:formal ./z3 /opt/z3 -COPY --from=ghdl/cache:formal ./symbiyosys /usr/local +COPY --from=ghdl/cache:formal ./z3 / +COPY --from=ghdl/cache:formal ./symbiyosys / RUN apt-get update -qq \ && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ python3 \ && apt-get autoclean && apt-get clean && apt-get -y autoremove \ && rm -rf /var/lib/apt/lists/* - -ENV PATH=/opt/z3/bin:\$PATH EOF -travis_finish "formal" +gend "formal" #--- printf "${ANSI_MAGENTA}[Test] testsuite ${ANSI_NOCOLOR}\n" -docker run --rm -t -e TRAVIS=$TRAVIS -v /$(pwd)://src -w //src -e YOSYS='yosys -m ghdl' ghdl/synth:formal bash -c "$(cat <<EOF +docker run --rm -t -e CI -v /$(pwd)://src -w //src -e YOSYS='yosys -m ghdl' ghdl/synth:formal bash -c "$(cat <<EOF ./testsuite/testsuite.sh EOF )" diff --git a/ice40hx8k/leds.vhdl b/examples/ice40hx8k/leds.vhdl index 557585b..557585b 100644 --- a/ice40hx8k/leds.vhdl +++ b/examples/ice40hx8k/leds.vhdl diff --git a/ice40hx8k/pinmap.pcf b/examples/ice40hx8k/pinmap.pcf index 6862c43..6862c43 100644 --- a/ice40hx8k/pinmap.pcf +++ b/examples/ice40hx8k/pinmap.pcf diff --git a/ice40hx8k/spin1.vhdl b/examples/ice40hx8k/spin1.vhdl index 7c50586..7c50586 100644 --- a/ice40hx8k/spin1.vhdl +++ b/examples/ice40hx8k/spin1.vhdl diff --git a/ice40hx8k/spin2.vhdl b/examples/ice40hx8k/spin2.vhdl index ccdab8b..ccdab8b 100644 --- a/ice40hx8k/spin2.vhdl +++ b/examples/ice40hx8k/spin2.vhdl diff --git a/icestick/blink.vhdl b/examples/icestick/blink.vhdl index d7e6dd4..d7e6dd4 100644 --- a/icestick/blink.vhdl +++ b/examples/icestick/blink.vhdl diff --git a/icestick/fixed1.vhdl b/examples/icestick/fixed1.vhdl index b1bbf4b..b1bbf4b 100644 --- a/icestick/fixed1.vhdl +++ b/examples/icestick/fixed1.vhdl diff --git a/icestick/leds.pcf b/examples/icestick/leds.pcf index 397bdc4..397bdc4 100644 --- a/icestick/leds.pcf +++ b/examples/icestick/leds.pcf diff --git a/icestick/leds.vhdl b/examples/icestick/leds.vhdl index 95aa5cf..95aa5cf 100644 --- a/icestick/leds.vhdl +++ b/examples/icestick/leds.vhdl diff --git a/icestick/multi1.vhdl b/examples/icestick/multi1.vhdl index a304765..a304765 100644 --- a/icestick/multi1.vhdl +++ b/examples/icestick/multi1.vhdl diff --git a/icestick/multi2.vhdl b/examples/icestick/multi2.vhdl index 78bf298..78bf298 100644 --- a/icestick/multi2.vhdl +++ b/examples/icestick/multi2.vhdl diff --git a/icestick/rotate1.vhdl b/examples/icestick/rotate1.vhdl index 34c7afd..34c7afd 100644 --- a/icestick/rotate1.vhdl +++ b/examples/icestick/rotate1.vhdl diff --git a/icestick/rotate2.vhdl b/examples/icestick/rotate2.vhdl index e51ec6c..e51ec6c 100644 --- a/icestick/rotate2.vhdl +++ b/examples/icestick/rotate2.vhdl diff --git a/icestick/rotate3.vhdl b/examples/icestick/rotate3.vhdl index 213512f..213512f 100644 --- a/icestick/rotate3.vhdl +++ b/examples/icestick/rotate3.vhdl diff --git a/icestick/rotate4.vhdl b/examples/icestick/rotate4.vhdl index e89aaa5..e89aaa5 100644 --- a/icestick/rotate4.vhdl +++ b/examples/icestick/rotate4.vhdl diff --git a/icestick/spin1.vhdl b/examples/icestick/spin1.vhdl index 79e305c..79e305c 100644 --- a/icestick/spin1.vhdl +++ b/examples/icestick/spin1.vhdl diff --git a/icestick/spin2.vhdl b/examples/icestick/spin2.vhdl index 0f23964..0f23964 100644 --- a/icestick/spin2.vhdl +++ b/examples/icestick/spin2.vhdl diff --git a/icestick/uart/README.md b/examples/icestick/uart/README.md index b53def6..b53def6 100755 --- a/icestick/uart/README.md +++ b/examples/icestick/uart/README.md diff --git a/icestick/uart/hdl/uart_rx.vhd b/examples/icestick/uart/hdl/uart_rx.vhd index 5f488cc..5f488cc 100755 --- a/icestick/uart/hdl/uart_rx.vhd +++ b/examples/icestick/uart/hdl/uart_rx.vhd diff --git a/icestick/uart/hdl/uart_top.vhd b/examples/icestick/uart/hdl/uart_top.vhd index 889a3a0..889a3a0 100755 --- a/icestick/uart/hdl/uart_top.vhd +++ b/examples/icestick/uart/hdl/uart_top.vhd diff --git a/icestick/uart/hdl/uart_tx.vhd b/examples/icestick/uart/hdl/uart_tx.vhd index b6c5800..b6c5800 100755 --- a/icestick/uart/hdl/uart_tx.vhd +++ b/examples/icestick/uart/hdl/uart_tx.vhd diff --git a/icestick/uart/syn/constraints/uart.pcf b/examples/icestick/uart/syn/constraints/uart.pcf index e3e5016..e3e5016 100755 --- a/icestick/uart/syn/constraints/uart.pcf +++ b/examples/icestick/uart/syn/constraints/uart.pcf diff --git a/icestick/uart/syn/synth.sh b/examples/icestick/uart/syn/synth.sh index 884f1b6..884f1b6 100755 --- a/icestick/uart/syn/synth.sh +++ b/examples/icestick/uart/syn/synth.sh diff --git a/examples/icezum/Makefile b/examples/icezum/Makefile new file mode 100644 index 0000000..ab6f5d7 --- /dev/null +++ b/examples/icezum/Makefile @@ -0,0 +1,23 @@ +PROJ ?= blink +PIN_DEF = icezum.pcf +DEVICE = hx1k + +all: report bin + +json: $(PROJ).vhdl + yosys -m ghdl -p 'ghdl $(PROJ).vhdl -e $(PROJ); synth_ice40 -json $@' + +asc: $(PIN_DEF) json + nextpnr-ice40 --$(DEVICE) --json json --pcf $(PIN_DEF) --asc $@ + +bin: asc + icepack $< $@ + +report: asc + icetime -d $(DEVICE) -mtr $@ $< + +clean: + rm -f json asc bin report work-obj93.cf + +.SECONDARY: +.PHONY: all prog clean diff --git a/examples/icezum/blink.vhdl b/examples/icezum/blink.vhdl new file mode 100644 index 0000000..81c32ed --- /dev/null +++ b/examples/icezum/blink.vhdl @@ -0,0 +1,35 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity blink is + port ( + clk : in std_logic; + led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic + ); +end blink; + +architecture synth of blink is + signal blink: std_logic; +begin + process (clk) + variable cnt : unsigned (23 downto 0); -- 3_000_000 requires 24 bits + begin + if rising_edge(clk) then + if cnt = 2_999_999 then + cnt := x"000000"; + blink <= not blink; + else + cnt := cnt + 1; + end if; + end if; + end process; + led0 <= blink; + led1 <= blink; + led2 <= blink; + led3 <= blink; + led4 <= blink; + led5 <= blink; + led6 <= blink; + led7 <= blink; +end synth; diff --git a/icezum/counter-8bits/counter8.vhdl b/examples/icezum/counter.vhdl index 4c5017e..9cc4d7e 100644 --- a/icezum/counter-8bits/counter8.vhdl +++ b/examples/icezum/counter.vhdl @@ -2,20 +2,19 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; -entity counter8 is - port (clk : in std_logic; - led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic); -end counter8; - -architecture synth of counter8 is - +entity counter is + port ( + clk : in std_logic; + led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic + ); +end counter; + +architecture synth of counter is signal clk_6hz : std_logic; - begin - -- Presscaler prescaler: process(clk) - variable timer : unsigned (20 downto 0):=(others=>'0'); + variable timer : unsigned (20 downto 0) := (others=>'0'); begin if rising_edge(clk) then timer := timer + 1; @@ -29,10 +28,8 @@ begin begin if rising_edge(clk_6hz) then temp:= temp + 1; - -- Show the counter on the icezum Alhambra leds (led7, led6, led5, led4, led3, led2, led1, led0) <= temp; end if; end process; - end synth; diff --git a/icezum/blink/blink.pcf b/examples/icezum/icezum.pcf index 2f686f6..9ea27ad 100644 --- a/icezum/blink/blink.pcf +++ b/examples/icezum/icezum.pcf @@ -1,11 +1,13 @@ -set_io led0 95
-set_io led1 96
-set_io led2 97
-set_io led3 98
-set_io led4 99
-set_io led5 101
-set_io led6 102
-set_io led7 104
-set_io clk 21
-
-
+set_io sw1 10 +set_io sw2 11 + +set_io clk 21 + +set_io led0 95 +set_io led1 96 +set_io led2 97 +set_io led3 98 +set_io led4 99 +set_io led5 101 +set_io led6 102 +set_io led7 104 diff --git a/icezum/led_on/led_on.vhdl b/examples/icezum/led_on.vhdl index 49a88ad..a67ead4 100644 --- a/icezum/led_on/led_on.vhdl +++ b/examples/icezum/led_on.vhdl @@ -8,13 +8,8 @@ end led_on; architecture test of led_on is begin - -- Turn on the Led0 led0 <= '1'; - -- Turn off the other leds (led1, led2, led3, led4, led5, led6, led7) <= std_logic_vector'("0000000"); - end test; - - diff --git a/icezum/pushbutton/pushbutton.vhdl b/examples/icezum/pushbutton.vhdl index 8ad516e..55ede2f 100644 --- a/icezum/pushbutton/pushbutton.vhdl +++ b/examples/icezum/pushbutton.vhdl @@ -3,12 +3,16 @@ use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity pushbutton is - port (sw1 : in std_logic; - led0, led7 : out std_logic); + port ( + sw1, sw2 : in std_logic; + led0, led7 : out std_logic + ); end pushbutton; architecture synth of pushbutton is + signal a : std_logic; begin - led0 <= sw1; - led7 <= not sw1; + a <= sw1 and sw2; + led0 <= a; + led7 <= not a; end synth; diff --git a/examples/icezum/test.sh b/examples/icezum/test.sh new file mode 100755 index 0000000..72da526 --- /dev/null +++ b/examples/icezum/test.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +cd $(dirname $0) + +DOCKER_CMD="docker run --rm -v /$(pwd)://wrk -w //wrk" + +mkdir -p build + +for prj in blink counter led_on pushbutton; do + $DOCKER_CMD ghdl/synth:beta yosys -m ghdl -p "ghdl $prj.vhdl -e $prj; synth_ice40 -json build/json" + $DOCKER_CMD ghdl/synth:nextpnr nextpnr-ice40 --hx1k --json build/json --pcf icezum.pcf --asc build/asc + $DOCKER_CMD ghdl/synth:icestorm icepack build/asc build/$prj.bin +done diff --git a/icezum/blink/Makefile b/icezum/blink/Makefile deleted file mode 100644 index e7c2964..0000000 --- a/icezum/blink/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PROJ = blink -PIN_DEF = blink.pcf -DEVICE = hx1k - -all: $(PROJ).rpt $(PROJ).bin - -%.blif: %.vhdl - ghdl -a $(PROJ).vhdl - yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@' - - -%.asc: $(PIN_DEF) %.blif - arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ - -%.bin: %.asc - icepack $< $@ - -%.rpt: %.asc - icetime -d $(DEVICE) -mtr $@ $< - -prog: $(PROJ).bin - iceprog $< - -sudo-prog: $(PROJ).bin - @echo 'Executing prog as root!!!' - sudo iceprog $< - -clean: - rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin work-obj93.cf - -.SECONDARY: -.PHONY: all prog clean diff --git a/icezum/blink/README.md b/icezum/blink/README.md deleted file mode 100644 index e61330b..0000000 --- a/icezum/blink/README.md +++ /dev/null @@ -1,16 +0,0 @@ -A hello world example for the **Icezum Alhambra board** -It just blinks all the leds - -Execute - -```sh -$ make -``` - -for synthesizing the example and - -```sh -$ make prog -``` - -for programing the board diff --git a/icezum/blink/blink.vhdl b/icezum/blink/blink.vhdl deleted file mode 100644 index 9279622..0000000 --- a/icezum/blink/blink.vhdl +++ /dev/null @@ -1,35 +0,0 @@ -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -entity blink is - port (clk : in std_logic; - led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic); -end blink; - -architecture synth of blink is - signal clk_4hz: std_logic; -begin - process (clk) - -- 3_000_000 is 0x2dc6c0 - variable counter : unsigned (23 downto 0); - begin - if rising_edge(clk) then - if counter = 2_999_999 then - counter := x"000000"; - clk_4hz <= not clk_4hz; - else - counter := counter + 1; - end if; - end if; - end process; - - led0 <= clk_4hz; - led1 <= clk_4hz; - led2 <= clk_4hz; - led3 <= clk_4hz; - led4 <= clk_4hz; - led5 <= clk_4hz; - led6 <= clk_4hz; - led7 <= clk_4hz; -end synth; diff --git a/icezum/counter-8bits/Makefile b/icezum/counter-8bits/Makefile deleted file mode 100644 index c618b42..0000000 --- a/icezum/counter-8bits/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PROJ = counter8 -PIN_DEF = counter8.pcf -DEVICE = hx1k - -all: $(PROJ).rpt $(PROJ).bin - -%.blif: %.vhdl - ghdl -a $(PROJ).vhdl - yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@' - - -%.asc: $(PIN_DEF) %.blif - arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ - -%.bin: %.asc - icepack $< $@ - -%.rpt: %.asc - icetime -d $(DEVICE) -mtr $@ $< - -prog: $(PROJ).bin - iceprog $< - -sudo-prog: $(PROJ).bin - @echo 'Executing prog as root!!!' - sudo iceprog $< - -clean: - rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin work-obj93.cf - -.SECONDARY: -.PHONY: all prog clean diff --git a/icezum/counter-8bits/README.md b/icezum/counter-8bits/README.md deleted file mode 100644 index 4549251..0000000 --- a/icezum/counter-8bits/README.md +++ /dev/null @@ -1,16 +0,0 @@ -An example for the **Icezum Alhambra board** -A binary counter shown in the 8 test leds - -Execute - -```sh -$ make -``` - -for synthesizing the example and - -```sh -$ make prog -``` - -for programing the board diff --git a/icezum/counter-8bits/counter8.pcf b/icezum/counter-8bits/counter8.pcf deleted file mode 100644 index 9d25064..0000000 --- a/icezum/counter-8bits/counter8.pcf +++ /dev/null @@ -1,9 +0,0 @@ -set_io --warn-no-port led0 95 # output
-set_io --warn-no-port led1 96 # output
-set_io --warn-no-port led2 97 # output
-set_io --warn-no-port led3 98 # output
-set_io --warn-no-port led4 99 # output
-set_io --warn-no-port led5 101 # output
-set_io --warn-no-port led6 102 # output
-set_io --warn-no-port led7 104 # output
-set_io --warn-no-port clk 21
diff --git a/icezum/led_on/Makefile b/icezum/led_on/Makefile deleted file mode 100644 index b85feb3..0000000 --- a/icezum/led_on/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -PROJ = led_on -PIN_DEF = led_on.pcf -DEVICE = hx1k - -all: $(PROJ).rpt $(PROJ).bin - -%.blif: %.vhdl - ghdl -a $(PROJ).vhdl - yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@' - -%.asc: $(PIN_DEF) %.blif - arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ - -%.bin: %.asc - icepack $< $@ - -%.rpt: %.asc - icetime -d $(DEVICE) -mtr $@ $< - -prog: $(PROJ).bin - iceprog $< - -sudo-prog: $(PROJ).bin - @echo 'Executing prog as root!!!' - sudo iceprog $< - -clean: - rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin work-obj93.cf - -.SECONDARY: -.PHONY: all prog clean diff --git a/icezum/led_on/README.md b/icezum/led_on/README.md deleted file mode 100644 index 9073c11..0000000 --- a/icezum/led_on/README.md +++ /dev/null @@ -1,16 +0,0 @@ -A hello world example for the **Icezum Alhambra board** -It just turn on the led0 and turn off the others - -Execute - -```sh -$ make -``` - -for synthesizing the example and - -```sh -$ make prog -``` - -for programing the board diff --git a/icezum/led_on/led_on.pcf b/icezum/led_on/led_on.pcf deleted file mode 100644 index 522e201..0000000 --- a/icezum/led_on/led_on.pcf +++ /dev/null @@ -1,9 +0,0 @@ -set_io led0 95
-set_io led1 96
-set_io led2 97
-set_io led3 98
-set_io led4 99
-set_io led5 101
-set_io led6 102
-set_io led7 104
-
diff --git a/icezum/pushbutton/Makefile b/icezum/pushbutton/Makefile deleted file mode 100644 index d483e9a..0000000 --- a/icezum/pushbutton/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PROJ = pushbutton -PIN_DEF = $(PROJ).pcf -DEVICE = hx1k - -all: $(PROJ).rpt $(PROJ).bin - -%.blif: %.vhdl - ghdl -a $(PROJ).vhdl - yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@' - - -%.asc: $(PIN_DEF) %.blif - arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ - -%.bin: %.asc - icepack $< $@ - -%.rpt: %.asc - icetime -d $(DEVICE) -mtr $@ $< - -prog: $(PROJ).bin - iceprog $< - -sudo-prog: $(PROJ).bin - @echo 'Executing prog as root!!!' - sudo iceprog $< - -clean: - rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin work-obj93.cf - -.SECONDARY: -.PHONY: all prog clean diff --git a/icezum/pushbutton/README.md b/icezum/pushbutton/README.md deleted file mode 100644 index 6aba730..0000000 --- a/icezum/pushbutton/README.md +++ /dev/null @@ -1,17 +0,0 @@ -A hello world example for the **Icezum Alhambra board** -Testing the sw1 pushbutton. The state of the button and its negated are wired -to led0 and led7 respectively - -Execute - -```sh -$ make -``` - -for synthesizing the example and - -```sh -$ make prog -``` - -for programing the board diff --git a/icezum/pushbutton/pushbutton.pcf b/icezum/pushbutton/pushbutton.pcf deleted file mode 100644 index 807307f..0000000 --- a/icezum/pushbutton/pushbutton.pcf +++ /dev/null @@ -1,7 +0,0 @@ -set_io sw1 10
-set_io led0 95
-set_io led7 104
-
-
-
-
diff --git a/icezum/pushbutton_and/Makefile b/icezum/pushbutton_and/Makefile deleted file mode 100644 index 2042685..0000000 --- a/icezum/pushbutton_and/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PROJ = pushbutton_and -PIN_DEF = $(PROJ).pcf -DEVICE = hx1k - -all: $(PROJ).rpt $(PROJ).bin - -%.blif: %.vhdl - ghdl -a $(PROJ).vhdl - yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@' - - -%.asc: $(PIN_DEF) %.blif - arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ - -%.bin: %.asc - icepack $< $@ - -%.rpt: %.asc - icetime -d $(DEVICE) -mtr $@ $< - -prog: $(PROJ).bin - iceprog $< - -sudo-prog: $(PROJ).bin - @echo 'Executing prog as root!!!' - sudo iceprog $< - -clean: - rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin work-obj93.cf - -.SECONDARY: -.PHONY: all prog clean diff --git a/icezum/pushbutton_and/README.md b/icezum/pushbutton_and/README.md deleted file mode 100644 index b4734c5..0000000 --- a/icezum/pushbutton_and/README.md +++ /dev/null @@ -1,17 +0,0 @@ -A hello world example for the **Icezum Alhambra board** -Testing the sw1 and sw1 pushbutton with an AND gate. The state of the AND -and its negated are wired to the led0 and led7 respectively - -Execute - -```sh -$ make -``` - -for synthesizing the example and - -```sh -$ make prog -``` - -for programing the board diff --git a/icezum/pushbutton_and/pushbutton_and.pcf b/icezum/pushbutton_and/pushbutton_and.pcf deleted file mode 100644 index 31883fc..0000000 --- a/icezum/pushbutton_and/pushbutton_and.pcf +++ /dev/null @@ -1,4 +0,0 @@ -set_io sw1 10
-set_io sw2 11
-set_io led0 95
-set_io led7 104
diff --git a/icezum/pushbutton_and/pushbutton_and.vhdl b/icezum/pushbutton_and/pushbutton_and.vhdl deleted file mode 100644 index 0a9831d..0000000 --- a/icezum/pushbutton_and/pushbutton_and.vhdl +++ /dev/null @@ -1,18 +0,0 @@ -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -entity pushbutton_and is - port (sw1, sw2 : in std_logic; - led0, led7 : out std_logic); -end pushbutton_and; - -architecture synth of pushbutton_and is - -signal a : std_logic; - -begin - a <= sw1 and sw2; - led0 <= a; - led7 <= not a; -end synth; diff --git a/testsuite/examples/test-ice40hx8k/testsuite.sh b/testsuite/examples/test-ice40hx8k/testsuite.sh index 3bf7f9c..52e061a 100755 --- a/testsuite/examples/test-ice40hx8k/testsuite.sh +++ b/testsuite/examples/test-ice40hx8k/testsuite.sh @@ -3,7 +3,7 @@ topdir=../.. . $topdir/testenv.sh -src=../../../ice40hx8k +src=../../../examples/ice40hx8k synth_ice40 $src/leds.vhdl $src/spin1.vhdl -e leds synth_ice40 $src/leds.vhdl $src/spin2.vhdl -e leds diff --git a/testsuite/examples/test-icestick/testsuite.sh b/testsuite/examples/test-icestick/testsuite.sh index 025e8c2..7184fcc 100755 --- a/testsuite/examples/test-icestick/testsuite.sh +++ b/testsuite/examples/test-icestick/testsuite.sh @@ -3,7 +3,7 @@ topdir=../.. . $topdir/testenv.sh -src=../../../icestick +src=../../../examples/icestick # spin2 diff --git a/testsuite/examples/test-icezum/testsuite.sh b/testsuite/examples/test-icezum/testsuite.sh index 4906689..5386f10 100755 --- a/testsuite/examples/test-icezum/testsuite.sh +++ b/testsuite/examples/test-icezum/testsuite.sh @@ -3,11 +3,11 @@ topdir=../.. . $topdir/testenv.sh -src=../../../icezum +src=../../../examples/icezum -synth_ice40 $src/led_on/led_on.vhdl -e led_on -synth_ice40 $src/blink/blink.vhdl -e blink -synth_ice40 $src/pushbutton/pushbutton.vhdl -e pushbutton -synth_ice40 $src/pushbutton_and/pushbutton_and.vhdl -e pushbutton_and +synth_ice40 $src/led_on.vhdl -e led_on +synth_ice40 $src/blink.vhdl -e blink +synth_ice40 $src/pushbutton.vhdl -e pushbutton +synth_ice40 $src/counter.vhdl -e counter clean diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index 5dd7811..0046d49 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -47,18 +47,18 @@ analyze () synth_import () { - travis_start "synth" "Synthesize $*" + gstart "Synthesize $*" run_yosys -q -p "ghdl $*" status=$? - travis_finish "synth" + gend return $status } synth_ice40 () { - travis_start "synth" "Synthesize $*" + gstart "synth" "Synthesize $*" run_yosys -q -p "ghdl $*; synth_ice40 -blif out.blif" - travis_finish "synth" + gend } synth () @@ -68,9 +68,9 @@ synth () formal () { - travis_start "formal" "Verify $@" + gstart "Verify $@" run_symbiyosys -f -d work $@.sby - travis_finish "formal" + gend } clean () @@ -19,54 +19,34 @@ enable_color #-- print_start() { - COL="$ANSI_BLUE" - if [ "x$3" != "x" ]; then - COL="$3" + if [ "x$2" != "x" ]; then + COL="$2" + elif [ "x$BASE_COL" != "x" ]; then + COL="$BASE_COL" + else + COL="$ANSI_MAGENTA" fi - printf "$COL> $2$ANSI_NOCOLOR\n" + printf "${COL}${1}$ANSI_NOCOLOR\n" } -travis_start () { +gstart () { print_start "$@" } -travis_finish () { +gend () { : } -[ -n "$TRAVIS" ] && { - # This is a trimmed down copy of - # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh - travis_time_start() { - # `date +%N` returns the date in nanoseconds. It is used as a replacement for $RANDOM, which is only available in bash. - travis_timer_id=`date +%N` - travis_start_time=$(travis_nanoseconds) - echo "travis_time:start:$travis_timer_id" - } - travis_time_finish() { - travis_end_time=$(travis_nanoseconds) - local duration=$(($travis_end_time-$travis_start_time)) - echo "travis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration" - } +if [ -n "$GITHUB_EVENT_PATH" ]; then + export CI=true +fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then - travis_nanoseconds() { - date -u '+%s000000000' - } - else - travis_nanoseconds() { - date -u '+%s%N' - } - fi - - travis_start () { - echo "travis_fold:start:$1" - travis_time_start +[ -n "$CI" ] && { + gstart () { + printf '::group::' print_start "$@" } - travis_finish () { - travis_time_finish - echo "travis_fold:end:$1" + gend () { + echo '::endgroup::' } - -} || echo "INFO: not in Travis CI" +} || echo "INFO: not in CI" |