cfm
cfm copied to clipboard
Port to Clash 1.4.2
Would be a shame to let this bit-rot. It passes all the tests when I run stack run
.
make
doesn't work with my versions of yosys, arachne-pnr, and the icestorm tools though.
$ yosys -V
Yosys 0.7 (git sha1 61f6811, gcc 6.2.0-11ubuntu1 -O2 -fdebug-prefix-map=/build/yosys-OIL3SR/yosys-0.7=. -fstack-protector-strong -fPIC -Os)
$ arachne-pnr -v
arachne-pnr 0.1+20151224git1a4fdf9 (git sha1 1a4fdf9, g++ 6.2.0-10ubuntu1 -O2 -fdebug-prefix-map=/build/arachne-pnr-8ETCVz/arachne-pnr-0.1+20160813git52e69ed=. -fPIE -fstack-protector-strong)
First I have to do:
diff --git a/rtl/syn/icoboard.pcf b/rtl/syn/icoboard.pcf
index 8a7ef6e..0950d1a 100644
index 8a7ef6e..0950d1a 100644
--- a/rtl/syn/icoboard.pcf
+++ b/rtl/syn/icoboard.pcf
@@ -57,12 +57,12 @@ set_io --warn-no-port sram_ub_n J3
set_io vga_hsync N9
set_io vga_vsync L9
-set_io vga_b[3] N6
-set_io vga_b[4] M8
-set_io vga_g[3] N7
-set_io vga_g[4] G5
-set_io vga_r[3] L7
-set_io vga_r[4] P9
+set_io vga_b[0] N6
+set_io vga_b[1] M8
+set_io vga_g[0] N7
+set_io vga_g[1] G5
+set_io vga_r[0] L7
+set_io vga_r[1] P9
set_io sd_cs_n A5
set_io sd_mosi A2
otherwise I get:
arachne-pnr -d 8k -p rtl/syn/icoboard.pcf build/ico.blif -o build/ico.asc.tmp -s 1
seed: 1
device: 8k
read_chipdb +/share/arachne-pnr/chipdb-8k.bin...
supported packages: cb132, cb132:4k, cm121, cm121:4k, cm225, cm225:4k, cm81, cm81:4k, ct256, tq144:4k
read_blif build/ico.blif...
prune...
read_pcf rtl/syn/icoboard.pcf...
rtl/syn/icoboard.pcf:10: warning: no port `rts_n' in top-level module `top', constraint ignored.
rtl/syn/icoboard.pcf:60: fatal error: no port `vga_b[3]' in top-level module `top'
Makefile:82: recipe for target 'build/ico.asc' failed
make: *** [build/ico.asc] Error 1
but after fixing that I get problems where the BRAM content generated by cfm-as
is "too small":
stack --silent exec cfm-as bios/boot.fs build/ico-boot.hex
ok
cells used: 129
0000 006f NotLit (Jump 0_0000_0110_1111)
0002 6033 NotLit (ALU False T False False True ISpace 0 -1)
0004 710f NotLit (ALU True N False False False MSpace -1 -1)
0006 8001 Lit 000_0000_0000_0001
0008 7a0f NotLit (ALU True NMinusT False False False MSpace -1 -1)
000a 8001 Lit 000_0000_0000_0001
000c 7d0f NotLit (ALU True NLshiftT False False False MSpace -1 -1)
000e 8800 Lit 000_1000_0000_0000
0010 8004 Lit 000_0000_0000_0100
0012 0001 NotLit (Jump 0_0000_0000_0001)
0014 8800 Lit 000_1000_0000_0000
0016 8002 Lit 000_0000_0000_0010
0018 0001 NotLit (Jump 0_0000_0000_0001)
001a 6180 NotLit (ALU False N True False False MSpace 0 0)
001c 8400 Lit 000_0100_0000_0000
001e 6181 NotLit (ALU False N True False False MSpace 0 1)
0020 800f Lit 000_0000_0000_1111
0022 6903 NotLit (ALU False NRshiftT False False False MSpace 0 -1)
0024 2015 NotLit (JumpZ 0_0000_0001_0101)
0026 8002 Lit 000_0000_0000_0010
0028 0016 NotLit (Jump 0_0000_0001_0110)
002a 8004 Lit 000_0000_0000_0100
002c 4001 NotLit (Call 0_0000_0000_0001)
002e 8001 Lit 000_0000_0000_0001
0030 6d03 NotLit (ALU False NLshiftT False False False MSpace 0 -1)
0032 8200 Lit 000_0010_0000_0000
0034 8002 Lit 000_0000_0000_0010
0036 4001 NotLit (Call 0_0000_0000_0001)
0038 a000 Lit 010_0000_0000_0000
003a 6c10 NotLit (ALU False MemAtT False False False ISpace 0 0)
003c 8005 Lit 000_0000_0000_0101
003e 6903 NotLit (ALU False NRshiftT False False False MSpace 0 -1)
0040 8001 Lit 000_0000_0000_0001
0042 6303 NotLit (ALU False TAndN False False False MSpace 0 -1)
0044 6403 NotLit (ALU False TOrN False False False MSpace 0 -1)
0046 8200 Lit 000_0010_0000_0000
0048 8004 Lit 000_0000_0000_0100
004a 4001 NotLit (Call 0_0000_0000_0001)
004c 6180 NotLit (ALU False N True False False MSpace 0 0)
004e 8001 Lit 000_0000_0000_0001
0050 6a03 NotLit (ALU False NMinusT False False False MSpace 0 -1)
0052 6081 NotLit (ALU False T True False False MSpace 0 1)
0054 202c NotLit (JumpZ 0_0000_0010_1100)
0056 000d NotLit (Jump 0_0000_0000_1101)
0058 710f NotLit (ALU True N False False False MSpace -1 -1)
005a 8010 Lit 000_0000_0001_0000
005c 000d NotLit (Jump 0_0000_0000_1101)
005e 402d NotLit (Call 0_0000_0010_1101)
0060 710f NotLit (ALU True N False False False MSpace -1 -1)
0062 6781 NotLit (ALU False NEqT True False False MSpace 0 1)
0064 2035 NotLit (JumpZ 0_0000_0011_0101)
0066 6103 NotLit (ALU False N False False False MSpace 0 -1)
0068 710f NotLit (ALU True N False False False MSpace -1 -1)
006a 8000 Lit 000_0000_0000_0000
006c 402d NotLit (Call 0_0000_0010_1101)
006e 6081 NotLit (ALU False T True False False MSpace 0 1)
0070 8008 Lit 000_0000_0000_1000
0072 6d03 NotLit (ALU False NLshiftT False False False MSpace 0 -1)
0074 6180 NotLit (ALU False N True False False MSpace 0 0)
0076 8008 Lit 000_0000_0000_1000
0078 6903 NotLit (ALU False NRshiftT False False False MSpace 0 -1)
007a 6403 NotLit (ALU False TOrN False False False MSpace 0 -1)
007c 6180 NotLit (ALU False N True False False MSpace 0 0)
007e 6023 NotLit (ALU False T False False True MSpace 0 -1)
0080 8002 Lit 000_0000_0000_0010
0082 6203 NotLit (ALU False TPlusN False False False MSpace 0 -1)
0084 0031 NotLit (Jump 0_0000_0011_0001)
0086 4007 NotLit (Call 0_0000_0000_0111)
0088 d4ff Lit 101_0100_1111_1111
008a 6600 NotLit (ALU False NotT False False False MSpace 0 0)
008c 402f NotLit (Call 0_0000_0010_1111)
008e 8000 Lit 000_0000_0000_0000
0090 402f NotLit (Call 0_0000_0010_1111)
0092 8000 Lit 000_0000_0000_0000
0094 8008 Lit 000_0000_0000_1000
0096 400d NotLit (Call 0_0000_0000_1101)
0098 400a NotLit (Call 0_0000_0000_1010)
009a 6081 NotLit (ALU False T True False False MSpace 0 1)
009c 8000 Lit 000_0000_0000_0000
009e 6703 NotLit (ALU False NEqT False False False MSpace 0 -1)
00a0 6180 NotLit (ALU False N True False False MSpace 0 0)
00a2 80ff Lit 000_0000_1111_1111
00a4 6703 NotLit (ALU False NEqT False False False MSpace 0 -1)
00a6 6403 NotLit (ALU False TOrN False False False MSpace 0 -1)
00a8 2056 NotLit (JumpZ 0_0000_0101_0110)
00aa 0043 NotLit (Jump 0_0000_0100_0011)
00ac 700c NotLit (ALU True T False False False MSpace -1 0)
00ae 6081 NotLit (ALU False T True False False MSpace 0 1)
00b0 4005 NotLit (Call 0_0000_0000_0101)
00b2 ffdf Lit 111_1111_1101_1111
00b4 6600 NotLit (ALU False NotT False False False MSpace 0 0)
00b6 6203 NotLit (ALU False TPlusN False False False MSpace 0 -1)
00b8 6130 NotLit (ALU False N False False True ISpace 0 0)
00ba 2060 NotLit (JumpZ 0_0000_0110_0000)
00bc 4003 NotLit (Call 0_0000_0000_0011)
00be 0057 NotLit (Jump 0_0000_0101_0111)
00c0 710f NotLit (ALU True N False False False MSpace -1 -1)
00c2 6081 NotLit (ALU False T True False False MSpace 0 1)
00c4 8038 Lit 000_0000_0011_1000
00c6 6203 NotLit (ALU False TPlusN False False False MSpace 0 -1)
00c8 6181 NotLit (ALU False N True False False MSpace 0 1)
00ca 4005 NotLit (Call 0_0000_0000_0101)
00cc ffcf Lit 111_1111_1100_1111
00ce 6600 NotLit (ALU False NotT False False False MSpace 0 0)
00d0 6203 NotLit (ALU False TPlusN False False False MSpace 0 -1)
00d2 4001 NotLit (Call 0_0000_0000_0001)
00d4 6081 NotLit (ALU False T True False False MSpace 0 1)
00d6 206e NotLit (JumpZ 0_0000_0110_1110)
00d8 4003 NotLit (Call 0_0000_0000_0011)
00da 0061 NotLit (Jump 0_0000_0110_0001)
00dc 710f NotLit (ALU True N False False False MSpace -1 -1)
00de 8007 Lit 000_0000_0000_0111
00e0 4057 NotLit (Call 0_0000_0101_0111)
00e2 8007 Lit 000_0000_0000_0111
00e4 4061 NotLit (Call 0_0000_0110_0001)
00e6 400a NotLit (Call 0_0000_0000_1010)
00e8 4043 NotLit (Call 0_0000_0100_0011)
00ea 4007 NotLit (Call 0_0000_0000_0111)
00ec 8304 Lit 000_0011_0000_0100
00ee 402f NotLit (Call 0_0000_0010_1111)
00f0 8000 Lit 000_0000_0000_0000
00f2 402f NotLit (Call 0_0000_0010_1111)
00f4 c000 Lit 100_0000_0000_0000
00f6 8000 Lit 000_0000_0000_0000
00f8 4031 NotLit (Call 0_0000_0011_0001)
00fa 400a NotLit (Call 0_0000_0000_1010)
00fc 8000 Lit 000_0000_0000_0000
00fe 6147 NotLit (ALU False N False True False MSpace 1 -1)
0100 700c NotLit (ALU True T False False False MSpace -1 0)
Symbols:
0062 (read)
0006 1-
000a 2*
005e >spi
005a >spi>
0014 deselect
00de go
0002 io!
00c2 palette-high
00ae palette-low
0086 poll
0000 reset-vector
000e select
001a spibits
icebram -v rtl/syn/random-256.hex build/ico-boot.hex < build/ico.asc > build/ico-prog.asc
Hexfiles have different number of words! (256 vs. 129)
Makefile:101: recipe for target 'build/ico-prog.asc' failed
make: *** [build/ico-prog.asc] Error 1
Alright, turns out the issue was just my "ancient" versions of all the tools. I've just upgraded to the latest HEADs of the github repo's:
christiaan@DESKTOP-O5QKI8I:~/cfm$ yosys -V
Yosys 0.9+4081 (git sha1 83a21814, clang 6.0.0-1ubuntu2 -fPIC -Os)
christiaan@DESKTOP-O5QKI8I:~/cfm$ arachne-pnr -v
arachne-pnr 0.1+328+0 (git sha1 c40fb22, g++ 7.5.0-3ubuntu1~18.04 -O2
And make all
gets through to the end.