├── .gitignore
├── Makefile
├── README.md
├── artix.xdc
├── arty.xdc
├── autodata
├── .gitignore
├── Makefile
├── allclocks.txt
├── arty.xdc
├── bkram.txt
├── buserr.txt
├── clock.txt
├── clrspio.txt
├── cpuscope.txt
├── dlyarbiter.txt
├── enet.txt
├── enetscope.txt
├── eqspi.txt
├── flashscope.txt
├── global.txt
├── gpio.txt
├── gps.txt
├── icape.txt
├── legalgen.txt
├── mdio.txt
├── mdioscope.txt
├── mem_bkram_only.txt
├── mem_flash_bkram.txt
├── mem_sdram_bkram.txt
├── micron.txt
├── pic.txt
├── pwrcount.txt
├── rtccount.txt
├── rtcdate.txt
├── rtcgps.txt
├── sdram.txt
├── sdspi.txt
├── spansion.txt
├── spio.txt
├── version.txt
├── wboledrgb.txt
├── wbscopc.txt
├── wbscope.txt
├── wbuart.txt
├── wbubus.txt
├── wbuconsole.txt
└── zipmaster.txt
├── bench
└── formal
│ ├── .gitignore
│ ├── enetctrl.gtkw
│ ├── enetctrl.sby
│ └── fwb_slave.v
├── doc
├── Makefile
├── gfx
│ ├── clipped.jpg
│ ├── cputest.png
│ ├── dbg.png
│ ├── flashid.png
│ ├── gps-tracking.png
│ ├── gps-traklog.png
│ ├── image.jpg
│ ├── ipcat-menu.eps
│ ├── ipcat-menu.png
│ ├── mig_01-create.eps
│ ├── mig_01-create.png
│ ├── mig_02-pincompat.eps
│ ├── mig_02-pincompat.png
│ ├── mig_03-memsel.eps
│ ├── mig_03-memsel.png
│ ├── mig_04-mctopts.eps
│ ├── mig_04-mctopts.png
│ ├── mig_05-axiopts.eps
│ ├── mig_05-axiopts.png
│ ├── mig_06-memops.eps
│ ├── mig_06-memops.png
│ ├── mig_07-fpgaopts.eps
│ ├── mig_07-fpgaopts.png
│ ├── mig_08-fpgaopts.eps
│ ├── mig_08-fpgaopts.png
│ ├── mig_09-extops.eps
│ ├── mig_09-extops.png
│ ├── mig_10-ioops.eps
│ ├── mig_10-ioops.png
│ ├── mig_11-loaducf.eps
│ ├── mig_11-loaducf.png
│ ├── mig_12-syssigs.eps
│ ├── mig_12-syssigs.png
│ ├── mig_13-validpins.eps
│ ├── mig_13-validpins.png
│ ├── ntpsrvr-box.dia
│ ├── ntpsrvr-box.png
│ ├── oledrgb-demo.png
│ ├── openarty.eps
│ ├── openarty.jpg
│ ├── openarty.png
│ ├── openmig.eps
│ ├── openmig.png
│ ├── pick-a-part.eps
│ ├── pick-a-part.png
│ ├── proj_dir.eps
│ ├── proj_dir.png
│ └── traking-costs.png
├── gpl-3.0.pdf
├── spec.pdf
└── src
│ ├── GT.eps
│ ├── gpl-3.0.tex
│ ├── gqtekspec.cls
│ └── spec.tex
├── migmem.xdc
├── mkdatev.pl
├── rtl
├── Makefile
├── addrdecode.v
├── bigadd.v
├── bigsmpy.v
├── bigsub.v
├── clrled.v
├── cpu
│ ├── busdelay.v
│ ├── cpudefs.v
│ ├── cpuops.v
│ ├── dblfetch.v
│ ├── dcache.v
│ ├── div.v
│ ├── icontrol.v
│ ├── idecode.v
│ ├── memops.v
│ ├── mpyop.v
│ ├── pfcache.v
│ ├── pipefetch.v
│ ├── pipemem.v
│ ├── prefetch.v
│ ├── slowmpy.v
│ ├── wbarbiter.v
│ ├── wbdblpriarb.v
│ ├── wbdmac.v
│ ├── wbpriarbiter.v
│ ├── wbwatchdog.v
│ ├── zipbones.v
│ ├── zipcounter.v
│ ├── zipcpu.v
│ ├── zipjiffies.v
│ ├── zipsystem.v
│ └── ziptimer.v
├── ctrlspi.v
├── debouncer.v
├── enet
│ ├── addecrc.v
│ ├── addemac.v
│ ├── addepad.v
│ ├── addepreamble.v
│ ├── enetctrl.v
│ ├── enetpackets.v
│ ├── rxecrc.v
│ ├── rxehwmac.v
│ ├── rxeipchk.v
│ ├── rxemin.v
│ ├── rxepreambl.v
│ └── rxewrite.v
├── gpsclock.v
├── gpsclock_tb.v
├── iscachable.v
├── ledbouncer.v
├── lloledrgb.v
├── main.v
├── make.inc
├── memdev.v
├── micron.hex
├── migsdram.v
├── qflexpress.v
├── rtc
│ ├── rtcalarm.v
│ ├── rtcbare.v
│ ├── rtcdate.v
│ ├── rtcgps.v
│ ├── rtclight.v
│ ├── rtcstopwatch.v
│ └── rtctimer.v
├── sdspi
│ ├── llsdspi.v
│ ├── sdspi.v
│ ├── spicmd.v
│ ├── spirxdata.v
│ └── spitxdata.v
├── skidbuffer.v
├── spansion.hex
├── spio.v
├── toplevel.v
├── wbgpio.v
├── wbicapetwo.v
├── wbm2axisp.v
├── wboledrgb.v
├── wbscope
│ ├── wbscopc.v
│ └── wbscope.v
├── wbuart
│ ├── rxuart.v
│ ├── rxuartlite.v
│ ├── txuart.v
│ ├── txuartlite.v
│ ├── ufifo.v
│ └── wbuart.v
├── wbubus
│ ├── wbconsole.v
│ ├── wbubus.v
│ ├── wbucompactlines.v
│ ├── wbucompress.v
│ ├── wbuconsole.v
│ ├── wbudecompress.v
│ ├── wbudeword.v
│ ├── wbuexec.v
│ ├── wbufifo.v
│ ├── wbuidleint.v
│ ├── wbuinput.v
│ ├── wbuoutput.v
│ ├── wbureadcw.v
│ ├── wbusixchar.v
│ └── wbutohex.v
├── wbxbar.v
├── xioddr.v
└── xoddr.v
├── scad
├── arty.scad
├── openarty.png
└── zipcpu.scad
├── sim
└── verilated
│ ├── .gitignore
│ ├── Makefile
│ ├── automaster_tb.cpp
│ ├── byteswap.cpp
│ ├── byteswap.h
│ ├── dbluartsim.cpp
│ ├── dbluartsim.h
│ ├── ddrsdramsim.cpp
│ ├── ddrsdramsim.h
│ ├── enetctrl_tb.cpp
│ ├── enetctrlsim.cpp
│ ├── enetctrlsim.h
│ ├── flashsim.cpp
│ ├── flashsim.h
│ ├── main_tb.cpp
│ ├── memsim.cpp
│ ├── memsim.h
│ ├── oledsim.cpp
│ ├── oledsim.h
│ ├── port.h
│ ├── sdspisim.cpp
│ ├── sdspisim.h
│ ├── tbclock.h
│ ├── testb.h
│ ├── uartsim.cpp
│ ├── uartsim.h
│ ├── vversion.sh
│ ├── zipelf.cpp
│ └── zipelf.h
└── sw
├── .gitignore
├── board
├── .gitignore
├── Makefile
├── arp.c
├── arp.h
├── arty.ld
├── artyram.ld
├── bkram.ld
├── board.ld
├── cmptst.c
├── cputest.c
├── etcnet.h
├── exmulti.c
├── exstartup.c
├── gettysburg.c
├── gpsdump.c
├── hello.c
├── ipcksum.c
├── ipcksum.h
├── ledcolors.h
├── mug.c
├── oledtest.c
├── protoconst.h
├── sdram.ld
├── simple_ping.c
├── splash.c
├── txfns.c
├── txfns.h
└── zipcpu.c
├── host
├── .gitignore
├── Makefile
├── byteswap.cpp
├── byteswap.h
├── cpuscope.cpp
├── crctest.cpp
├── dcachescope.cpp
├── devbus.h
├── divutb.c
├── dumpflash.cpp
├── dumpuart.cpp
├── eqspiscope.cpp
├── erxscope.cpp
├── etxscope.cpp
├── flashdrvr.cpp
├── flashdrvr.h
├── flashid.cpp
├── flashid.sh
├── flashscope.cpp
├── llcomms.cpp
├── llcomms.h
├── manping.cpp
├── mdioscope.cpp
├── netsetup.cpp
├── netuart.cpp
├── port.h
├── program.sh
├── qflexpress.gtkw
├── regdefs.cpp
├── regdefs.h
├── scopecls.cpp
├── scopecls.h
├── sdramscope.cpp
├── ttybus.cpp
├── ttybus.h
├── twoc.cpp
├── twoc.h
├── wbprogram.cpp
├── wbregs.cpp
├── wbsettime.cpp
├── zipdbg.cpp
├── zipelf.cpp
├── zipelf.h
├── zipload.cpp
├── zipstate.cpp
├── zopcodes.cpp
├── zopcodes.h
└── zprog.sh
├── loopy.sh
├── startupex.sh
└── zlib
├── .gitignore
├── Makefile
├── board.h
├── bootloader.h
├── crt0.c
├── syscalls.c
├── udiv.c
├── umod.c
├── zipcpu.h
└── zipsys.h
/.gitignore:
--------------------------------------------------------------------------------
1 | legal.txt
2 | *-arty.tjz
3 | .svn
4 | xilinx
5 | obj_dir
6 | obj-pc
7 | obj-zip
8 | *.o
9 | *.a
10 | *.vcd
11 | .swp
12 | .*.swp
13 | .*.swo
14 | svn-commit*
15 | *_tb
16 | *_tb.dbl
17 | *dbg.txt
18 | *dump.txt
19 | *debug.txt
20 | archive
21 | tags
22 | tmp
23 | cpudefs.h
24 | vivado.jou
25 | vivado.log
26 | vivado_pid*
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
3 | The purpose of the OpenArty project is to implement a [ZipCPU](http://zipcpu.com/about/zipcpu.html) on an Arty platform, together with open source drivers for all of the Arty peripherals. In my case, that will include drivers for additional PMods that I have purchased for the project. Hence the OpenArty platform with support:
4 |
5 | 1. [Generic flash driver](rtl/qflexpress.v), to include access to all of the [flash's functionality](sw/host/flashdrvr.h) such as being able to read its ID as well as being able to read and set the one time programmable memory. This in addition to being flash manufacturer agnostic. Further, when complete, a [ZipCPU](http://zipcpu.com/about/zipcpu.html) will launch code automatically from the flash on startup.
6 | 2. DDR3 SDRAM (Done)
7 | 3. The Internal Configuration Access Port (ICAPE2), to allow for dynamic (not partial) reconfiguration (Done)
8 | 4. Ethernet (Done)
9 | 5. SD Card. The program currently uses the SDSPI controller, although I intend to upgrade to a full SDIO controller with (hopefully) the same identical or nearly identical interface.
10 | 6. OLEDrgb display. (Done)
11 | 7. GPS clock module, and external USB-UART. (Done)
12 | 8. This leaves one open PMOD port which ... I haven't decided what to connect it to.
13 |
14 | As a demonstration project, I'd love to implement an NTP server within the device. This is a long term goal, however, and a lot needs to be accomplished before I can get there. Still, a $130 NTP server isn't a bad price for an NTP server in your lab. ($99 for the Arty, $25 for the GPS receiver IIRC)
15 |
16 | # Current Status
17 |
18 | This version of the OpenArty project is built around [AutoFPGA](https://github.com/ZipCPU/autofpga). It is designed to be highly reconfigurable, so that you can add (or remove) peripherals quickly and easily. My specific goal is to use [AutoFPGA](https://github.com/ZipCPU/autofpga) to create a project that doesn't require all of the peripherals I've used, but may be instead built with only those peripherals on the board.
19 |
20 | # Repository
21 |
22 | Due to the ongoing issues with [OpenCores](http://opencores.org/project/openarty), the [official OpenArty repository](https://github.com/ZipCPU/openarty)
23 | is being kept on [GitHub](https://github.com), under the [ZipCPU username](https://github.com/ZipCPU).
24 |
25 | # License
26 |
27 | Gisselquist Technology, LLC, is pleased to provide you with this entire
28 | OpenArty project under the [GPLv3 license](doc/gpl-v3.0.pdf). If this doesn't
29 | work for you, please feel free to contact me.
30 |
--------------------------------------------------------------------------------
/autodata/.gitignore:
--------------------------------------------------------------------------------
1 | board.h
2 | *.ld
3 | build.xdc
4 | main.v
5 | regdefs.h
6 | regdefs.cpp
7 | rtl.make.inc
8 | testb.h
9 | toplevel.v
10 | main_tb.cpp
11 | iscachable.v
12 | autofpga.dbg
13 |
--------------------------------------------------------------------------------
/autodata/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: auto-data/Makefile
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: To direct the build of the autofpga automatically generated
8 | ## files. The various configuration files are the *.txt files
9 | ## found in this directory.
10 | ##
11 | ##
12 | ## Creator: Dan Gisselquist, Ph.D.
13 | ## Gisselquist Technology, LLC
14 | ##
15 | ################################################################################
16 | ##
17 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
18 | ##
19 | ## This program is free software (firmware): you can redistribute it and/or
20 | ## modify it under the terms of the GNU General Public License as published
21 | ## by the Free Software Foundation, either version 3 of the License, or (at
22 | ## your option) any later version.
23 | ##
24 | ## This program is distributed in the hope that it will be useful, but WITHOUT
25 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | ## for more details.
28 | ##
29 | ## You should have received a copy of the GNU General Public License along
30 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | ## target there if the PDF file isn't present.) If not, see
32 | ## for a copy.
33 | ##
34 | ## License: GPL, v3, as defined and found on www.gnu.org,
35 | ## http://www.gnu.org/licenses/gpl.html
36 | ##
37 | ##
38 | ################################################################################
39 | ##
40 | ##
41 | .PHONY: all
42 | all: data
43 | #
44 | # Could also depend upon load, if desired, but not necessary
45 | #
46 | # This is the list of components that will form our project. Each file consists
47 | # of parts and pieces of our project that autofpga will copy/paste into our
48 | # main project files.
49 | #
50 | BASE := global.txt icape.txt
51 | AUX := version.txt buserr.txt pic.txt pwrcount.txt
52 | IO := spio.txt clrspio.txt # gpio.txt
53 | RTC := rtcgps.txt rtcdate.txt
54 | DBGBUS := wbuconsole.txt
55 | # MEMORY := bkram.txt sdram.txt micron.txt # spansion.txt # wbhyperram.txt
56 | MEMORY := bkram.txt spansion.txt sdram.txt
57 | CPU := zipmaster.txt
58 | NETWORK := mdio.txt enet.txt
59 | GPS := gps.txt
60 | # SDCARD := sdspi.txt
61 | GFX := wboledrgb.txt
62 | SCOPES := # gpsscope.txt #enetscope.txt mdioscope.txt flashscope.txt cpuscope.txt
63 | LDSCRIPT:= mem_flash_bkram.txt mem_bkram_only.txt mem_sdram_bkram.txt
64 | DATA := allclocks.txt $(BASE) $(AUX) $(IO) $(RTC) \
65 | $(DBGBUS) $(MEMORY) $(CPU) $(NETWORK) $(GPS) $(SDCARD) $(GFX) \
66 | $(SCOPES) $(LDSCRIPT)
67 |
68 | AUTOFPGA := autofpga
69 | $(AUTOFPGA):
70 |
71 | .PHONY: data
72 | data: $(AUTOFPGA) $(DATA)
73 | $(AUTOFPGA) -d -o . $(DATA)
74 |
75 | clean:
76 | rm -f toplevel.v main.v regdefs.h regdefs.cpp board.h board.ld
77 | rm -f rtl.make.inc main_tb.cpp
78 | rm -f dump.txt
79 |
--------------------------------------------------------------------------------
/autodata/bkram.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: bkram.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: To define the interface to a generic block RAM device for the
8 | ## purposes of autofpga.
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=bkram
40 | @DEVID=BKRAM
41 | @$LGMEMSZ=16
42 | @LGMEMSZ.FORMAT=%d
43 | @$NADDR=(1<<(@$THIS.LGMEMSZ-2))
44 | @$NBYTES=(1<<(@$THIS.LGMEMSZ))
45 | @NBYTES.FORMAT=0x%08x
46 | @ACCESS=@$(DEVID)_ACCESS
47 | @SLAVE.TYPE=MEMORY
48 | @SLAVE.BUS=wb
49 | @MAIN.INSERT=
50 | memdev #(.LGMEMSZ(@$THIS.LGMEMSZ), .EXTRACLOCK(1))
51 | @$(PREFIX)i(i_clk, i_reset,
52 | @$(SLAVE.PORTLIST));
53 | @REGS.N=1
54 | @REGS.0= 0 R_@$(DEVID) RAM
55 | @REGDEFS.H.DEFNS=
56 | #define @$(DEVID)BASE @$[0x%08x](REGBASE)
57 | #define @$(DEVID)LEN @$NBYTES
58 | @BDEF.OSDEF=_BOARD_HAS_@$(DEVID)
59 | @MEM.NAME= @$(PREFIX)
60 | @BDEF.OSVAL=extern char _@$(MEM.NAME)[@$NBYTES];
61 | @LD.PERM= wx
62 | @LD.NAME= @$(MEM.NAME)
63 | @RTL.MAKE.GROUP= @$(DEVID)
64 | @RTL.MAKE.FILES= memdev.v
65 | @$NADDRHX = @$NADDR
66 | @NADDRHX.FORMAT= 0x%x
67 | @SIM.INCLUDE=
68 | #include "byteswap.h"
69 | @SIM.DEFINES=
70 | #ifndef VVAR
71 | #ifdef NEW_VERILATOR
72 | #define VVAR(A) main__DOT_ ## A
73 | #else
74 | #define VVAR(A) v__DOT_ ## A
75 | #endif
76 | #endif
77 |
78 | #define block_ram VVAR(_@$(PREFIX)i__DOT__mem)
79 | @SIM.LOAD=
80 | start = start & (-4);
81 | wlen = (wlen+3)&(-4);
82 |
83 | // Need to byte swap data to get it into the memory
84 | char *bswapd = new char[len+8];
85 | memcpy(bswapd, &buf[offset], wlen);
86 | byteswapbuf(len>>2, (uint32_t *)bswapd);
87 | memcpy(&m_core->block_ram[start], bswapd, wlen);
88 | delete bswapd;
89 |
--------------------------------------------------------------------------------
/autodata/buserr.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: buserr.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Provide a readable memory location containing the address of the
8 | ## last bus error.
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=buserr
40 | @NADDR=1
41 | @SLAVE.TYPE=SINGLE
42 | @SLAVE.BUS=wb
43 | @SINGLE.INPUT= r_bus_err
44 | @CLOCK.NAME=clk
45 | @$RWID=(@$(zip.MASTER.BUS.AWID) > @$(wbu.MASTER.BUS.AWID)) ? @$(zip.MASTER.BUS.AWID) : @$(wbu.MASTER.BUS.AWID)
46 | @MAIN.DEFNS=
47 | reg [@$(RWID)-1:0] r_@$(PREFIX)_addr;
48 | @MAIN.INSERT=
49 | always @(posedge @$(CLOCK.WIRE))
50 | if (@$(zip.MASTER.PREFIX)_err)
51 | begin
52 | r_@$(PREFIX)_addr <= 0;
53 | r_@$(PREFIX)_addr[@$(zip.MASTER.BUS.AWID)-1:0] <= @$(zip.MASTER.PREFIX)_addr[@$(zip.MASTER.BUS.AWID)-1:0];
54 | end else if (@$(wbu.MASTER.PREFIX)_err)
55 | begin
56 | r_@$(PREFIX)_addr <= 0;
57 | r_@$(PREFIX)_addr[@$(wbu.MASTER.BUS.AWID)-1:0] <= @$(wbu.MASTER.PREFIX)_addr[@$(wbu.MASTER.BUS.AWID)-1:0];
58 | end
59 | assign @$(SLAVE.PREFIX)_stall= 1'b0;
60 | assign @$(SLAVE.PREFIX)_ack = @$(SLAVE.PREFIX)_stb;
61 | assign @$(SLAVE.PREFIX)_idata = { {(30-@$(RWID)){1'b0}},
62 | r_@$(PREFIX)_addr, 2'b00 };
63 | @REGS.N=1
64 | @REGS.0= 0 R_BUSERR BUSERR
65 | @BDEF.IONAME=io_buserr
66 | @BDEF.IOTYPE=unsigned
67 | @BDEF.OSDEF=_BOARD_HAS_BUSERR
68 | @BDEF.OSVAL=static volatile @$THIS.BDEF.IOTYPE *const _buserr = ((@$THIS.BDEF.IOTYPE *)@$[0x%08x](REGBASE));
69 |
--------------------------------------------------------------------------------
/autodata/clock.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: clock.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose:
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2018-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=clock
39 | @CLOCK.NAME=clk
40 | @CLOCK.TOP=sys_clk_i
41 | @$CLOCK.FREQUENCY=100000000
42 | @CLOCK.WIRE=i_clk
43 | @TOP.DEFNS=
44 | wire s_clk, s_reset;
45 | @TOP.INSERT=
46 | assign s_clk = sys_clk_i;
47 | assign s_reset = 1'b0;
48 | @REGDEFS.H.DEFNS=
49 | #define CLKFREQHZ @$(CLOCK.FREQUENCY)
50 | @BDEF.DEFN=
51 | #define CLKFREQHZ @$(CLOCK.FREQUENCY)
52 |
--------------------------------------------------------------------------------
/autodata/cpuscope.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: cpuscope.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes how to integrate a wishbone scope, focused on the
8 | ## ZipCPU, into our platform. This is good for debugging things
9 | ## if the CPU itself isn't working.
10 | ##
11 | ## If you include this within your design, you should also find an
12 | ## associated piece of software to decode the signals produced by this
13 | ## scope within the repository (check in the sw/host directory).
14 | ##
15 | ##
16 | ## Creator: Dan Gisselquist, Ph.D.
17 | ## Gisselquist Technology, LLC
18 | ##
19 | ################################################################################
20 | ##
21 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
22 | ##
23 | ## This program is free software (firmware): you can redistribute it and/or
24 | ## modify it under the terms of the GNU General Public License as published
25 | ## by the Free Software Foundation, either version 3 of the License, or (at
26 | ## your option) any later version.
27 | ##
28 | ## This program is distributed in the hope that it will be useful, but WITHOUT
29 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
30 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 | ## for more details.
32 | ##
33 | ## You should have received a copy of the GNU General Public License along
34 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
35 | ## target there if the PDF file isn't present.) If not, see
36 | ## for a copy.
37 | ##
38 | ## License: GPL, v3, as defined and found on www.gnu.org,
39 | ## http://www.gnu.org/licenses/gpl.html
40 | ##
41 | ##
42 | ################################################################################
43 | ##
44 | ##
45 | @PREFIX=zipscope
46 | @NADDR=2
47 | @DEVID=ZIPSCOPE
48 | @DEPENDS=INCLUDE_ZIPCPU
49 | @TARGET=zip
50 | @TRIGGER=zip_trigger
51 | @LOG_CAPTURE_SIZE=13
52 | @INCLUDEFILE=wbscope.txt
53 | ##
54 |
--------------------------------------------------------------------------------
/autodata/enetscope.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: enetscope.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes how to connect a wishbone scope to the ethernet port
8 | ## for debugging.
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=enetscope
40 | @NADDR=2
41 | @DEVID=NETSCOPE
42 | @DEPENDS=ETHERNET_ACCESS
43 | @MAIN.PARAM=
44 | `define ENETRX_SCOPE
45 | @TARGET=netp
46 | @MAIN.DEFNS=
47 | wire netp_dbg_trigger;
48 | @MAIN.INSERT=
49 | @$(+.MAIN.INSERT)
50 |
51 | assign netp_dbg_trigger = netp_debug[31];
52 | @INT.ENETSCOPE.WIRE=@$(PREFIX)_int
53 | @INT.ENETSCOPE.PIC=buspic
54 | @LOG_CAPTURE_SIZE=9
55 | @SYNCHRONOUS=0
56 | @DATA_CLOCK=i_eth_rx_clk
57 | @INCLUDEFILE=wbscope.txt
58 | @BDEF.DEFNS=
59 | @(scope.BDEF.DEFNS)
60 | @XDC.INSERT=
61 | set_max_delay -datapath_only -from [get_cells -hier -filter {NAME=~ *scope*/*br_*}] -to [get_cells -hier -filter {NAME=~*scope*/*q_*}] 12.3
62 | set_max_delay -datapath_only -from [get_cells -hier -filter {NAME=~ *scope*/*br_*}] -to [get_cells -hier -filter {NAME=~*scope*/*dr_*}] 12.3
63 | set_max_delay -datapath_only -from [get_cells -hier -filter {NAME=~ *scopei*/*waddr*}] -to [get_cells -hier -filter {NAME=~*scopei*/*this_addr*}] 12.3
64 |
--------------------------------------------------------------------------------
/autodata/flashscope.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: flashscope.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes the flash in our new data format.
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=flashdbg
39 | @NADDR=2
40 | @DEVID=FLASHSCOPE
41 | @DEPENDS=FLASH_ACCESS
42 | @TARGET=flash
43 | @TRIGGER=flash_dbg_trigger
44 | @MAIN.DEFNS=
45 | @LOG_CAPTURE_SIZE=13
46 | @INT.FLASHDBG.WIRE=@$(PREFIX)_int
47 | @INT.FLASHDBG.PIC=buspic
48 | @INCLUDEFILE=wbscopc.txt
49 |
--------------------------------------------------------------------------------
/autodata/global.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: global.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Capture any global configuration parameters
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2015-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @LEGAL=legalgen.txt
39 | @PROJECT=OpenArty, an entirely open SoC based upon the Arty platform
40 | # @KEYS.TRIMLIST is a list of all string keys that need to be trimmed (have
41 | # spaces removed from either side) before being used
42 | # @KEYS.INTLIST is a list of all things that need to be converted to integers
43 | @KEYS.INTLIST= BUS_ADDRESS_WIDTH NADDR NPIC NSCOPES PIC.MAX REGS.N ID
44 | @DEFAULT.BUS=wb
45 | @REGISTER.BUS=wbu
46 | @VERILATOR_PREFIX=v
47 | @XDC.FILE=arty.xdc
48 | @REGDEFS.H.INSERT=
49 | typedef struct {
50 | unsigned m_addr;
51 | const char *m_name;
52 | } REGNAME;
53 |
54 | extern const REGNAME *bregs;
55 | extern const int NREGS;
56 | // #define NREGS (sizeof(bregs)/sizeof(bregs[0]))
57 |
58 | extern unsigned addrdecode(const char *v);
59 | extern const char *addrname(const unsigned v);
60 | @REGDEFS.CPP.INCLUDE=
61 | #include
62 | #include
63 | #include
64 | #include
65 | @REGDEFS.CPP.INSERT=
66 | #define RAW_NREGS (sizeof(raw_bregs)/sizeof(bregs[0]))
67 |
68 | const REGNAME *bregs = raw_bregs;
69 | const int NREGS = RAW_NREGS;
70 |
71 | unsigned addrdecode(const char *v) {
72 | if (isalpha(v[0])) {
73 | for(int i=0; i for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=gpio
39 | @DEVID=GPIO
40 | @NADDR=1
41 | @ACCESS=@$(DEVID)_ACCESS
42 | @SLAVE.TYPE=SINGLE
43 | @SLAVE.BUS=wb
44 | @NUMOUTPUT=11
45 | @NUMINPUT=11
46 | @INT.GPIO.WIRE=gpio_int
47 | @INT.GPIO.PIC=altpic
48 | @TOP.PORTLIST=
49 | // GPIO ports
50 | i_@$(PREFIX), o_@$(PREFIX)
51 | @TOP.IODECL=
52 | // GPIO wires
53 | localparam NGPI = @$(NUMINPUT), NGPO=@$(NUMOUTPUT);
54 | // GPIO ports
55 | input wire [(@$(NUMINPUT)-1):0] i_@$(PREFIX);
56 | output wire [(@$(NUMOUTPUT)-1):0] o_@$(PREFIX);
57 | @TOP.MAIN=
58 | // GPIO wires
59 | i_@$(PREFIX), o_@$(PREFIX)
60 | @MAIN.PORTLIST=
61 | // GPIO ports
62 | i_@$(PREFIX), o_@$(PREFIX)
63 | @MAIN.IODECL=
64 | localparam NGPI = @$(NUMINPUT), NGPO=@$(NUMOUTPUT);
65 | // @$(DEVID) ports
66 | input [(NGPI-1):0] i_@$(PREFIX);
67 | output wire [(NGPO-1):0] o_@$(PREFIX);
68 | @MAIN.INSERT=
69 | //
70 | // @$(DEVID)
71 | //
72 | // This interface should allow us to control up to 16 @$(DEVID) inputs, and
73 | // another 16 @$(DEVID) outputs. The interrupt trips when any of the inputs
74 | // changes. (Sorry, which input isn't (yet) selectable.)
75 | //
76 | localparam INITIAL_@$(DEVID) = @$(NUMOUTPUT)'h0;
77 | wbgpio #(NGPI, NGPO, INITIAL_@$(DEVID))
78 | @$(PREFIX)i(i_clk, @$(SLAVE.PORTLIST),
79 | i_@$(PREFIX), o_@$(PREFIX), @$(PREFIX)_int);
80 |
81 | assign sd_reset = o_@$(PREFIX)[6];
82 | @REGS.N=1
83 | @REGS.0= 0 R_@$(DEVID) @$(DEVID) GPI GPO
84 | @BDEF.DEFN=
85 | //
86 | // @$(DEVID) input wires
87 | //
88 | #define @$(DEVID)_IN(WIRE) (((WIRE)>>16)&1)
89 | //
90 | // @$(DEVID) output wires
91 | //
92 | #define @$(DEVID)_SET(WIRE) (((WIRE)<<16)|(WIRE))
93 | #define @$(DEVID)_CLR(WIRE) ((WIRE)<<16)
94 | //
95 | //
96 | @BDEF.IONAME= i_@$(PREFIX)
97 | @BDEF.IOTYPE= unsigned
98 | @BDEF.OSDEF= _BOARD_HAS_@$(DEVID)
99 | @BDEF.OSVAL= static volatile @$.BDEF.IOTYPE *const _@$(PREFIX) = ((@$.BDEF.IOTYPE *)@$[0x%08x](REGBASE));
100 | @RTL.MAKE.FILES=wbgpio.v
101 | @RTL.MAKE.GROUP=@$(DEVID)
102 |
--------------------------------------------------------------------------------
/autodata/legalgen.txt:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename:
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // DO NOT EDIT THIS FILE!
8 | // Computer Generated: This file is computer generated by AUTOFPGA. DO NOT EDIT.
9 | // DO NOT EDIT THIS FILE!
10 | //
11 | // CmdLine:
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2017-2020, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 |
--------------------------------------------------------------------------------
/autodata/mdioscope.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: mdioscope.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes how to connect a wishbone scope to the MDIO interface
8 | ## associated with the ethernet port for debugging purposes.
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=mdioscope
40 | @NADDR=2
41 | @DEVID=MDIOSCOPE
42 | @DEPENDS=NETCTRL_ACCESS
43 | @TARGET=mdio
44 | @MAIN.DEFNS=
45 | wire mdio_dbg_trigger;
46 | @MAIN.INSERT=
47 | @$(+.MAIN.INSERT)
48 |
49 | assign mdio_dbg_trigger = mdio_debug[31];
50 | @INT.MDIOSCOPE.WIRE=@$(PREFIX)_int
51 | @INT.MDIOSCOPE.PIC=buspic
52 | @LOG_CAPTURE_SIZE=9
53 | @DATA_CLOCK=i_clk
54 | @SYNCHRONOUS=1
55 | @INCLUDEFILE=wbscope.txt
56 |
--------------------------------------------------------------------------------
/autodata/mem_bkram_only.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: mem_flash_bkram.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes a memory model containing nothing more than flash
8 | ## and block RAM. This will be used to create a board.ld linker
9 | ## script that can be used to link ZipCPU programs.
10 | ##
11 | ##
12 | ## Creator: Dan Gisselquist, Ph.D.
13 | ## Gisselquist Technology, LLC
14 | ##
15 | ################################################################################
16 | ##
17 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
18 | ##
19 | ## This program is free software (firmware): you can redistribute it and/or
20 | ## modify it under the terms of the GNU General Public License as published
21 | ## by the Free Software Foundation, either version 3 of the License, or (at
22 | ## your option) any later version.
23 | ##
24 | ## This program is distributed in the hope that it will be useful, but WITHOUT
25 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | ## for more details.
28 | ##
29 | ## You should have received a copy of the GNU General Public License along
30 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | ## target there if the PDF file isn't present.) If not, see
32 | ## for a copy.
33 | ##
34 | ## License: GPL, v3, as defined and found on www.gnu.org,
35 | ## http://www.gnu.org/licenses/gpl.html
36 | ##
37 | ##
38 | ################################################################################
39 | ##
40 | ##
41 | ##
42 | @PREFIX=mem_bkram_only
43 | @MASTER.TYPE=SCRIPT
44 | @MASTER.BUS=wb
45 | @LD.FILE=bkram.ld
46 | @LD.DEFNS=
47 | /* LD.DEFNS from zipmaster.txt */
48 | _kram = 0; /* No high-speed kernel RAM */
49 | _ram = ORIGIN(bkram);
50 | _rom = 0;
51 | _top_of_stack = ORIGIN(bkram) + LENGTH(bkram);
52 |
53 | @LD.SCRIPT=
54 | /* LD.SCRIPT from @$(PREFIX).txt */
55 | SECTIONS
56 | {
57 | .ramcode ORIGIN(bkram) : ALIGN(4) {
58 | _boot_address = .;
59 | _kram_start = .;
60 | _kram_end = .;
61 | _ram_image_start = . ;
62 | *(.start) *(.boot)
63 | *(.kernel)
64 | *(.text.startup)
65 | *(.text*)
66 | *(.rodata*) *(.strings)
67 | *(.data) *(COMMON)
68 | }> bkram
69 | _ram_image_end = . ;
70 | .bss : ALIGN_WITH_INPUT {
71 | *(.bss)
72 | _bss_image_end = . ;
73 | } > bkram
74 | _top_of_heap = .;
75 | }
76 | #
77 |
--------------------------------------------------------------------------------
/autodata/mem_flash_bkram.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: mem_flash_bkram.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes a memory model containing nothing more than flash
8 | ## and block RAM. This will be used to create a board.ld linker
9 | ## script that can be used to link ZipCPU programs.
10 | ##
11 | ##
12 | ## Creator: Dan Gisselquist, Ph.D.
13 | ## Gisselquist Technology, LLC
14 | ##
15 | ################################################################################
16 | ##
17 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
18 | ##
19 | ## This program is free software (firmware): you can redistribute it and/or
20 | ## modify it under the terms of the GNU General Public License as published
21 | ## by the Free Software Foundation, either version 3 of the License, or (at
22 | ## your option) any later version.
23 | ##
24 | ## This program is distributed in the hope that it will be useful, but WITHOUT
25 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | ## for more details.
28 | ##
29 | ## You should have received a copy of the GNU General Public License along
30 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | ## target there if the PDF file isn't present.) If not, see
32 | ## for a copy.
33 | ##
34 | ## License: GPL, v3, as defined and found on www.gnu.org,
35 | ## http://www.gnu.org/licenses/gpl.html
36 | ##
37 | ##
38 | ################################################################################
39 | ##
40 | ##
41 | ##
42 | @PREFIX=mem_flash_bkram
43 | @MASTER.TYPE=SCRIPT
44 | @MASTER.BUS=wb
45 | @LD.FILE=board.ld
46 | @LD.DEFNS=
47 | /* LD.DEFNS from zipmaster.txt */
48 | _kram = 0; /* No high-speed kernel RAM */
49 | _ram = ORIGIN(bkram);
50 | _rom = ORIGIN(flash);
51 | _top_of_stack = ORIGIN(bkram) + LENGTH(bkram);
52 |
53 | @LD.SCRIPT=
54 | /* LD.SCRIPT from @$(PREFIX).txt */
55 | SECTIONS
56 | {
57 | .rocode @$[0x%08x](zip.RESET_ADDRESS) : ALIGN(4) {
58 | _boot_address = .;
59 | *(.start) *(.boot)
60 | } > flash
61 | _kram_start = . ;
62 | _kram_end = . ;
63 | _ram_image_start = . ;
64 | .kernel : ALIGN_WITH_INPUT {
65 | *(.kernel)
66 | *(.text.startup)
67 | *(.text*)
68 | *(.rodata*) *(.strings)
69 | *(.data) *(COMMON)
70 | }> bkram AT> flash
71 | _ram_image_end = . ;
72 | .bss : ALIGN_WITH_INPUT {
73 | *(.bss)
74 | _bss_image_end = . ;
75 | } > bkram
76 | _top_of_heap = .;
77 | }
78 | #
79 |
--------------------------------------------------------------------------------
/autodata/mem_sdram_bkram.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: mem_sdram_bkram.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Describes a memory model containing nothing more than SDRAM
8 | ## and block RAM. This will be used to create a linker script
9 | ## that can be used to link ZipCPU programs.
10 | ##
11 | ##
12 | ## Creator: Dan Gisselquist, Ph.D.
13 | ## Gisselquist Technology, LLC
14 | ##
15 | ################################################################################
16 | ##
17 | ## Copyright (C) 2019-2020, Gisselquist Technology, LLC
18 | ##
19 | ## This program is free software (firmware): you can redistribute it and/or
20 | ## modify it under the terms of the GNU General Public License as published
21 | ## by the Free Software Foundation, either version 3 of the License, or (at
22 | ## your option) any later version.
23 | ##
24 | ## This program is distributed in the hope that it will be useful, but WITHOUT
25 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | ## for more details.
28 | ##
29 | ## You should have received a copy of the GNU General Public License along
30 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | ## target there if the PDF file isn't present.) If not, see
32 | ## for a copy.
33 | ##
34 | ## License: GPL, v3, as defined and found on www.gnu.org,
35 | ## http://www.gnu.org/licenses/gpl.html
36 | ##
37 | ##
38 | ################################################################################
39 | ##
40 | ##
41 | ##
42 | @PREFIX=mem_sdram_bkram
43 | @MASTER.TYPE=SCRIPT
44 | @MASTER.BUS=wb
45 | @LD.FILE=sdram.ld
46 | @LD.DEFNS=
47 | /* LD.DEFNS from zipmaster.txt */
48 | _kram = ORIGIN(bkram); /* No high-speed kernel RAM */
49 | _ram = ORIGIN(sdram);
50 | _rom = 0;
51 | _top_of_stack = ORIGIN(bkram) + LENGTH(bkram);
52 |
53 | @LD.SCRIPT=
54 | /* LD.SCRIPT from @$(PREFIX).txt */
55 | SECTIONS
56 | {
57 | .rocode ORIGIN(bkram): ALIGN(4) {
58 | _boot_address = .;
59 | *(.start) *(.boot)
60 | } > bkram
61 | _kram_start = . ;
62 | .kernel : ALIGN_WITH_INPUT {
63 | *(.kernel)
64 | *(.text.startup)
65 | _kram_end = . ;
66 | }> bkram
67 | _ram_image_start = . ;
68 | .ramcod : ALIGN_WITH_INPUT {
69 | *(.text*)
70 | *(.rodata*) *(.strings)
71 | *(.data) *(COMMON)
72 | _ram_image_end = . ;
73 | }> sdram
74 | .bss : ALIGN_WITH_INPUT {
75 | *(.bss)
76 | _bss_image_end = . ;
77 | } > sdram
78 | _top_of_heap = .;
79 | }
80 | #
81 |
--------------------------------------------------------------------------------
/autodata/pic.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: pic.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose:
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=buspic
39 | @DEVID=BUSPIC
40 | @NADDR=1
41 | @BUSP=wb
42 | @ACCESS=BUSPIC_ACCESS
43 | @SLAVE.TYPE=SINGLE
44 | @SLAVE.BUS=@$(BUSP)
45 | @PIC.BUS= bus_int_vector
46 | @PIC.MAX= 15
47 | @INT.BUS.WIRE= w_bus_int
48 | @INT.BUS.PIC= syspic
49 | @INT.BUS.ID= 6
50 | @BDEF.DEFN=
51 | #define BUSPIC(X) (1< for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=pwrcount
39 | @NADDR=1
40 | @ACCESS=PWRCOUNT_ACCESS
41 | @SLAVE.TYPE=SINGLE
42 | @SLAVE.BUS=wb
43 | @MAIN.DEFNS=
44 | reg [31:0] r_@$(PREFIX)_data;
45 | @MAIN.INSERT=
46 | initial r_@$(PREFIX)_data = 32'h0;
47 | always @(posedge i_clk)
48 | if (r_@$(PREFIX)_data[31])
49 | r_@$(PREFIX)_data[30:0] <= r_@$(PREFIX)_data[30:0] + 1'b1;
50 | else
51 | r_@$(PREFIX)_data[31:0] <= r_@$(PREFIX)_data[31:0] + 1'b1;
52 |
53 | assign @$(SLAVE.PREFIX)_stall = 1'b0;
54 | assign @$(SLAVE.PREFIX)_ack = @$(SLAVE.PREFIX)_stb;
55 | assign @$(SLAVE.PREFIX)_idata = r_@$(PREFIX)_data;
56 | @REGS.N=1
57 | @REGS.0= 0 R_PWRCOUNT PWRCOUNT
58 | @BDEF.OSVAL= static volatile unsigned *const _@$(PREFIX) = ((unsigned *)@$[0x%08x](REGBASE));
59 |
--------------------------------------------------------------------------------
/autodata/rtccount.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: rtccount.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: Define a very simple peripheral that counts fractions of a
8 | ## second since startup.
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=rtccount
40 | @NADDR=1
41 | @SLAVE.TYPE=SINGLE
42 | @SLAVE.BUS=wb
43 | @$STEP=(1<<32)/@$(CLOCK.FREQUENCY)
44 | @MAIN.DEFNS=
45 | reg r_@$(PREFIX)_ack;
46 | reg [31:0] r_@$(PREFIX)_data;
47 | @MAIN.INSERT=
48 | assign @$(SLAVE.PREFIX)_stall = 1'b0;
49 |
50 | initial r_@$(PREFIX)_ack = 32'h0;
51 | always @(posedge i_clk)
52 | r_@$(PREFIX)_ack <= @$(SLAVE.PREFIX)_stb;
53 | assign @$(SLAVE.PREFIX)_ack = r_@$(PREFIX)_ack;
54 |
55 | initial r_@$(PREFIX)_data = 32'h0;
56 | always @(posedge i_clk)
57 | r_@$(PREFIX)_data <= r_@$(PREFIX) + @$(STEP);
58 | assign @$(SLAVE.PREFIX)_idata = r_@$(PREFIX)_data;
59 | @REGS.N=1
60 | @REGS.0= 0 R_RTCCOUNT RTCCOUNT
61 |
--------------------------------------------------------------------------------
/autodata/rtcdate.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: rtcdate.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose:
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=rtcdate
39 | @DEVID=RTCDATE
40 | @NADDR=1
41 | @ACCESS=@$(DEVID)_ACCESS
42 | @DEPENDS=RTC_ACCESS
43 | @SLAVE.TYPE=SINGLE
44 | @SLAVE.BUS=wb
45 | @MAIN.INSERT=
46 | //
47 | // The Calendar DATE
48 | //
49 | rtcdate @$(PREFIX)i(i_clk, rtc_ppd,
50 | @$(SLAVE.PORTLIST));
51 | @REGS.N=1
52 | @REGS.0= 0 R_@$(DEVID) @$(DEVID) DATE
53 | @BDEF.IONAME= _@$(PREFIX)
54 | @BDEF.IOTYPE= unsigned
55 | @BDEF.OSDEF= _BOARD_HAS_@$(DEVID)
56 | @BDEF.OSVAL= static volatile @$(BDEF.IOTYPE) *const @$(BDEF.IONAME) = ((@$BDEF.IOTYPE *)@$REGBASE);
57 | @RTL.MAKE.GROUP=@$(DEVID)
58 | @RTL.MAKE.SUBD=rtc
59 | @RTL.MAKE.FILES=rtcdate.v
60 |
--------------------------------------------------------------------------------
/autodata/spio.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: spio.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: To describe how to interact with the special purpose device
8 | ## controller (spio) for the Arty A-7 Board (SW, BTN, LEDs)
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=spio
40 | @DEVID=SPIO
41 | @NADDR=1
42 | @SLAVE.TYPE=SINGLE
43 | @SLAVE.BUS=wb
44 | @ACCESS=@$(DEVID)_ACCESS
45 | @INT.SPIO.WIRE=@$(PREFIX)_int
46 | @INT.SPIO.PIC=buspic
47 | @NLED=4
48 | @NBTN=4
49 | @NSW=4
50 | @MAIN.PORTLIST=
51 | // SPIO interface
52 | i_sw, i_btn, o_led
53 | @MAIN.IODECL=
54 | // @$(DEVID) interface
55 | input wire [@$(NSW)-1:0] i_sw;
56 | input wire [@$(NBTN)-1:0] i_btn;
57 | output wire [@$(NLED)-1:0] o_led;
58 | @MAIN.INSERT=
59 | spio #(.NBTN(@$(NBTN)), .NLEDS(@$(NLED)), .NSW(@$(NSW))) @$(PREFIX)i(i_clk,
60 | @$(SLAVE.PORTLIST),
61 | i_sw, i_btn, o_led, @$(PREFIX)_int);
62 | @MAIN.ALT=
63 | assign o_led = 0;
64 | @REGS.N=1
65 | @REGS.0= 0 R_@$(DEVID) @$(DEVID)
66 | @BDEF.DEFN=
67 | @BDEF.IONAME=_@$(PREFIX)
68 | @BDEF.IOTYPE=unsigned
69 | @BDEF.OSDEF= _BOARD_HAS_@$(DEVID)
70 | @BDEF.OSVAL= static volatile @$(BDEF.IOTYPE) *const @$(BDEF.IONAME) = ((@$(BDEF.IOTYPE) *)@$[0x%08x](REGBASE));
71 |
--------------------------------------------------------------------------------
/autodata/version.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: version.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose:
8 | ##
9 | ## Creator: Dan Gisselquist, Ph.D.
10 | ## Gisselquist Technology, LLC
11 | ##
12 | ################################################################################
13 | ##
14 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
15 | ##
16 | ## This program is free software (firmware): you can redistribute it and/or
17 | ## modify it under the terms of the GNU General Public License as published
18 | ## by the Free Software Foundation, either version 3 of the License, or (at
19 | ## your option) any later version.
20 | ##
21 | ## This program is distributed in the hope that it will be useful, but WITHOUT
22 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | ## for more details.
25 | ##
26 | ## You should have received a copy of the GNU General Public License along
27 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | ## target there if the PDF file isn't present.) If not, see
29 | ## for a copy.
30 | ##
31 | ## License: GPL, v3, as defined and found on www.gnu.org,
32 | ## http://www.gnu.org/licenses/gpl.html
33 | ##
34 | ##
35 | ################################################################################
36 | ##
37 | ##
38 | @PREFIX=version
39 | @DEVID=VERSION
40 | @NADDR=1
41 | @SLAVE.TYPE=SINGLE
42 | @SLAVE.BUS=wb
43 | @MAIN.DEFNS=
44 | `include "builddate.v"
45 | @MAIN.INSERT=
46 | assign @$(SLAVE.PREFIX)_idata = `DATESTAMP;
47 | assign @$(SLAVE.PREFIX)_ack = @$(SLAVE.PREFIX)_stb;
48 | assign @$(SLAVE.PREFIX)_stall = 1'b0;
49 | @REGS.N=1
50 | @REGS.0= 0 R_@$(DEVID) @$(DEVID)
51 | @BDEF.IONAME=_@$(PREFIX)
52 | @BDEF.IOTYPE=unsigned
53 | @BDEF.OSDEF=_BOARD_HAS_@$(DEVID)
54 | @BDEF.OSVAL=static volatile @$BDEF.IOTYPE *const @$BDEF.IONAME = ((@$BDEF.IOTYPE *)@$[0x%08x](REGBASE));
55 | ##
56 | ##
57 | ##
58 | @PREFIX=buildtime
59 | @DEVID=BUILDTIME
60 | @NADDR=1
61 | @SLAVE.TYPE=SINGLE
62 | @SLAVE.BUS=wb
63 | @MAIN.DEFNS=
64 | // BUILDTIME doesnt need to include builddate.v a second time
65 | // `include "builddate.v"
66 | @MAIN.INSERT=
67 | assign @$(SLAVE.PREFIX)_idata = `BUILDTIME;
68 | assign @$(SLAVE.PREFIX)_ack = @$(SLAVE.PREFIX)_stb;
69 | assign @$(SLAVE.PREFIX)_stall = 1'b0;
70 | @REGS.N=1
71 | @REGS.0= 0 R_@$(DEVID) @$(DEVID)
72 | @BDEF.IONAME=_@$(PREFIX)
73 | @BDEF.IOTYPE=unsigned
74 | @BDEF.OSDEF=_BOARD_HAS_@$(DEVID)
75 | @BDEF.OSVAL=static volatile @$BDEF.IOTYPE *const @$BDEF.IONAME = ((@$.BDEF.IOTYPE *)@$[0x%08x](REGBASE));
76 |
--------------------------------------------------------------------------------
/autodata/wbscopc.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: scopc.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: A generic scope description, from which other internal wbscopes
8 | ## may depend upon
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=scopc
40 | @DEVID=SCOPC
41 | @ACCESS=@$(DEVID)_SCOPC
42 | @CORE=wbscopc
43 | @REGS.NOTE=// @$(PREFIX) compressed scope
44 | @RTL.MAKE.GROUP=SCOPC
45 | @RTL.MAKE.SUBD=wbscope
46 | @RTL.MAKE.FILES=wbscopc.v
47 | @TRIGGER=@$(TARGET)_debug[31]
48 | @DEBUG=@$(TARGET)_debug[30:0]
49 | @INCLUDEFILE=wbscope.txt
50 |
--------------------------------------------------------------------------------
/autodata/wbscope.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: scope.txt
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: A generic scope description, from which other internal wbscopes
8 | ## may depend upon
9 | ##
10 | ## Creator: Dan Gisselquist, Ph.D.
11 | ## Gisselquist Technology, LLC
12 | ##
13 | ################################################################################
14 | ##
15 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
16 | ##
17 | ## This program is free software (firmware): you can redistribute it and/or
18 | ## modify it under the terms of the GNU General Public License as published
19 | ## by the Free Software Foundation, either version 3 of the License, or (at
20 | ## your option) any later version.
21 | ##
22 | ## This program is distributed in the hope that it will be useful, but WITHOUT
23 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | ## for more details.
26 | ##
27 | ## You should have received a copy of the GNU General Public License along
28 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | ## target there if the PDF file isn't present.) If not, see
30 | ## for a copy.
31 | ##
32 | ## License: GPL, v3, as defined and found on www.gnu.org,
33 | ## http://www.gnu.org/licenses/gpl.html
34 | ##
35 | ##
36 | ################################################################################
37 | ##
38 | ##
39 | @PREFIX=scope
40 | @DEVID=SCOPE
41 | @NADDR= 2
42 | @ACCESS=@$(DEVID)_SCOPE
43 | @SLAVE.TYPE=OTHER
44 | @SLAVE.BUS=wb
45 | @LOG_CAPTURE_SIZE=12
46 | @DATA_CLOCK=i_clk
47 | @CAPTURECE=1'b1
48 | @SYNCHRONOUS=1
49 | @CORE=wbscope
50 | @TRIGGER=@$(TARGET)_dbg_trigger
51 | @DEBUG=@$(TARGET)_debug
52 | @MAIN.DEFNS=
53 | // Remove this scope tag via inheritance when/if you connect the
54 | // scope interrupt
55 | //
56 | // Virilator lint_off UNUSED
57 | wire @$(PREFIX)_int;
58 | // Virilator lint_on UNUSED
59 | @MAIN.INSERT=
60 | @$(CORE) #(.LGMEM(@$(LOG_CAPTURE_SIZE)),
61 | .SYNCHRONOUS(@$(SYNCHRONOUS)))
62 | @$(PREFIX)i(@$(DATA_CLOCK), @$(CAPTURECE), @$(TRIGGER), @$(DEBUG),
63 | @$(SLAVE.BUS.CLOCK.WIRE), @$(SLAVE.PORTLIST),
64 | @$(PREFIX)_int);
65 | @MAIN.ALT=
66 | assign @$(PREFIX)_int = 0;
67 | @REGS.NOTE=// @$(PREFIX) scope
68 | @REGS.N=2
69 | @REGS.0=0 R_@$(DEVID) @$(DEVID)
70 | @REGS.1=1 R_@$(DEVID)D @$(DEVID)D
71 | @RTL.MAKE.GROUP=SCOPE
72 | @RTL.MAKE.SUBD=wbscope
73 | @RTL.MAKE.FILES=@$(CORE).v
74 | @BDEF.DEFN=
75 | #ifndef WBSCOPE_H
76 | #define WBSCOPE_H
77 |
78 | #define WBSCOPE_NO_RESET 0x80000000u
79 | #define WBSCOPE_STOPPED 0x40000000u
80 | #define WBSCOPE_TRIGGERED 0x20000000u
81 | #define WBSCOPE_PRIMED 0x10000000u
82 | #define WBSCOPE_TRIGGER (WBSCOPE_NO_RESET|0x08000000u)
83 | #define WBSCOPE_MANUAL (WBSCOPE_TRIGGER)
84 | #define WBSCOPE_DISABLE 0x04000000u
85 |
86 | typedef struct WBSCOPE_S {
87 | unsigned s_ctrl, s_data;
88 | } WBSCOPE;
89 | #endif
90 | @BDEF.IONAME=_@$(PREFIX)
91 | @BDEF.IOTYPE=WBSCOPE
92 | @BDEF.OSDEF=_BOARD_HAS_@$(DEVID)
93 | @BDEF.OSVAL=static volatile @$(BDEF.IOTYPE) *const @$(BDEF.IONAME) = ((@$(BDEF.IOTYPE) *)@$[0x%08x](REGBASE));
94 |
--------------------------------------------------------------------------------
/bench/formal/.gitignore:
--------------------------------------------------------------------------------
1 | *_cvr/
2 | *_prf/
3 |
--------------------------------------------------------------------------------
/bench/formal/enetctrl.gtkw:
--------------------------------------------------------------------------------
1 | [*]
2 | [*] GTKWave Analyzer v3.3.86 (w)1999-2017 BSI
3 | [*] Sat Jan 5 12:18:20 2019
4 | [*]
5 | [dumpfile] "/home/dan/jericho/work/rnd/opencores/openarty/trunk/bench/formal/enetctrl_prf/engine_0/trace.vcd"
6 | [dumpfile_mtime] "Sat Jan 5 12:14:23 2019"
7 | [dumpfile_size] 66584
8 | [savefile] "/home/dan/jericho/work/rnd/opencores/openarty/trunk/bench/formal/enetctrl.gtkw"
9 | [timestart] 589
10 | [size] 1882 907
11 | [pos] -1 -1
12 | *-5.061276 750 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
13 | [sst_width] 270
14 | [signals_width] 220
15 | [sst_expanded] 1
16 | [sst_vpaned_height] 252
17 | @28
18 | enetctrl.f_past_valid
19 | enetctrl.i_reset
20 | enetctrl.i_clk
21 | @200
22 | -
23 | @28
24 | [color] 3
25 | enetctrl.o_mdclk
26 | [color] 3
27 | enetctrl.o_mdio
28 | [color] 3
29 | enetctrl.o_mdwe
30 | [color] 3
31 | enetctrl.i_mdio
32 | @200
33 | -
34 | @28
35 | enetctrl.i_wb_cyc
36 | enetctrl.i_wb_stb
37 | enetctrl.i_wb_we
38 | @22
39 | enetctrl.i_wb_addr[4:0]
40 | enetctrl.i_wb_data[15:0]
41 | @28
42 | [color] 2
43 | enetctrl.o_wb_stall
44 | [color] 2
45 | enetctrl.o_wb_ack
46 | @22
47 | [color] 2
48 | enetctrl.o_wb_data[31:0]
49 | @200
50 | -
51 | @28
52 | [color] 3
53 | enetctrl.f_nacks[2:0]
54 | [color] 3
55 | enetctrl.f_nreqs[2:0]
56 | [color] 3
57 | enetctrl.f_outstanding[2:0]
58 | enetctrl.pre_ack
59 | @200
60 | -
61 | @28
62 | enetctrl.clk_counter[1:0]
63 | enetctrl.rclk
64 | enetctrl.zclk
65 | @200
66 | -
67 | @22
68 | enetctrl.reg_pos[5:0]
69 | @28
70 | enetctrl.zreg_pos
71 | @200
72 | -
73 | @28
74 | enetctrl.ctrl_state[2:0]
75 | enetctrl.read_pending
76 | enetctrl.write_pending
77 | @200
78 | -
79 | @22
80 | enetctrl.f_read_steps[33:0]
81 | enetctrl.f_write_steps[33:0]
82 | @28
83 | enetctrl.in_idle
84 | @c00022
85 | enetctrl.r_addr[4:0]
86 | @28
87 | (0)enetctrl.r_addr[4:0]
88 | (1)enetctrl.r_addr[4:0]
89 | (2)enetctrl.r_addr[4:0]
90 | (3)enetctrl.r_addr[4:0]
91 | (4)enetctrl.r_addr[4:0]
92 | @1401200
93 | -group_end
94 | @23
95 | enetctrl.f_addr[4:0]
96 | @22
97 | enetctrl.r_data[15:0]
98 | enetctrl.f_data[15:0]
99 | enetctrl.r_wb_data[15:0]
100 | enetctrl.read_reg[15:0]
101 | enetctrl.write_reg[15:0]
102 | [pattern_trace] 1
103 | [pattern_trace] 0
104 |
--------------------------------------------------------------------------------
/bench/formal/enetctrl.sby:
--------------------------------------------------------------------------------
1 | [tasks]
2 | cvr
3 | prf
4 |
5 | [options]
6 | cvr: mode cover
7 | cvr: depth 258
8 | prf: mode prove
9 | prf: depth 10
10 |
11 | [engines]
12 | smtbmc
13 |
14 | [script]
15 | read_verilog -formal fwb_slave.v
16 | read_verilog -formal enetctrl.v
17 | cvr: chparam -set CLKBITS 2 enetctrl
18 | cvr: chparam -set F_OPT_COVER 1 enetctrl
19 | prep -top enetctrl
20 |
21 | [files]
22 | fwb_slave.v
23 | ../../rtl/enet/enetctrl.v
24 |
--------------------------------------------------------------------------------
/doc/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: Makefile
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: To coordinate the build of documentation PDFs from their
8 | ## LaTeX sources.
9 | ##
10 | ## Targets include:
11 | ## all Builds all documents
12 | ##
13 | ## gpl-3.0.pdf Builds the GPL license these files are released
14 | ## under.
15 | ##
16 | ## spec.pdf Builds the specification for the OpenArty SoC
17 | ## package.
18 | ##
19 | ## Creator: Dan Gisselquist, Ph.D.
20 | ## Gisselquist Technology, LLC
21 | ##
22 | ################################################################################
23 | ##
24 | ## Copyright (C) 2015-2016, Gisselquist Technology, LLC
25 | ##
26 | ## This program is free software (firmware): you can redistribute it and/or
27 | ## modify it under the terms of the GNU General Public License as published
28 | ## by the Free Software Foundation, either version 3 of the License, or (at
29 | ## your option) any later version.
30 | ##
31 | ## This program is distributed in the hope that it will be useful, but WITHOUT
32 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
33 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
34 | ## for more details.
35 | ##
36 | ## You should have received a copy of the GNU General Public License along
37 | ## with this program. (It's in the $(ROOT)/doc directory, run make with no
38 | ## target there if the PDF file isn't present.) If not, see
39 | ## for a copy.
40 | ##
41 | ## License: GPL, v3, as defined and found on www.gnu.org,
42 | ## http://www.gnu.org/licenses/gpl.html
43 | ##
44 | ##
45 | ################################################################################
46 | ##
47 | ##
48 | all: gpl spec
49 | pdf: gpl spec
50 | DSRC := src
51 |
52 | .PHONY: gpl
53 | gpl: gpl-3.0.pdf
54 |
55 | gpl-3.0.pdf: $(DSRC)/gpl-3.0.tex
56 | latex $(DSRC)/gpl-3.0.tex
57 | latex $(DSRC)/gpl-3.0.tex
58 | dvips -q -z -t letter -P pdf -o gpl-3.0.ps gpl-3.0.dvi
59 | ps2pdf -dAutoRotatePages=/All gpl-3.0.ps gpl-3.0.pdf
60 | rm gpl-3.0.dvi gpl-3.0.log gpl-3.0.aux gpl-3.0.ps
61 |
62 | .PHONY: spec
63 | spec: spec.pdf
64 |
65 | spec.pdf: $(DSRC)/spec.tex $(DSRC)/gqtekspec.cls $(DSRC)/GT.eps
66 | cd $(DSRC)/; latex spec.tex
67 | cd $(DSRC)/; latex spec.tex
68 | cd $(DSRC)/; dvips -q -z -t letter -P pdf -o ../spec.ps spec.dvi
69 | ps2pdf -dAutoRotatePages=/All spec.ps spec.pdf
70 | -grep -i warning $(DSRC)/spec.log
71 | @rm -f $(DSRC)/spec.dvi $(DSRC)/spec.log
72 | @rm -f $(DSRC)/spec.aux $(DSRC)/spec.toc
73 | @rm -f $(DSRC)/spec.lot $(DSRC)/spec.lof
74 | @rm -f $(DSRC)/spec.out spec.ps
75 |
76 | .PHONY: clean
77 | clean:
78 | rm -f $(DSRC)/spec.dvi $(DSRC)/spec.log
79 | rm -f $(DSRC)/spec.aux $(DSRC)/spec.toc
80 | rm -f $(DSRC)/spec.lot $(DSRC)/spec.lof
81 | rm -f $(DSRC)/spec.out spec.ps spec.pdf
82 | rm -f gpl-3.0.pdf
83 |
84 |
--------------------------------------------------------------------------------
/doc/gfx/clipped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/clipped.jpg
--------------------------------------------------------------------------------
/doc/gfx/cputest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/cputest.png
--------------------------------------------------------------------------------
/doc/gfx/dbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/dbg.png
--------------------------------------------------------------------------------
/doc/gfx/flashid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/flashid.png
--------------------------------------------------------------------------------
/doc/gfx/gps-tracking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/gps-tracking.png
--------------------------------------------------------------------------------
/doc/gfx/gps-traklog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/gps-traklog.png
--------------------------------------------------------------------------------
/doc/gfx/image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/image.jpg
--------------------------------------------------------------------------------
/doc/gfx/ipcat-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/ipcat-menu.png
--------------------------------------------------------------------------------
/doc/gfx/mig_01-create.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_01-create.png
--------------------------------------------------------------------------------
/doc/gfx/mig_02-pincompat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_02-pincompat.png
--------------------------------------------------------------------------------
/doc/gfx/mig_03-memsel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_03-memsel.png
--------------------------------------------------------------------------------
/doc/gfx/mig_04-mctopts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_04-mctopts.png
--------------------------------------------------------------------------------
/doc/gfx/mig_05-axiopts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_05-axiopts.png
--------------------------------------------------------------------------------
/doc/gfx/mig_06-memops.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_06-memops.png
--------------------------------------------------------------------------------
/doc/gfx/mig_07-fpgaopts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_07-fpgaopts.png
--------------------------------------------------------------------------------
/doc/gfx/mig_08-fpgaopts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_08-fpgaopts.png
--------------------------------------------------------------------------------
/doc/gfx/mig_09-extops.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_09-extops.png
--------------------------------------------------------------------------------
/doc/gfx/mig_10-ioops.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_10-ioops.png
--------------------------------------------------------------------------------
/doc/gfx/mig_11-loaducf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_11-loaducf.png
--------------------------------------------------------------------------------
/doc/gfx/mig_12-syssigs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_12-syssigs.png
--------------------------------------------------------------------------------
/doc/gfx/mig_13-validpins.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/mig_13-validpins.png
--------------------------------------------------------------------------------
/doc/gfx/ntpsrvr-box.dia:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/ntpsrvr-box.dia
--------------------------------------------------------------------------------
/doc/gfx/ntpsrvr-box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/ntpsrvr-box.png
--------------------------------------------------------------------------------
/doc/gfx/oledrgb-demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/oledrgb-demo.png
--------------------------------------------------------------------------------
/doc/gfx/openarty.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/openarty.jpg
--------------------------------------------------------------------------------
/doc/gfx/openarty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/openarty.png
--------------------------------------------------------------------------------
/doc/gfx/openmig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/openmig.png
--------------------------------------------------------------------------------
/doc/gfx/pick-a-part.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/pick-a-part.png
--------------------------------------------------------------------------------
/doc/gfx/proj_dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/proj_dir.png
--------------------------------------------------------------------------------
/doc/gfx/traking-costs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gfx/traking-costs.png
--------------------------------------------------------------------------------
/doc/gpl-3.0.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/gpl-3.0.pdf
--------------------------------------------------------------------------------
/doc/spec.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/doc/spec.pdf
--------------------------------------------------------------------------------
/doc/src/GT.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%BoundingBox: 0 0 504 288
3 | %%Creator: Gisselquist Technology LLC
4 | %%Title: Gisselquist Technology Logo
5 | %%CreationDate: 11 Mar 2014
6 | %%EndComments
7 | %%BeginProlog
8 | /black { 0 setgray } def
9 | /white { 1 setgray } def
10 | /height { 288 } def
11 | /lw { height 8 div } def
12 | %%EndProlog
13 | % %%Page: 1
14 |
15 | false { % A bounding box
16 | 0 setlinewidth
17 | newpath
18 | 0 0 moveto
19 | 0 height lineto
20 | 1.625 height mul lw add 0 rlineto
21 | 0 height neg rlineto
22 | closepath stroke
23 | } if
24 |
25 | true { % The "G"
26 | newpath
27 | height 2 div 1.25 mul height moveto
28 | height 2 div height 4 div sub height lineto
29 | 0 height 3 4 div mul lineto
30 | 0 height 4 div lineto
31 | height 4 div 0 lineto
32 | height 3 4 div mul 0 lineto
33 | height height 4 div lineto
34 | height height 2 div lineto
35 | %
36 | height lw sub height 2 div lineto
37 | height lw sub height 4 div lw 2 div add lineto
38 | height 3 4 div mul lw 2 div sub lw lineto
39 | height 4 div lw 2 div add lw lineto
40 | lw height 4 div lw 2 div add lineto
41 | lw height 3 4 div mul lw 2 div sub lineto
42 | height 4 div lw 2 div add height lw sub lineto
43 | height 2 div 1.25 mul height lw sub lineto
44 | closepath fill
45 | newpath
46 | height 2 div height 2 div moveto
47 | height 2 div 0 rlineto
48 | 0 height 2 div neg rlineto
49 | lw neg 0 rlineto
50 | 0 height 2 div lw sub rlineto
51 | height 2 div height 2 div lw sub lineto
52 | closepath fill
53 | } if
54 |
55 | height 2 div 1.25 mul lw add 0 translate
56 | false {
57 | newpath
58 | 0 height moveto
59 | height 0 rlineto
60 | 0 lw neg rlineto
61 | height lw sub 2 div neg 0 rlineto
62 | 0 height lw sub neg rlineto
63 | lw neg 0 rlineto
64 | 0 height lw sub rlineto
65 | height lw sub 2 div neg 0 rlineto
66 | 0 lw rlineto
67 | closepath fill
68 | } if
69 |
70 | true { % The "T" of "GT".
71 | newpath
72 | 0 height moveto
73 | height lw add 2 div 0 rlineto
74 | 0 height neg rlineto
75 | lw neg 0 rlineto
76 | 0 height lw sub rlineto
77 | height lw sub 2 div neg 0 rlineto
78 | closepath fill
79 |
80 | % The right half of the top of the "T"
81 | newpath
82 | % (height + lw)/2 + lw
83 | height lw add 2 div lw add height moveto
84 | % height - (above) = height - height/2 - 3/2 lw = height/2-3/2lw
85 | height 3 lw mul sub 2 div 0 rlineto
86 | 0 lw neg rlineto
87 | height 3 lw mul sub 2 div neg 0 rlineto
88 | closepath fill
89 | } if
90 |
91 |
92 | grestore
93 | showpage
94 | %%EOF
95 |
--------------------------------------------------------------------------------
/rtl/bigadd.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: bigadd.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose:
8 | //
9 | // Creator: Dan Gisselquist, Ph.D.
10 | // Gisselquist Technology, LLC
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Copyright (C) 2016-2020, Gisselquist Technology, LLC
15 | //
16 | // This program is free software (firmware): you can redistribute it and/or
17 | // modify it under the terms of the GNU General Public License as published
18 | // by the Free Software Foundation, either version 3 of the License, or (at
19 | // your option) any later version.
20 | //
21 | // This program is distributed in the hope that it will be useful, but WITHOUT
22 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | // for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License along
27 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | // target there if the PDF file isn't present.) If not, see
29 | // for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | `default_nettype none
39 | //
40 | module bigadd(i_clk, i_sync, i_a, i_b, o_r, o_sync);
41 | parameter NCLOCKS = 1;
42 | input wire i_clk, i_sync;
43 | input wire [63:0] i_a, i_b;
44 | output wire [63:0] o_r;
45 | output wire o_sync;
46 |
47 | generate
48 | if (NCLOCKS == 0)
49 | begin
50 | assign o_sync= i_sync;
51 | assign o_r = i_a + i_b;
52 | end else if (NCLOCKS == 1)
53 | begin
54 | reg r_sync;
55 | reg [63:0] r_out;
56 | always @(posedge i_clk)
57 | r_sync <= i_sync;
58 | always @(posedge i_clk)
59 | r_out <= i_a+i_b;
60 |
61 | assign o_sync = r_sync;
62 | assign o_r = r_out;
63 | end else // if (NCLOCKS == 2)
64 | begin
65 | reg r_sync, r_pps;
66 | reg [31:0] r_hi, r_low;
67 |
68 | reg f_sync;
69 | reg [63:0] f_r;
70 |
71 | initial r_sync = 1'b0;
72 | always @(posedge i_clk)
73 | r_sync <= i_sync;
74 |
75 | always @(posedge i_clk)
76 | { r_pps, r_low } <= i_a[31:0] + i_b[31:0];
77 | always @(posedge i_clk)
78 | r_hi <= i_a[63:32] + i_b[63:32];
79 |
80 | initial f_sync = 1'b0;
81 | always @(posedge i_clk)
82 | f_sync <= r_sync;
83 | always @(posedge i_clk)
84 | f_r[31:0] <= r_low;
85 | always @(posedge i_clk)
86 | f_r[63:32] <= r_hi + { 31'h00, r_pps };
87 |
88 | assign o_sync = f_sync;
89 | assign o_r = f_r;
90 | end endgenerate
91 |
92 | endmodule
93 |
--------------------------------------------------------------------------------
/rtl/bigsub.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: bigsub.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To subtract two 64-bit numbers, while maintaining
8 | // synchronization to whatever purpose these numbers had
9 | // originally. For this reason, there is an i_sync input and an o_sync
10 | // output. If i_sync is true with a particular set of data, o_sync will
11 | // then be true when that data is placed on the output.
12 | //
13 | // If we needed to slow this down even more, I suppose we could register
14 | // the inputs before we used them ...
15 | //
16 | // Creator: Dan Gisselquist, Ph.D.
17 | // Gisselquist Technology, LLC
18 | //
19 | ////////////////////////////////////////////////////////////////////////////////
20 | //
21 | // Copyright (C) 2016-2020, Gisselquist Technology, LLC
22 | //
23 | // This program is free software (firmware): you can redistribute it and/or
24 | // modify it under the terms of the GNU General Public License as published
25 | // by the Free Software Foundation, either version 3 of the License, or (at
26 | // your option) any later version.
27 | //
28 | // This program is distributed in the hope that it will be useful, but WITHOUT
29 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
30 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 | // for more details.
32 | //
33 | // You should have received a copy of the GNU General Public License along
34 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
35 | // target there if the PDF file isn't present.) If not, see
36 | // for a copy.
37 | //
38 | // License: GPL, v3, as defined and found on www.gnu.org,
39 | // http://www.gnu.org/licenses/gpl.html
40 | //
41 | //
42 | ////////////////////////////////////////////////////////////////////////////////
43 | //
44 | //
45 | `default_nettype none
46 | //
47 | module bigsub(i_clk, i_sync, i_a, i_b, o_r, o_sync);
48 | parameter NCLOCKS = 1;
49 | input wire i_clk, i_sync;
50 | input wire [63:0] i_a, i_b;
51 | output wire [63:0] o_r;
52 | output wire o_sync;
53 |
54 | generate
55 | if (NCLOCKS == 0)
56 | begin
57 | assign o_sync= i_sync;
58 | assign o_r = i_a - i_b;
59 | end else if (NCLOCKS == 1)
60 | begin
61 | reg r_sync;
62 | reg [63:0] r_out;
63 | always @(posedge i_clk)
64 | r_sync <= i_sync;
65 | always @(posedge i_clk)
66 | r_out <= i_a - i_b;
67 |
68 | assign o_sync = r_sync;
69 | assign o_r = r_out;
70 | end else // if (NCLOCKS == 2)
71 | begin
72 | reg r_sync, r_pps;
73 | reg [31:0] r_hi, r_low;
74 |
75 | reg [63:0] f_r;
76 | reg f_sync;
77 |
78 | wire [63:0] i_b_n;
79 | assign i_b_n = ~i_b;
80 |
81 | initial r_sync = 1'b0;
82 | always @(posedge i_clk)
83 | r_sync <= i_sync;
84 |
85 | always @(posedge i_clk)
86 | { r_pps, r_low } <= i_a[31:0] + i_b_n[31:0] + 1'b1;
87 | always @(posedge i_clk)
88 | r_hi <= i_a[63:32] + i_b_n[63:32];
89 |
90 | initial f_sync = 1'b0;
91 | always @(posedge i_clk)
92 | f_sync <= r_sync;
93 | always @(posedge i_clk)
94 | f_r[31:0] <= r_low;
95 | always @(posedge i_clk)
96 | f_r[63:32] <= r_hi + { 31'h00, r_pps };
97 |
98 | assign o_sync = f_sync;
99 | assign o_r = f_r;
100 |
101 | end endgenerate
102 |
103 | endmodule
104 |
105 |
--------------------------------------------------------------------------------
/rtl/enet/addepad.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: addepad.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To force the minimum packet size of an ethernet frame to be
8 | // a minimum of 64 bytes. This assumes that the CRC will be
9 | // adding 32-bits to the packet after us, so instead of padding to
10 | // 64 bytes, we'll pad to 60 bytes instead. If the user is providing
11 | // their own CRC, they'll need to adjust the padding themselves.
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | module addepad(i_clk, i_ce, i_cancel, i_v, i_d, o_v, o_d);
43 | parameter MINNIBBLES=120;
44 | localparam LGNCOUNT=(MINNIBBLES<63)? 6
45 | :((MINNIBBLES<127)? 7:((MINNIBBLES<255)? 8:9));
46 | input wire i_clk, i_ce, i_cancel;
47 | input wire i_v; // Valid
48 | input wire [3:0] i_d; // Data nibble
49 | output reg o_v;
50 | output reg [3:0] o_d;
51 |
52 | reg [(LGNCOUNT-1):0] r_ncnt;
53 | initial o_v = 1'b0;
54 | always @(posedge i_clk)
55 | if (i_ce)
56 | begin
57 | if (((!i_v)&&(!o_v))||(i_cancel))
58 | begin
59 | r_ncnt <= 0;
60 | o_v <= 1'b0;
61 | end else if (i_v)
62 | begin
63 | o_v <= i_v;
64 | r_ncnt <= (r_ncnt for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | module addepreamble(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_v, o_d);
40 | input wire i_clk, i_ce, i_en, i_cancel;
41 | input wire i_v; // Valid
42 | input wire [3:0] i_d; // Data nibble
43 | output wire o_v;
44 | output wire [3:0] o_d;
45 |
46 | reg [84:0] shiftreg;
47 | reg r_v;
48 | reg [3:0] r_d;
49 |
50 | initial r_v = 1'b0;
51 | always @(posedge i_clk)
52 | if (i_ce)
53 | begin
54 | shiftreg <= { shiftreg[79:0], { i_v, i_d }};
55 | r_v <= shiftreg[84];
56 | r_d <= shiftreg[83:80];
57 | if (((!i_v)&&(!o_v))||(i_cancel))
58 | begin
59 | shiftreg <= { 5'h00, 5'h15, 5'h15, 5'h15, 5'h15,
60 | 5'h15, 5'h15, 5'h15, 5'h15,
61 | 5'h15, 5'h15, 5'h15, 5'h15,
62 | 5'h15, 5'h15, 5'h15, 5'h1d };
63 | if (!i_en)
64 | begin
65 | shiftreg[ 4] <= 1'b0;
66 | shiftreg[ 9] <= 1'b0;
67 | shiftreg[14] <= 1'b0;
68 | shiftreg[19] <= 1'b0;
69 | shiftreg[24] <= 1'b0;
70 | shiftreg[29] <= 1'b0;
71 | shiftreg[34] <= 1'b0;
72 | shiftreg[39] <= 1'b0;
73 | shiftreg[44] <= 1'b0;
74 | shiftreg[49] <= 1'b0;
75 | shiftreg[54] <= 1'b0;
76 | shiftreg[59] <= 1'b0;
77 | shiftreg[64] <= 1'b0;
78 | shiftreg[69] <= 1'b0;
79 | shiftreg[74] <= 1'b0;
80 | shiftreg[79] <= 1'b0;
81 | end
82 | end
83 | end
84 |
85 | assign o_v = r_v;
86 | assign o_d = r_d;
87 |
88 | endmodule
89 |
--------------------------------------------------------------------------------
/rtl/enet/rxeipchk.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: rxeipchk.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To cull any IP packets (EtherType=0x0806) from the stream
8 | // whose packet header checksums don't match.
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2016-2020, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | `default_nettype none
40 | //
41 | module rxeipchk(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_err);
42 | input wire i_clk, i_ce, i_en, i_cancel;
43 | input wire i_v; // Valid
44 | input wire [3:0] i_d; // Data nibble
45 | output reg o_err;
46 |
47 | reg r_v;
48 | reg [15:0] r_word;
49 | reg [7:0] r_cnt;
50 | reg [5:0] r_idx;
51 | always @(posedge i_clk)
52 | if (i_ce)
53 | begin
54 | if ((!i_v)||(i_cancel))
55 | begin
56 | r_cnt <= 0;
57 | r_idx <= 0;
58 | end else if(i_v)
59 | begin
60 | if (!(&r_cnt))
61 | r_cnt <= r_cnt + 1'b1;
62 | if (&r_cnt)
63 | r_v <= 1'b0;
64 | else
65 | r_v <= (r_cnt[1:0] == 2'b11);
66 | if (r_cnt[1:0]==2'b11)
67 | r_idx[5:0] <= r_cnt[7:2];
68 | if (!r_cnt[0])
69 | r_word <= { r_word[7:0], 4'h0, i_d };
70 | else
71 | r_word[7:4] <= i_d;
72 | end
73 | end
74 |
75 | reg r_ip;
76 | reg [5:0] r_hlen;
77 | reg [16:0] r_check;
78 | always @(posedge i_clk)
79 | if (i_ce)
80 | begin
81 | if ((!i_v)||(i_cancel))
82 | begin
83 | o_err <= 0;
84 | r_check <= 0;
85 | r_ip <= 0;
86 | end else if (r_v)
87 | begin
88 | if (r_idx == 6'h6)
89 | r_ip <= (r_word == 16'h0800);
90 | else if (r_idx == r_hlen)
91 | r_ip <= 1'b0;
92 | if (r_idx == 6'h7)
93 | r_hlen <= {r_word[11:8], 1'b0 } + 5'h7;
94 | if (r_idx == r_hlen)
95 | o_err <= (r_ip)&&(i_en)&&(r_check[15:0] != 16'hffff);
96 | if (r_ip)
97 | r_check <= r_check[15:0] + r_word + { 15'h0, r_check[16]};
98 | end
99 | end
100 |
101 | endmodule
102 |
--------------------------------------------------------------------------------
/rtl/enet/rxemin.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: rxemin.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To force the minimum received packet size of an ethernet frame
8 | // to be a minimum of 64 bytes. Packets less than 64-bytes
9 | // (including CRC) need to be dropped. This module handles that
10 | // logic.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2016-2020, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | `default_nettype none
42 | //
43 | module rxemin(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_err);
44 | parameter MINNIBBLES=120;
45 | localparam LGNCOUNT=(MINNIBBLES<63)? 6
46 | :((MINNIBBLES<127)? 7:((MINNIBBLES<255)? 8:9));
47 | input wire i_clk, i_ce, i_en, i_cancel;
48 | input wire i_v; // Valid
49 | input wire [3:0] i_d; // Data nibble
50 | output reg o_err;
51 |
52 | reg last_v;
53 | reg [(LGNCOUNT-1):0] r_ncnt;
54 | initial last_v = 1'b0;
55 | always @(posedge i_clk)
56 | if (i_ce)
57 | begin
58 | last_v <= i_v;
59 |
60 | if ((!i_v)||(i_cancel))
61 | begin
62 | // Here's our reset. If th input isn't valid (i.e., no
63 | // packet present), or if we are cancelling the packet,
64 | // then we come in here and reset our interface.
65 | r_ncnt <= 0;
66 | o_err <= 0;
67 | end else if (i_v)
68 | begin
69 | r_ncnt <= (r_ncnt for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | `default_nettype none
39 | //
40 | module rxepreambl(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_v, o_d);
41 | input wire i_clk, i_ce, i_en, i_cancel;
42 | input wire i_v;
43 | input wire [3:0] i_d;
44 | output reg o_v;
45 | output reg [3:0] o_d;
46 |
47 | reg r_inpkt, r_cancel;
48 | reg [14:0] r_buf;
49 |
50 | always @(posedge i_clk)
51 | if(i_ce)
52 | begin
53 | if (((!i_v)&&(!o_v))||(i_cancel))
54 | begin
55 | // Set us up
56 | r_inpkt <= 1'b0;
57 | r_cancel <= (i_v)||(o_v);
58 | end else if (r_cancel)
59 | r_cancel <= (i_v)||(o_v);
60 |
61 | if ((i_en)&&(!r_inpkt))
62 | begin
63 | r_buf <= { r_buf[9:0], i_v, i_d };
64 | r_inpkt <= (!r_cancel)&&((r_buf == { 5'h15, 5'h15, 5'h15 })&&(i_v)&&(i_d == 4'hd));
65 | o_v <= 1'b0;
66 | end else begin
67 | o_v <= (i_v)&&(!r_cancel)&&(r_inpkt);
68 | o_d <= i_d;
69 | end
70 | end
71 | endmodule
72 |
73 |
--------------------------------------------------------------------------------
/rtl/iscachable.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: ./iscachable.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // DO NOT EDIT THIS FILE!
8 | // Computer Generated: This file is computer generated by AUTOFPGA. DO NOT EDIT.
9 | // DO NOT EDIT THIS FILE!
10 | //
11 | // CmdLine: autofpga autofpga -d -o . allclocks.txt global.txt icape.txt version.txt buserr.txt pic.txt pwrcount.txt spio.txt clrspio.txt rtcgps.txt rtcdate.txt wbuconsole.txt bkram.txt spansion.txt sdram.txt zipmaster.txt mdio.txt enet.txt gps.txt wboledrgb.txt mem_flash_bkram.txt mem_bkram_only.txt mem_sdram_bkram.txt
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2017-2020, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | `default_nettype none
43 | //
44 | module iscachable(i_addr, o_cachable);
45 | localparam AW = 27;
46 | input wire [AW-1:0] i_addr;
47 | output reg o_cachable;
48 |
49 | always @(*)
50 | begin
51 | o_cachable = 1'b0;
52 | // Bus master: wb
53 | // Bus master: wb_dio
54 | // Bus master: wb_sio
55 | // bkram
56 | if ((i_addr[26:0] & 27'h7c00000) == 27'h2000000)
57 | o_cachable = 1'b1;
58 | // flash
59 | if ((i_addr[26:0] & 27'h7c00000) == 27'h2400000)
60 | o_cachable = 1'b1;
61 | // sdram
62 | if ((i_addr[26:0] & 27'h4000000) == 27'h4000000)
63 | o_cachable = 1'b1;
64 | end
65 |
66 | endmodule
67 |
--------------------------------------------------------------------------------
/rtl/make.inc:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: ./rtl.make.inc
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## DO NOT EDIT THIS FILE!
8 | ## Computer Generated: This file is computer generated by AUTOFPGA. DO NOT EDIT.
9 | ## DO NOT EDIT THIS FILE!
10 | ##
11 | ## CmdLine: autofpga autofpga -d -o . allclocks.txt global.txt icape.txt version.txt buserr.txt pic.txt pwrcount.txt spio.txt clrspio.txt rtcgps.txt rtcdate.txt wbuconsole.txt bkram.txt spansion.txt sdram.txt zipmaster.txt mdio.txt enet.txt gps.txt wboledrgb.txt mem_flash_bkram.txt mem_bkram_only.txt mem_sdram_bkram.txt
12 | ##
13 | ## Creator: Dan Gisselquist, Ph.D.
14 | ## Gisselquist Technology, LLC
15 | ##
16 | ################################################################################
17 | ##
18 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
19 | ##
20 | ## This program is free software (firmware): you can redistribute it and/or
21 | ## modify it under the terms of the GNU General Public License as published
22 | ## by the Free Software Foundation, either version 3 of the License, or (at
23 | ## your option) any later version.
24 | ##
25 | ## This program is distributed in the hope that it will be useful, but WITHOUT
26 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | ## for more details.
29 | ##
30 | ## You should have received a copy of the GNU General Public License along
31 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | ## target there if the PDF file isn't present.) If not, see
33 | ## for a copy.
34 | ##
35 | ## License: GPL, v3, as defined and found on www.gnu.org,
36 | ## http://www.gnu.org/licenses/gpl.html
37 | ##
38 | ##
39 | ################################################################################
40 | ##
41 | ##
42 | ZIPCPUD := cpu
43 | ZIPCPU := $(addprefix $(ZIPCPUD)/,zipcpu.v cpuops.v pfcache.v pipemem.v idecode.v wbpriarbiter.v zipsystem.v zipcounter.v zipjiffies.v ziptimer.v wbdmac.v icontrol.v wbwatchdog.v busdelay.v cpudefs.v)
44 | ICAP := wbicapetwo.v
45 |
46 | GPS := gpsclock_tb.v gpsclock.v bigadd.v bigsub.v bigsmpy.v
47 |
48 | BUSPICD := cpu
49 | BUSPIC := $(addprefix $(BUSPICD)/,icontrol.v)
50 | WBUBUSD := wbubus
51 | WBUBUS := $(addprefix $(WBUBUSD)/,wbuconsole.v wbufifo.v wbucompactlines.v wbucompress.v wbudecompress.v wbudeword.v wbuexec.v wbuidleint.v wbuinput.v wbuoutput.v wbureadcw.v wbusixchar.v wbutohex.v wbconsole.v)
52 | FLASH := qflexpress.v
53 |
54 | CONSOLED := wbuart
55 | CONSOLE := $(addprefix $(CONSOLED)/,txuartlite.v rxuartlite.v ufifo.v)
56 | RTCGPSD := rtc
57 | RTCGPS := $(addprefix $(RTCGPSD)/,rtcgps.v rtcbare.v rtctimer.v rtcstopwatch.v rtcalarm.v rtclight.v)
58 | BKRAM := memdev.v
59 |
60 | RTCDATED := rtc
61 | RTCDATE := $(addprefix $(RTCDATED)/,rtcdate.v)
62 | ENETMDIOD := enet
63 | ENETMDIO := $(addprefix $(ENETMDIOD)/,enetctrl.v)
64 | VFLIST := main.v $(ZIPCPU) $(ICAP) $(GPS) $(BUSPIC) $(WBUBUS) $(FLASH) $(CONSOLE) $(RTCGPS) $(BKRAM) $(RTCDATE) $(ENETMDIO)
65 | AUTOVDIRS := -y enet -y cpu -y wbubus -y wbuart -y rtc
66 |
--------------------------------------------------------------------------------
/rtl/micron.hex:
--------------------------------------------------------------------------------
1 | 7ff
2 | 7ff
3 | 7ff
4 | 7ff
5 | 7ff
6 | 7ff
7 | 0ff
8 | 0ff
9 | 7ff
10 | 006
11 | 404
12 | 081
13 | 0f3
14 | 404
15 | 006
16 | 404
17 | 061
18 | 0de
19 | 7ff
20 | 7ff
21 | 0eb
22 | 200
23 | 200
24 | 200
25 | 2a0
26 | 200
27 | 200
28 | 200
29 | 300
30 | 300
31 | 7ff
32 | 7ff
33 |
--------------------------------------------------------------------------------
/rtl/spansion.hex:
--------------------------------------------------------------------------------
1 | 7ff
2 | 7ff
3 | 7ff
4 | 7ff
5 | 7ff
6 | 7ff
7 | 7ff
8 | 7ff
9 | 7ff
10 | 7ff
11 | 7ff
12 | 7ff
13 | 7ff
14 | 7ff
15 | 7ff
16 | 7ff
17 | 7ff
18 | 7ff
19 | 0ff
20 | 0ff
21 | 7ff
22 | 7ff
23 | 0eb
24 | 200
25 | 200
26 | 200
27 | 2a0
28 | 200
29 | 300
30 | 300
31 | 7ff
32 | 7ff
33 |
--------------------------------------------------------------------------------
/rtl/wbubus/wbudeword.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: wbudeword.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Once a word has come from the bus, undergone compression, had
8 | // idle cycles and interrupts placed in it, this routine converts
9 | // that word form a 36-bit single word into a series of 6-bit words
10 | // that can head to the output routine. Hence, it 'deword's the value:
11 | // unencoding the 36-bit word encoding.
12 | //
13 | //
14 | // Creator: Dan Gisselquist, Ph.D.
15 | // Gisselquist Technology, LLC
16 | //
17 | ////////////////////////////////////////////////////////////////////////////////
18 | //
19 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
20 | //
21 | // This program is free software (firmware): you can redistribute it and/or
22 | // modify it under the terms of the GNU General Public License as published
23 | // by the Free Software Foundation, either version 3 of the License, or (at
24 | // your option) any later version.
25 | //
26 | // This program is distributed in the hope that it will be useful, but WITHOUT
27 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 | // for more details.
30 | //
31 | // You should have received a copy of the GNU General Public License along
32 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
33 | // target there if the PDF file isn't present.) If not, see
34 | // for a copy.
35 | //
36 | // License: GPL, v3, as defined and found on www.gnu.org,
37 | // http://www.gnu.org/licenses/gpl.html
38 | //
39 | //
40 | ////////////////////////////////////////////////////////////////////////////////
41 | //
42 | //
43 | `default_nettype none
44 | //
45 | module wbudeword(i_clk, i_stb, i_word, i_tx_busy, o_stb, o_nl_hexbits, o_busy);
46 | input wire i_clk, i_stb;
47 | input wire [35:0] i_word;
48 | input wire i_tx_busy;
49 | output reg o_stb;
50 | output reg [6:0] o_nl_hexbits;
51 | output reg o_busy;
52 |
53 |
54 | wire [2:0] w_len;
55 | assign w_len = (i_word[35:33]==3'b000)? 3'b001
56 | : (i_word[35:32]==4'h2)? 3'b110
57 | : (i_word[35:32]==4'h3)? (3'b010+{1'b0,i_word[31:30]})
58 | : (i_word[35:34]==2'b01)? 3'b010
59 | : (i_word[35:34]==2'b10)? 3'b001
60 | : 3'b110;
61 |
62 | reg [2:0] r_len;
63 | reg [29:0] r_word;
64 | initial o_stb = 1'b0;
65 | initial o_busy = 1'b0;
66 | initial o_nl_hexbits = 7'h40;
67 | initial r_len = 0;
68 | always @(posedge i_clk)
69 | if ((i_stb)&&(!o_busy)) // Only accept when not busy
70 | begin
71 | r_word <= i_word[29:0];
72 | o_nl_hexbits <= { 1'b0, i_word[35:30] }; // No newline ... yet
73 | end else if (!i_tx_busy)
74 | begin
75 | if (r_len > 1)
76 | begin
77 | o_nl_hexbits <= { 1'b0, r_word[29:24] };
78 | r_word[29:6] <= r_word[23:0];
79 | end else if (!o_nl_hexbits[6])
80 | begin
81 | // Place a 7'h40 between every pair of words
82 | o_nl_hexbits <= 7'h40;
83 | end
84 | end
85 |
86 | initial o_stb = 1'b0;
87 | always @(posedge i_clk)
88 | if (i_stb && !o_busy)
89 | o_stb <= 1'b1;
90 | else if (r_len == 0 && !i_tx_busy)
91 | o_stb <= 1'b0;
92 |
93 | initial r_len = 0;
94 | always @(posedge i_clk)
95 | if (i_stb && !o_busy)
96 | r_len <= w_len;
97 | else if (!i_tx_busy && (r_len > 0))
98 | r_len <= r_len - 1;
99 |
100 | always @(*)
101 | o_busy = o_stb;
102 |
103 | `ifdef FORMAL
104 | // Formal properties for this module are maintained elsewhere
105 | `endif
106 | endmodule
107 |
108 |
--------------------------------------------------------------------------------
/rtl/wbubus/wbuinput.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: wbuinput.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Coordinates the receiption of bytes, which are then translated
8 | // into codewords describing postential bus transactions. This
9 | // includes turning the human readable bytes into more compact bits,
10 | // forming those bits into codewords, and decompressing any that reference
11 | // addresses within a compression table.
12 | //
13 | //
14 | // Creator: Dan Gisselquist, Ph.D.
15 | // Gisselquist Technology, LLC
16 | //
17 | ////////////////////////////////////////////////////////////////////////////////
18 | //
19 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
20 | //
21 | // This program is free software (firmware): you can redistribute it and/or
22 | // modify it under the terms of the GNU General Public License as published
23 | // by the Free Software Foundation, either version 3 of the License, or (at
24 | // your option) any later version.
25 | //
26 | // This program is distributed in the hope that it will be useful, but WITHOUT
27 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 | // for more details.
30 | //
31 | // You should have received a copy of the GNU General Public License along
32 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
33 | // target there if the PDF file isn't present.) If not, see
34 | // for a copy.
35 | //
36 | // License: GPL, v3, as defined and found on www.gnu.org,
37 | // http://www.gnu.org/licenses/gpl.html
38 | //
39 | //
40 | ////////////////////////////////////////////////////////////////////////////////
41 | //
42 | //
43 | `default_nettype none
44 | //
45 | module wbuinput(i_clk, i_stb, i_byte, o_stb, o_codword);
46 | input wire i_clk, i_stb;
47 | input wire [7:0] i_byte;
48 | output wire o_stb;
49 | output wire [35:0] o_codword;
50 |
51 | wire hx_stb, hx_valid;
52 | wire [5:0] hx_hexbits;
53 | wbutohex tobits(i_clk, i_stb, i_byte,
54 | hx_stb, hx_valid, hx_hexbits);
55 |
56 | wire cw_stb;
57 | wire [35:0] cw_word;
58 | wbureadcw formcw(i_clk, hx_stb, hx_valid, hx_hexbits,
59 | cw_stb, cw_word);
60 |
61 | // `define DEBUGGING
62 | `ifdef DEBUGGING
63 | assign o_stb = cw_stb;
64 | assign o_codword = cw_word;
65 | `else
66 | wbudecompress unpack(i_clk,cw_stb,cw_word, o_stb, o_codword);
67 | `endif
68 |
69 | endmodule
70 |
--------------------------------------------------------------------------------
/rtl/wbubus/wbusixchar.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: wbusixchar.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Supports a conversion from a six digit bus to a printable
8 | // ASCII character representing those six bits. The encoding is
9 | // as follows:
10 | //
11 | // 0-9 -> 0-9
12 | // A-Z -> 10-35
13 | // a-z -> 36-61
14 | // @ -> 62
15 | // % -> 63
16 | //
17 | // Note that decoding is stateless, yet requires one clock.
18 | //
19 | //
20 | // Creator: Dan Gisselquist, Ph.D.
21 | // Gisselquist Technology, LLC
22 | //
23 | ////////////////////////////////////////////////////////////////////////////////
24 | //
25 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
26 | //
27 | // This program is free software (firmware): you can redistribute it and/or
28 | // modify it under the terms of the GNU General Public License as published
29 | // by the Free Software Foundation, either version 3 of the License, or (at
30 | // your option) any later version.
31 | //
32 | // This program is distributed in the hope that it will be useful, but WITHOUT
33 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
34 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
35 | // for more details.
36 | //
37 | // You should have received a copy of the GNU General Public License along
38 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
39 | // target there if the PDF file isn't present.) If not, see
40 | // for a copy.
41 | //
42 | // License: GPL, v3, as defined and found on www.gnu.org,
43 | // http://www.gnu.org/licenses/gpl.html
44 | //
45 | //
46 | ////////////////////////////////////////////////////////////////////////////////
47 | //
48 | //
49 | `default_nettype none
50 | //
51 | module wbusixchar(i_clk, i_stb, i_bits, o_stb, o_char, o_busy, i_busy);
52 | input wire i_clk;
53 | input wire i_stb;
54 | input wire [6:0] i_bits;
55 | output reg o_stb;
56 | output reg [7:0] o_char;
57 | output wire o_busy;
58 | input wire i_busy;
59 |
60 | initial o_char = 8'h00;
61 | always @(posedge i_clk)
62 | if ((i_stb)&&(!o_busy))
63 | begin
64 | if (i_bits[6])
65 | o_char <= 8'h0a;
66 | else if (i_bits[5:0] <= 6'h09) // A digit, WORKS
67 | o_char <= "0" + { 4'h0, i_bits[3:0] };
68 | else if (i_bits[5:0] <= 6'd35) // Upper case
69 | o_char <= "A" + { 2'h0, i_bits[5:0] } - 8'd10; // -'A'+10
70 | else if (i_bits[5:0] <= 6'd61)
71 | o_char <= "a" + { 2'h0, i_bits[5:0] } - 8'd36;// -'a'+(10+26)
72 | else if (i_bits[5:0] == 6'd62) // An '@' sign
73 | o_char <= 8'h40;
74 | else // if (i_char == 6'h63) // A '%' sign
75 | o_char <= 8'h25;
76 | end
77 |
78 | initial o_stb = 1'b0;
79 | always @(posedge i_clk)
80 | if ((o_stb)&&(!i_busy))
81 | o_stb <= 1'b0;
82 | else if ((i_stb)&&(!o_stb))
83 | o_stb <= 1'b1;
84 |
85 | assign o_busy = o_stb;
86 |
87 | endmodule
88 |
89 |
--------------------------------------------------------------------------------
/rtl/wbubus/wbutohex.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: wbutohex.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Supports a printable character conversion from a printable
8 | // ASCII character to six bits of valid data. The encoding is
9 | // as follows:
10 | //
11 | // 0-9 -> 0-9
12 | // A-Z -> 10-35
13 | // a-z -> 36-61
14 | // @ -> 62
15 | // % -> 63
16 | //
17 | // Note that decoding is stateless, yet requires one clock.
18 | //
19 | //
20 | // Creator: Dan Gisselquist, Ph.D.
21 | // Gisselquist Technology, LLC
22 | //
23 | ////////////////////////////////////////////////////////////////////////////////
24 | //
25 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
26 | //
27 | // This program is free software (firmware): you can redistribute it and/or
28 | // modify it under the terms of the GNU General Public License as published
29 | // by the Free Software Foundation, either version 3 of the License, or (at
30 | // your option) any later version.
31 | //
32 | // This program is distributed in the hope that it will be useful, but WITHOUT
33 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
34 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
35 | // for more details.
36 | //
37 | // You should have received a copy of the GNU General Public License along
38 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
39 | // target there if the PDF file isn't present.) If not, see
40 | // for a copy.
41 | //
42 | // License: GPL, v3, as defined and found on www.gnu.org,
43 | // http://www.gnu.org/licenses/gpl.html
44 | //
45 | //
46 | ////////////////////////////////////////////////////////////////////////////////
47 | //
48 | //
49 | `default_nettype none
50 | //
51 | module wbutohex(i_clk, i_stb, i_byte, o_stb, o_valid, o_hexbits);
52 | input wire i_clk, i_stb;
53 | input wire [7:0] i_byte;
54 | output reg o_stb, o_valid;
55 | output reg [5:0] o_hexbits;
56 |
57 | initial o_stb = 1'b0;
58 | always @(posedge i_clk)
59 | o_stb <= i_stb;
60 |
61 | always @(posedge i_clk)
62 | begin
63 | // These are the defaults, to be overwridden by the ifs below
64 | o_valid <= 1'b1;
65 | o_hexbits <= 6'h00;
66 |
67 | if ((i_byte >= 8'h30)&&(i_byte <= 8'h39)) // A digit
68 | o_hexbits <= { 2'b0, i_byte[3:0] };
69 | else if ((i_byte >= 8'h41)&&(i_byte <= 8'h5a)) // Upper case
70 | o_hexbits <= (i_byte[5:0] - 6'h01 + 6'h0a);// -'A'+10
71 | else if ((i_byte >= 8'h61)&&(i_byte <= 8'h7a))
72 | o_hexbits <= (i_byte[5:0] +6'h03); // -'a'+(10+26)
73 | else if (i_byte == 8'h40) // An '@' sign
74 | o_hexbits <= 6'h3e;
75 | else if (i_byte == 8'h25) // A '%' sign
76 | o_hexbits <= 6'h3f;
77 | else
78 | o_valid <= 1'b0;
79 | end
80 | endmodule
81 |
82 |
--------------------------------------------------------------------------------
/rtl/xioddr.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: xioddr.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: For the DDR3 SDRAM, this handles the Xilinx specific portions
8 | // of the IO necessary to make this happen for one pin only. (In
9 | // the end, this never worked for the DDR3 SDRAM ...) In the case of the
10 | // QSPI flash, this module helps to reduce the logic delays on the "high
11 | // speed" flash data wires (it's not really used in any DDR mode in that
12 | // case ...).
13 | //
14 | // Creator: Dan Gisselquist, Ph.D.
15 | // Gisselquist Technology, LLC
16 | //
17 | ////////////////////////////////////////////////////////////////////////////////
18 | //
19 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
20 | //
21 | // This program is free software (firmware): you can redistribute it and/or
22 | // modify it under the terms of the GNU General Public License as published
23 | // by the Free Software Foundation, either version 3 of the License, or (at
24 | // your option) any later version.
25 | //
26 | // This program is distributed in the hope that it will be useful, but WITHOUT
27 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 | // for more details.
30 | //
31 | // You should have received a copy of the GNU General Public License along
32 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
33 | // target there if the PDF file isn't present.) If not, see
34 | // for a copy.
35 | //
36 | // License: GPL, v3, as defined and found on www.gnu.org,
37 | // http://www.gnu.org/licenses/gpl.html
38 | //
39 | //
40 | ////////////////////////////////////////////////////////////////////////////////
41 | //
42 | //
43 | `default_nettype none
44 | //
45 | module xioddr(i_clk, i_oe, i_v, o_v, io_pin);
46 | input wire i_clk, i_oe;
47 | input wire [1:0] i_v;
48 | output wire [1:0] o_v;
49 | inout wire io_pin;
50 |
51 | wire w_internal;
52 | reg last;
53 |
54 | always @(posedge i_clk)
55 | last <= i_v[1];
56 |
57 | ODDR #(
58 | .DDR_CLK_EDGE("SAME_EDGE"),
59 | .INIT(1'b0),
60 | .SRTYPE("SYNC")
61 | ) ODDRi(
62 | .Q(w_internal),
63 | .C(i_clk),
64 | .CE(1'b1),
65 | .D1(last), // Negative clock edge (goes first)
66 | .D2(i_v[0]), // Positive clock edge
67 | .R(1'b0),
68 | .S(1'b0));
69 |
70 | IDDR #(
71 | .DDR_CLK_EDGE("SAME_EDGE_PIPELINED"),
72 | .INIT_Q1(1'b0),
73 | .INIT_Q2(1'b0),
74 | .SRTYPE("SYNC")
75 | ) IDDRi(
76 | .Q1(o_v[0]),
77 | .Q2(o_v[1]),
78 | .C(i_clk),
79 | .CE(1'b1),
80 | .D(io_pin),
81 | .R(1'b0),
82 | .S(1'b0));
83 |
84 | reg oedelay;
85 | initial oedelay = 0;
86 | always @(posedge i_clk)
87 | oedelay = i_oe;
88 | assign io_pin = (oedelay) ? w_internal:1'bz;
89 |
90 | endmodule
91 |
--------------------------------------------------------------------------------
/rtl/xoddr.v:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: xoddr.v
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: For the DDR3 SDRAM, this handles the Xilinx specific portions
8 | // of the output necessary to make this happen for one pin only.
9 | // For the QSPI, this helps to make certain that as much of the logic
10 | // delay as possible has been removed from the path--to get the full
11 | // 100MHz speed.
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | `default_nettype none
43 | //
44 | module xoddr(i_clk, i_v, o_pin);
45 | input wire i_clk;
46 | input wire [1:0] i_v;
47 | output wire o_pin;
48 |
49 | wire w_internal;
50 | reg last;
51 |
52 | always @(posedge i_clk)
53 | last <= i_v[1];
54 |
55 | ODDR #(
56 | .DDR_CLK_EDGE("SAME_EDGE"),
57 | .INIT(1'b0),
58 | .SRTYPE("SYNC")
59 | ) ODDRi(
60 | .Q(o_pin),
61 | .C(i_clk),
62 | .CE(1'b1),
63 | .D1(last), // Negative clock edge (goes first)
64 | .D2(i_v[0]), // Positive clock edge
65 | .R(1'b0),
66 | .S(1'b0));
67 |
68 | endmodule
69 |
--------------------------------------------------------------------------------
/scad/openarty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZipCPU/openarty/b75249d6db61db041008a2a8eafcd62aa0f1d0b5/scad/openarty.png
--------------------------------------------------------------------------------
/scad/zipcpu.scad:
--------------------------------------------------------------------------------
1 | zlogow = 62;
2 | zlogol = 14;
3 | zlogob = 6;
4 | zlogoh = 5;
5 | module zipcpulogo() {
6 | linear_extrude(height=zlogoh) {
7 | union() {
8 | // Z
9 | polygon(points=[
10 | [0,0],
11 | [8,0],
12 | [10,2],
13 | [4,2],
14 | [16,14],
15 | [6,14],
16 | [4,12],
17 | [12,12] ]);
18 | // Dot on the 'i'
19 | polygon(points=[
20 | [10,4],
21 | [12,4],
22 | [14,6],
23 | [12,6] ]);
24 | // The 'p'
25 | polygon(points=[
26 | [4,-6],
27 | [6,-6],
28 | [12,0],
29 | [18,0],
30 | [22,4],
31 | [22,6],
32 | [16,6],
33 | [14,4],
34 | [20,4],
35 | [18,2],
36 | [12,2] ]);
37 | // The C
38 | polygon(points=[
39 | [28,0],
40 | [28,2],
41 | [34,8],
42 | [42,8],
43 | [40,6],
44 | [34,6],
45 | [30,2],
46 | [36,2],
47 | [34,0] ]);
48 | // The P
49 | polygon(points=[
50 | [36,0],
51 | [38,0],
52 | [40,2],
53 | [46,2],
54 | [50,6],
55 | [50,8],
56 | [44,8],
57 | [42,6],
58 | [48,6],
59 | [46,4],
60 | [40,4]]);
61 | // The U
62 | polygon(points=[
63 | [48,0],
64 | [54,0],
65 | [62,8],
66 | [60,8],
67 | [54,2],
68 | [50,2],
69 | [56,8],
70 | [54,8],
71 | [48,2]]);
72 | }
73 | }
74 | }
75 |
76 | // zipcpulogo();
77 | // translate([0,-zlogob,-zlogoh]) color("red") cube([zlogow, zlogol+zlogob, zlogoh]);
78 |
79 |
--------------------------------------------------------------------------------
/sim/verilated/.gitignore:
--------------------------------------------------------------------------------
1 | busmaster_tb
2 | enetctrl_tb
3 | eqspiflash_tb
4 | sdcard.img
5 | pfile.bin
6 | micron.hex
7 | spansion.hex
8 |
9 |
--------------------------------------------------------------------------------
/sim/verilated/byteswap.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: byteswap.cpp
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To convert between little endian and big endian byte orders,
8 | // and to handle conversions between character strings and
9 | // bit-endian words made from those characters.
10 | //
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #include
42 | #include "byteswap.h"
43 |
44 | /*
45 | * byteswap
46 | *
47 | * Given a big (or little) endian word, return a little (or big) endian word.
48 | */
49 | uint32_t
50 | byteswap(uint32_t v) {
51 | uint32_t r = 0;
52 |
53 | r = (v & 0x0ff);
54 | r <<= 8; v >>= 8;
55 | r |= (v & 0x0ff);
56 | r <<= 8; v >>= 8;
57 | r |= (v & 0x0ff);
58 | r <<= 8; v >>= 8;
59 | r |= (v & 0x0ff);
60 |
61 | return r;
62 | }
63 |
64 |
65 | /*
66 | * byteswapbuf
67 | *
68 | * To swap from the byte order of every 32-bit word in the given buffer.
69 | */
70 | void
71 | byteswapbuf(int ln, uint32_t *buf) {
72 | for(int i=0; i for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #ifndef BYTESWAP_H
42 | #define BYTESWAP_H
43 |
44 | #include
45 |
46 | /*
47 | * The byte swapping routines below are designed to support conversions from a little endian
48 | * machine/host (such as my PC) to the big endian byte order used on the ZipCPU. If the current
49 | * machine is already little endian, no byte swapping is required.
50 | */
51 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
52 | /*
53 | * byteswap
54 | *
55 | * Given a big (or little) endian word, return a little (or big) endian word.
56 | */
57 | extern uint32_t
58 | byteswap(uint32_t v);
59 |
60 | /*
61 | * byteswapbuf
62 | *
63 | * To swap from the byte order of every 32-bit word in the given buffer.
64 | */
65 | extern void byteswapbuf(int ln, uint32_t *buf);
66 |
67 | #else
68 | #define byteswap(A) (A)
69 | #define byteswapbuf(A, B)
70 | #endif
71 |
72 | /*
73 | * buildword
74 | *
75 | * Given a pointer within an array of characters, build a 32-bit big-endian
76 | * word from those characters. Does not require the character pointer to be
77 | * aligned.
78 | */
79 | extern uint32_t buildword(const unsigned char *p);
80 |
81 | /*
82 | * buildswap
83 | *
84 | * Same as buildword, except that we build a little endian word from the
85 | * characters given to us. Hence the first character is the low order octet
86 | * of the word.
87 | */
88 | extern uint32_t buildswap(const unsigned char *p);
89 |
90 | #endif
91 |
--------------------------------------------------------------------------------
/sim/verilated/ddrsdramsim.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: ddrsdramsim.h
4 | //
5 | // Project: A wishbone controlled DDR3 SDRAM memory controller.
6 | //
7 | // Purpose:
8 | //
9 | // Creator: Dan Gisselquist, Ph.D.
10 | // Gisselquist Technology, LLC
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
15 | //
16 | // This program is free software (firmware): you can redistribute it and/or
17 | // modify it under the terms of the GNU General Public License as published
18 | // by the Free Software Foundation, either version 3 of the License, or (at
19 | // your option) any later version.
20 | //
21 | // This program is distributed in the hope that it will be useful, but WITHOUT
22 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | // for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License along
27 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
28 | // target there if the PDF file isn't present.) If not, see
29 | // for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | #ifndef DDRSDRAMSIM_H
39 | #define DDRSDRAMSIM_H
40 |
41 | #define DDR_MRSET 0
42 | #define DDR_REFRESH 1
43 | #define DDR_PRECHARGE 2
44 | #define DDR_ACTIVATE 3
45 | #define DDR_WRITE 4
46 | #define DDR_READ 5
47 | #define DDR_ZQS 6
48 | #define DDR_NOOP 7
49 |
50 | #define NBANKS 8
51 | #define NTIMESLOTS 32
52 |
53 | class BANKINFO {
54 | public:
55 | int m_state;
56 | unsigned m_row, m_wcounter;
57 | void tick(int cmd, unsigned addr=0);
58 | };
59 |
60 | class BUSTIMESLOT {
61 | public:
62 | int m_used, m_read, m_data, m_rtt;
63 | unsigned m_addr;
64 | };
65 |
66 | class DDRSDRAMSIM {
67 | int m_reset_state, m_reset_counts, m_memlen, m_busloc,
68 | m_clocks_since_refresh, m_nrefresh_issued,
69 | m_last_dqs, m_last_rtt;
70 | unsigned *m_mem;
71 | BANKINFO m_bank[8];
72 | BUSTIMESLOT *m_bus;
73 | int cmd(int,int,int,int);
74 | public:
75 | DDRSDRAMSIM(int lglen);
76 | unsigned operator()(int, int,
77 | int, int, int, int,
78 | int, int, int, int,
79 | int, int, int);
80 | unsigned &operator[](unsigned addr) { return m_mem[addr]; };
81 | };
82 |
83 | #endif
84 |
--------------------------------------------------------------------------------
/sim/verilated/enetctrlsim.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: enetsim.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose:
8 | //
9 | // Creator: Dan Gisselquist, Ph.D.
10 | // Gisselquist Technology, LLC
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Copyright (C) 2016-2020, Gisselquist Technology, LLC
15 | //
16 | // This program is free software (firmware): you can redistribute it and/or
17 | // modify it under the terms of the GNU General Public License as published
18 | // by the Free Software Foundation, either version 3 of the License, or (at
19 | // your option) any later version.
20 | //
21 | // This program is distributed in the hope that it will be useful, but WITHOUT
22 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | // for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License along
27 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
28 | // target there if the PDF file isn't present.) If not, see
29 | // for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | #ifndef ENETCTRLSIM_H
39 | #define ENETCTRLSIM_H
40 |
41 | #define ENET_MEMWORDS 32
42 | class ENETCTRLSIM {
43 | int m_consecutive_clocks, m_lastout,
44 | m_tickcount, m_ticks_per_clock, m_lastclk;
45 | int TICKS_PER_CLOCK, PHY_ADDR;
46 | int m_mem[ENET_MEMWORDS];
47 |
48 | public:
49 | bool m_synched;
50 | int m_datareg, m_halfword, m_outreg;
51 | ENETCTRLSIM(void);
52 | ~ENETCTRLSIM(void) {}
53 |
54 | int operator()(int inreset, int clk, int data);
55 | int operator[](int index) const;
56 | };
57 |
58 | #endif // ENETCTRLSIM_H
59 |
60 |
--------------------------------------------------------------------------------
/sim/verilated/memsim.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: memsim.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: This creates a memory like device to act on a WISHBONE bus.
8 | // It doesn't exercise the bus thoroughly, but does give some
9 | // exercise to the bus to see whether or not the bus master can control
10 | // it.
11 | //
12 | // This particular version differs from the memsim version within the
13 | // ZipCPU project in that there is a variable delay from request to
14 | // completion.
15 | //
16 | //
17 | // Creator: Dan Gisselquist, Ph.D.
18 | // Gisselquist Technology, LLC
19 | //
20 | ////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
23 | //
24 | // This program is free software (firmware): you can redistribute it and/or
25 | // modify it under the terms of the GNU General Public License as published
26 | // by the Free Software Foundation, either version 3 of the License, or (at
27 | // your option) any later version.
28 | //
29 | // This program is distributed in the hope that it will be useful, but WITHOUT
30 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
31 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
32 | // for more details.
33 | //
34 | // You should have received a copy of the GNU General Public License along
35 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
36 | // target there if the PDF file isn't present.) If not, see
37 | // for a copy.
38 | //
39 | // License: GPL, v3, as defined and found on www.gnu.org,
40 | // http://www.gnu.org/licenses/gpl.html
41 | //
42 | //
43 | ////////////////////////////////////////////////////////////////////////////////
44 | //
45 | //
46 | #ifndef MEMSIM_H
47 | #define MEMSIM_H
48 |
49 | #include
50 |
51 | class MEMSIM {
52 | public:
53 | typedef unsigned int BUSW;
54 | typedef unsigned char uchar;
55 | static const int NWRDWIDTH;
56 |
57 | BUSW *m_mem, m_len, m_mask, m_head, m_tail, m_delay_mask, m_delay;
58 | int *m_fifo_ack;
59 | BUSW *m_fifo_data;
60 |
61 |
62 | MEMSIM(const unsigned int nwords, const unsigned int delay=27);
63 | ~MEMSIM(void);
64 | void load(const char *fname);
65 | void load(const unsigned int addr, const char *buf,const size_t len);
66 | void apply(const uchar wb_cyc, const uchar wb_stb,
67 | const uchar wb_we,
68 | const BUSW wb_addr, const uint32_t *wb_data,
69 | const short wb_sel,
70 | uchar &o_stall, uchar &o_ack, uint32_t *o_data);
71 | void operator()(const uchar wb_cyc, const uchar wb_stb,
72 | const uchar wb_we,
73 | const BUSW wb_addr, const uint32_t *wb_data,
74 | const short wb_sel,
75 | uchar &o_stall, uchar &o_ack, uint32_t *o_data) {
76 |
77 | apply(wb_cyc, wb_stb, wb_we, wb_addr, wb_data, wb_sel,
78 | o_stall, o_ack, o_data);
79 | }
80 | BUSW &operator[](const BUSW addr) { return m_mem[addr&m_mask]; }
81 | };
82 |
83 | #endif
84 |
--------------------------------------------------------------------------------
/sim/verilated/port.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: port.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Defines the communication parameters necessary for communicating
8 | // with either the device or its simulation.
9 | //
10 | //
11 | // Creator: Dan Gisselquist, Ph.D.
12 | // Gisselquist Technology, LLC
13 | //
14 | ////////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
17 | //
18 | // This program is free software (firmware): you can redistribute it and/or
19 | // modify it under the terms of the GNU General Public License as published
20 | // by the Free Software Foundation, either version 3 of the License, or (at
21 | // your option) any later version.
22 | //
23 | // This program is distributed in the hope that it will be useful, but WITHOUT
24 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | // for more details.
27 | //
28 | // You should have received a copy of the GNU General Public License along
29 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
30 | // target there if the PDF file isn't present.) If not, see
31 | // for a copy.
32 | //
33 | // License: GPL, v3, as defined and found on www.gnu.org,
34 | // http://www.gnu.org/licenses/gpl.html
35 | //
36 | //
37 | ////////////////////////////////////////////////////////////////////////////////
38 | //
39 | //
40 | #ifndef PORT_H
41 | #define PORT_H
42 |
43 | // There are two ways to connect: via a serial port, and via a TCP socket
44 | // connected to a serial port. This way, we can connect the device on one
45 | // computer, test it, and when/if it doesn't work we can replace the device
46 | // with the test-bench. Across the network, no one will know any better that
47 | // anything had changed.
48 | #define FPGAHOST "localhost"
49 | #define FPGATTY "/dev/ttyUSB1"
50 | #define FPGAPORT 6510
51 |
52 | #ifndef FORCE_UART
53 | #define FPGAOPEN(V) V= new FPGA(new NETCOMMS(FPGAHOST, FPGAPORT))
54 | #else
55 | #define FPGAOPEN(V) V= new FPGA(new TTYCOMMS(FPGATTY))
56 | #endif
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/sim/verilated/sdspisim.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: sdspisim.h
4 | //
5 | // Project: Wishbone Controlled SD-Card Controller over SPI port
6 | //
7 | // Purpose: This library simulates the operation of a SPI commanded SD-Card,
8 | // such as might be found on a XuLA2-LX25 board made by xess.com.
9 | //
10 | // This simulator is for testing use in a Verilator/C++ environment, where
11 | // it would be used in place of the actual hardware.
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | #ifndef SDSPISIM_H
43 | #define SDSPISIM_H
44 |
45 | #include
46 |
47 | typedef enum eRESET_STATES {
48 | SDSPI_POWERUP_RESET,
49 | SDSPI_CMD0_IDLE,
50 | SDSPI_RCVD_CMD8,
51 | SDSPI_RCVD_ACMD41,
52 | SDSPI_RESET_COMPLETE,
53 | SDSPI_IN_OPERATION
54 | } RESET_STATES;
55 |
56 | #define SDSPI_RSPLEN 8
57 | #define SDSPI_MAXBLKLEN (1+2048+2)
58 | #define SDSPI_CSDLEN (16)
59 | #define SDSPI_CIDLEN (16)
60 | class SDSPISIM {
61 | FILE *m_dev;
62 | unsigned long m_devblocks;
63 |
64 | int m_last_sck, m_delay, m_mosi;
65 | bool m_busy, m_debug, m_block_address, m_altcmd_flag,
66 | m_syncd, m_host_supports_high_capacity, m_reading_data,
67 | m_have_token;
68 |
69 | RESET_STATES m_reset_state;
70 |
71 | int m_cmdidx, m_bitpos, m_rspidx, m_rspdly, m_blkdly,
72 | m_blklen, m_blkidx, m_last_miso, m_powerup_busy;
73 | unsigned m_rxloc;
74 | char m_cmdbuf[8], m_dat_out, m_dat_in;
75 | char m_rspbuf[SDSPI_RSPLEN];
76 | char m_block_buf[SDSPI_MAXBLKLEN];
77 | uint8_t m_csd[SDSPI_CSDLEN], m_cid[SDSPI_CIDLEN];
78 |
79 | void CID(void);
80 | void CSD(void);
81 | unsigned read_bitfield(int, int, int, const uint8_t *);
82 | public:
83 | SDSPISIM(const bool debug = false);
84 | void load(const char *fname);
85 | void debug(const bool dbg) { m_debug = dbg; }
86 | bool debug(void) const { return m_debug; }
87 | int operator()(const int csn, const int sck, const int dat);
88 | unsigned cmdcrc(int ln, char *buf) const;
89 | bool check_cmdcrc(char *buf) const;
90 | unsigned blockcrc(int ln, char *buf) const;
91 | void add_block_crc(int ln, char *buf) const;
92 |
93 | unsigned OCR(void);
94 | uint8_t CSD(int index);
95 | uint8_t CID(int index);
96 | };
97 |
98 | #endif
99 |
--------------------------------------------------------------------------------
/sim/verilated/vversion.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ################################################################################
3 | ##
4 | ## Filename: vversion.sh
5 | ##
6 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
7 | ##
8 | ## Purpose: To determine whether or not the verilator prefix for internal
9 | ## variables is v__DOT__ or the name of the top level followed by
10 | ## __DOT__. If it is the later, output -DNEW_VERILATOR, else be silent.
11 | ##
12 | ##
13 | ## Creator: Dan Gisselquist, Ph.D.
14 | ## Gisselquist Technology, LLC
15 | ##
16 | ################################################################################
17 | ##
18 | ## Copyright (C) 2017-2020, Gisselquist Technology, LLC
19 | ##
20 | ## This program is free software (firmware): you can redistribute it and/or
21 | ## modify it under the terms of the GNU General Public License as published
22 | ## by the Free Software Foundation, either version 3 of the License, or (at
23 | ## your option) any later version.
24 | ##
25 | ## This program is distributed in the hope that it will be useful, but WITHOUT
26 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | ## for more details.
29 | ##
30 | ## You should have received a copy of the GNU General Public License along
31 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | ## target there if the PDF file isn't present.) If not, see
33 | ## for a copy.
34 | ##
35 | ## License: GPL, v3, as defined and found on www.gnu.org,
36 | ## http://www.gnu.org/licenses/gpl.html
37 | ##
38 | ##
39 | ################################################################################
40 | ##
41 | ##
42 | if [[ -x ${VERILATOR_ROOT}/bin/verilator ]];
43 | then
44 | export VERILATOR=${VERILATOR_ROOT}/bin/verilator
45 | fi
46 | if [[ ! -x ${VERILATOR} ]];
47 | then
48 | export VERILATOR=verilator
49 | fi
50 | if [[ ! -x `which ${VERILATOR}` ]];
51 | then
52 | echo "Verilator not found in environment or in path"
53 | exit -1
54 | fi
55 |
56 | VVERLINE=`${VERILATOR} -V | grep -i ^Verilator`
57 | VVER=`echo ${VVERLINE} | cut -d " " -f 2`
58 | LATER=`echo $VVER \>= 3.9 | bc`
59 | if [[ $LATER > 0 ]];
60 | then
61 | echo "-DNEW_VERILATOR"
62 | else
63 | echo "-DOLD_VERILATOR"
64 | fi
65 | exit 0
66 |
--------------------------------------------------------------------------------
/sim/verilated/zipelf.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: zipelf.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose:
8 | //
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2020, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | #ifndef ZIPELF_H
40 | #define ZIPELF_H
41 |
42 | #include
43 |
44 | class ELFSECTION {
45 | public:
46 | uint32_t m_start, m_len;
47 | char m_data[4];
48 | };
49 |
50 | bool iself(const char *fname);
51 | void elfread(const char *fname, uint32_t &entry, ELFSECTION **§ions);
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/sw/.gitignore:
--------------------------------------------------------------------------------
1 | debug.txt
2 | eqspidump.bin
3 | .*.swp
4 |
--------------------------------------------------------------------------------
/sw/board/.gitignore:
--------------------------------------------------------------------------------
1 | .*.swp
2 | dump.txt
3 | cputest
4 | cputest.map
5 | cputest.txt
6 | cputestcis
7 | cputestcis.map
8 | cputestcis.txt
9 | exstartup
10 | exstartup.map
11 | exstartup.txt
12 | gettysburg
13 | gettysburg.map
14 | gettysburg.txt
15 | simple_ping
16 | simple_ping.map
17 | simple_ping.txt
18 | oledtest
19 | oledtest.map
20 | oledtest.txt
21 | exmulti
22 | emulti.map
23 | emulti.txt
24 | gpsdump
25 | gpsdump.map
26 | gpsdump.txt
27 | hello
28 | hello.txt
29 | map.txt
30 |
--------------------------------------------------------------------------------
/sw/board/arp.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: arp.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To encapsulate common functions associated with the ARP protocol
8 | // and hardware (ethernet MAC) address resolution.
9 | //
10 | //
11 | // Creator: Dan Gisselquist, Ph.D.
12 | // Gisselquist Technology, LLC
13 | //
14 | ////////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 | //
18 | // This program is free software (firmware): you can redistribute it and/or
19 | // modify it under the terms of the GNU General Public License as published
20 | // by the Free Software Foundation, either version 3 of the License, or (at
21 | // your option) any later version.
22 | //
23 | // This program is distributed in the hope that it will be useful, but WITHOUT
24 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | // for more details.
27 | //
28 | // You should have received a copy of the GNU General Public License along
29 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
30 | // target there if the PDF file isn't present.) If not, see
31 | // for a copy.
32 | //
33 | // License: GPL, v3, as defined and found on www.gnu.org,
34 | // http://www.gnu.org/licenses/gpl.html
35 | //
36 | //
37 | ////////////////////////////////////////////////////////////////////////////////
38 | //
39 | //
40 | #ifndef ARP_H
41 | #define ARP_H
42 |
43 | extern void init_arp_table(void);
44 | extern int arp_lookup(unsigned ipaddr, unsigned long *mac);
45 | extern void arp_table_add(unsigned ipaddr, unsigned long mac);
46 | extern void send_arp_reply(unsigned machi, unsigned maclo, unsigned ipaddr);
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/sw/board/arty.ld:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | *
3 | * Filename: ./board.ld
4 | *
5 | * Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | *
7 | * DO NOT EDIT THIS FILE!
8 | * Computer Generated: This file is computer generated by AUTOFPGA. DO NOT EDIT.
9 | * DO NOT EDIT THIS FILE!
10 | *
11 | * CmdLine: autofpga autofpga -d -o . global.txt bkram.txt buserr.txt dlyarbiter.txt clock.txt gpio.txt spio.txt icape.txt mdio.txt gps.txt eqspi.txt pic.txt pwrcount.txt rtcdate.txt rtcgps.txt clrspio.txt version.txt wbuconsole.txt zipmaster.txt sdspi.txt
12 | *
13 | * Creator: Dan Gisselquist, Ph.D.
14 | * Gisselquist Technology, LLC
15 | *
16 | /*******************************************************************************
17 | *
18 | * Copyright (C) 2017-2018, Gisselquist Technology, LLC
19 | *
20 | * This program is free software (firmware): you can redistribute it and/or
21 | * modify it under the terms of the GNU General Public License as published
22 | * by the Free Software Foundation, either version 3 of the License, or (at
23 | * your option) any later version.
24 | *
25 | * This program is distributed in the hope that it will be useful, but WITHOUT
26 | * ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | * for more details.
29 | *
30 | * You should have received a copy of the GNU General Public License along
31 | * with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | * target there if the PDF file isn't present.) If not, see
33 | * for a copy.
34 | *
35 | * License: GPL, v3, as defined and found on www.gnu.org,
36 | * http://www.gnu.org/licenses/gpl.html
37 | *
38 | *
39 | /*******************************************************************************
40 | *
41 | *
42 | */
43 | ENTRY(_start)
44 |
45 | MEMORY
46 | {
47 | /* To be listed here, a slave must be of type MEMORY. If the slave
48 | * has a defined name in its @LD.NAME tag, it will be listed here
49 | * under that name. The permissions are given by the @LD.PERM tag.
50 | * If no permission tag exists, a permission of 'r' will be assumed.
51 | */
52 | bkram(wx) : ORIGIN = 0x00a00000, LENGTH = 0x00100000
53 | flash(rx) : ORIGIN = 0x01000000, LENGTH = 0x01000000
54 | }
55 |
56 | /* For each defined memory peripheral, we also define a pointer to that
57 | * memory. The name of this pointer is given by the @LD.NAME tag within
58 | * the memory peripheral's configuration
59 | */
60 | _bkram = ORIGIN(bkram);
61 | _flash = ORIGIN(flash);
62 | _top_of_stack = ORIGIN(bkram) + LENGTH(bkram) - 4;
63 | /* _rom = ORIGIN(flash); */
64 | _rom = 0;
65 | /* _kram = ORIGIN(bkram); */
66 | _ram = ORIGIN(bkram);
67 | SECTIONS
68 | {
69 | .rocode 0x01400000 : ALIGN(4) {
70 | _boot_address = .;
71 | *(.start) *(.boot)
72 | } > bkram
73 | _kram_start = . ;
74 | _kram_end = . ;
75 | _ram_image_start = . ;
76 | .kernel : ALIGN_WITH_INPUT {
77 | *(.kernel)
78 | *(.text.startup)
79 | *(.text*)
80 | *(.rodata*) *(.strings)
81 | *(.data) *(COMMON)
82 | }> bkram
83 | _ram_image_end = . ;
84 | .bss : ALIGN_WITH_INPUT {
85 | *(.bss)
86 | _bss_image_end = . ;
87 | } > bkram
88 | _top_of_heap = .;
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/sw/board/artyram.ld:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | *
3 | * Filename: arty.ld
4 | *
5 | * Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | *
7 | * Purpose: This script provides a description of the memory on the Arty,
8 | * for the purposes of where to place programs in memory during
9 | * linking.
10 | *
11 | * Creator: Dan Gisselquist, Ph.D.
12 | * Gisselquist Technology, LLC
13 | *
14 | ********************************************************************************
15 | *
16 | * Copyright (C) 2016-2017, Gisselquist Technology, LLC
17 | *
18 | * This program is free software (firmware): you can redistribute it and/or
19 | * modify it under the terms of the GNU General Public License as published
20 | * by the Free Software Foundation, either version 3 of the License, or (at
21 | * your option) any later version.
22 | *
23 | * This program is distributed in the hope that it will be useful, but WITHOUT
24 | * ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | * for more details.
27 | *
28 | * License: GPL, v3, as defined and found on www.gnu.org,
29 | * http://www.gnu.org/licenses/gpl.html
30 | *
31 | *
32 | *******************************************************************************/
33 |
34 | ENTRY(_start)
35 |
36 | MEMORY
37 | {
38 | blkram (wx) : ORIGIN = 0x00020000, LENGTH = 0x00020000
39 | flash (rx) : ORIGIN = 0x01000000, LENGTH = 0x01000000
40 | sdram (wx) : ORIGIN = 0x10000000, LENGTH = 0x10000000
41 | }
42 |
43 | _flash = ORIGIN(flash);
44 | _blkram = ORIGIN(blkram);
45 | _sdram = ORIGIN(sdram);
46 | _top_of_stack = ORIGIN(blkram) + LENGTH(blkram) - 4;
47 |
48 | SECTIONS
49 | {
50 | .rocode ORIGIN(blkram) : {
51 | _boot_address = .;
52 | *(.start) *(.boot)
53 | _kernel_image_start = . ;
54 | *(.kernel)
55 | *(.text.startup)
56 | *(.text*)
57 | *(.rodata*) *(.strings)
58 | *(.data) *(COMMON) *(.bss)
59 | }> blkram
60 | _sdram_image_start = . ;
61 | _sdram_image_end = . ;
62 | .bss : {
63 | *(.bss)
64 | _bss_image_end = . ;
65 | } > blkram
66 | _top_of_heap = .;
67 | }
68 |
--------------------------------------------------------------------------------
/sw/board/gettysburg.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: gettysburg.c
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: The classical "Hello, world!\r\n" program. This one, however,
8 | // runs on the Arty using the PModUSBUART
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | #include
40 | #include
41 |
42 | const char address[] =
43 | "\r\n"
44 | "Gettysburg Address\r\n"
45 | "----------------------\r\n\r\n"
46 | "Four score and seven years ago our fathers brought forth on this continent, "
47 | "a\r\nnew nation, conceived in Liberty, and dedicated to the proposition that "
48 | "all men\r\nare created equal.\r\n"
49 | "\r\n"
50 | "Now we are engaged in a great civil war, testing whether that nation, or "
51 | "any\r\nnation so conceived and so dedicated, can long endure. We are met on a "
52 | "great\r\nbattle-field of that war. We have come to dedicate a portion of that "
53 | "field, as\r\na final resting place for those who here gave their lives that "
54 | "that nation\r\nmight live. It is altogether fitting and proper that we should "
55 | "do this.\r\n"
56 | "\r\n"
57 | "But, in a larger sense, we can not dedicate-we can not consecrate-we can "
58 | "not\r\nhallow-this ground. The brave men, living and dead, who struggled "
59 | "here, have\r\nconsecrated it, far above our poor power to add or detract. "
60 | "The world will\r\nlittle note, nor long remember what we say here, but it "
61 | "can never forget what\r\nthey did here. It is for us the living, rather, "
62 | "to be dedicated here to the\r\nunfinished work which they who fought "
63 | "here have thus far so nobly advanced. It\r\nis rather for us to be here "
64 | "dedicated to the great task remaining before\r\nus-that from these honored "
65 | "dead we take increased devotion to that cause for\r\nwhich they gave "
66 | "the last full measure of devotion-that we here highly resolve\r\nthat "
67 | "these dead shall not have died in vain-that this nation, under God, "
68 | "shall\r\nhave a new birth of freedom-and that government of the people, "
69 | "by the people,\r\nfor the people, shall not perish from the earth.\r\n\r\n\r\n";
70 |
71 |
72 | int main(int argc, char **argv) {
73 | // Print the Gettysburg address out the UART!
74 | write(STDOUT_FILENO, address, sizeof(address));
75 | return 0;
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/sw/board/gpsdump.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: gpsdump.c
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To dump the GPS UART to the auxiliary UART.
8 | //
9 | // Creator: Dan Gisselquist, Ph.D.
10 | // Gisselquist Technology, LLC
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
15 | //
16 | // This program is free software (firmware): you can redistribute it and/or
17 | // modify it under the terms of the GNU General Public License as published
18 | // by the Free Software Foundation, either version 3 of the License, or (at
19 | // your option) any later version.
20 | //
21 | // This program is distributed in the hope that it will be useful, but WITHOUT
22 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | // for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License along
27 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
28 | // target there if the PDF file isn't present.) If not, see
29 | // for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | #include "board.h"
39 | #include "zipcpu.h"
40 | #include "zipsys.h"
41 |
42 | #ifdef GPSUART_ACCESS
43 | void main(int argc, char **argv) {
44 | /*
45 | // Method one: direct polling
46 | while(1) {
47 | int ch;
48 | ch = sys->io_gps_rx;
49 | if ((ch&UART_RX_ERR)==0)
50 | sys->io_uart_tx = ch;
51 | }
52 | */
53 |
54 | // Method two: Waiting on interrupts
55 | int lglen = (1<<((_gpsu->u_fifo >> 12)&0x0f))-1;
56 | _zip->z_pic = SYSINT_GPSRXF;
57 | while(1) {
58 | while((_zip->z_pic & SYSINT_GPSRXF)==0)
59 | ;
60 | for(int i=0; iu_tx = _gpsu->u_rx & 0x0ff;
62 | _zip->z_pic = SYSINT_GPSRXF;
63 | }
64 |
65 | /*
66 | // Method three: Use the DMA
67 | _zip->z_dma.d_ctrl = DMACLEAR;
68 | while(1) {
69 | _zip->z_dma.d_rd = (int *)&sys->io_gps_rx;
70 | _zip->z_dma.d_wr = (int *)&sys->io_uart_tx;
71 | _zip->z_dma.d_len = 0x01000000; // More than we'll ever do ...
72 | _zip->z_dma.d_ctrl = (DMAONEATATIME|DMA_CONSTDST|DMA_CONSTSRC|DMA_ONGPSRX);
73 |
74 | while(_zip->z_dma.d_ctrl & DMA_BUSY) {
75 | zip_idle();
76 | if (_zip->z_dma.d_ctrl & DMA_ERR)
77 | zip_halt();
78 | }
79 | }
80 | */
81 | }
82 | #else
83 | #include
84 |
85 | int main(int argc, char **argv) {
86 | printf("This design requires the GPS UART to be installed\n");
87 | }
88 | #endif
89 |
--------------------------------------------------------------------------------
/sw/board/hello.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: hello.c
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: The original Helllo World program. If everything works, this
8 | // will print Hello World to the UART, and then halt the CPU--if
9 | // run with no O/S.
10 | //
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Gisselquist Technology asserts no ownership rights over this particular
15 | // hello world program.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////////
18 | //
19 | //
20 | #include
21 |
22 | int main(int argc, char **argv) {
23 | printf("Hello, World!\r\n");
24 | return 0;
25 | }
26 |
--------------------------------------------------------------------------------
/sw/board/ipcksum.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: ipsum.c
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To calculate (and return) an IP checksum on a section of data.
8 | // The data must be contiguous in memory, and the checksum field
9 | // (which is usually a part of it) must be blank when calling this
10 | // function.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #include "zipcpu.h"
42 | #include "ipcksum.h"
43 |
44 | #define ASM
45 | unsigned ipcksum(int len, unsigned *ptr) {
46 | #ifndef ASM
47 | unsigned checksum = 0;
48 |
49 | for(int i=0; i> 16);
51 | while(checksum & ~0x0ffff)
52 | checksum = (checksum & 0x0ffff) + (checksum >> 16);
53 | return checksum ^ 0x0ffff;
54 | #else
55 | asm(ASMFNSTR("ipcksum") // R1 = length (W), R2 = packet pointer
56 | "\tMOV R1,R3\n" // R3 is now the remaining length
57 | "\tCLR R1\n" // R1 will be our checksum accumulator
58 | ".Lloop:\n"
59 | "\tLW (R2),R4\n"
60 | "\tADD R4,R1\n"
61 | "\tADD.C 1,R1\n"
62 | "\tADD 4,R2\n"
63 | "\tSUB 1,R3\n"
64 | "\tBZ .Lexit\n"
65 | "\tBRA .Lloop\n"
66 | ".Lexit:\n"
67 | "\tMOV R1,R3\n"
68 | "\tAND 0x0ffff,R1\n"
69 | "\tLSR 16,R3\n"
70 | "\tADD R3,R1\n"
71 | "\tTEST 0xffff0000,R1\n" // The carry bit can only and will only
72 | "\tADD.NZ 1,R1\n" // ever be a one here. Add it in.
73 | "\tAND 0x0ffff,R1\n"
74 | "\tXOR 0x0ffff,R1\n"
75 | "\tRETN");
76 | #endif
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/sw/board/ipcksum.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: ipcksum.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To calculate (and return) an IP checksum on a section of data.
8 | // The data must be contiguous in memory, and the checksum field
9 | // (which is usually a part of it) must be blank when calling this
10 | // function.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #ifndef IPCKSUM_H
42 | #define IPCKSUM_H
43 |
44 | extern unsigned ipcksum(int len, unsigned *ptr);
45 |
46 | #endif
47 |
48 |
--------------------------------------------------------------------------------
/sw/board/ledcolors.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: ledcolors.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Just to provide some simple color constants that can be used
8 | // to drive the color LEDs present on the Arty.
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | #ifndef LEDCOLORS_H
40 | #define LEDCOLORS_H
41 |
42 | #define LEDC_BRIGHTRED 0x0ff0000
43 | #define LEDC_BRIGHTGREEN 0x000ff00
44 | #define LEDC_BRIGHTBLUE 0x00000ff
45 |
46 | #define LEDC_RED 0x0070000
47 | #define LEDC_GREEN 0x0000700
48 | #define LEDC_BLUE 0x0000007
49 | #define LEDC_YELLOW 0x0070700
50 |
51 | #define LEDC_WHITE 0x0070707
52 | #define LEDC_OFF 0
53 |
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/sw/board/protoconst.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: protoconst.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: To define, for our own distribution and use (prior to having any
8 | // useful /usr/include files for the ZipCPU), network number
9 | // definitions so that they can be used within our demonstration programs.
10 | //
11 | //
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2019, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory, run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | #ifndef PROTOCONST_H
43 | #define PROTOCONST_H
44 |
45 | //
46 | // These constants were drawn from /usr/include/net/ethernet.h
47 | //
48 | #define ETHERTYPE_IP 0x0800
49 | #define ETHERTYPE_ARP 0x0806
50 | #define ETHERTYPE_IPV6 0x86dd
51 | #define ETHERTYPE_LOOPBACK 0x9000
52 |
53 | //
54 | // These constants were drawn from /usr/include/netinet/in.h
55 | // They can also be found in /usr/include/linux/in.h
56 | //
57 | #define IPPROTO_IP 0
58 | #define IPPROTO_ICMP 1
59 | #define IPPROTO_UDP 17
60 | #define IPPROTO_TCP 6
61 |
62 | //
63 | // These constants were drawn from /usr/include/netinet/ip_icmp.h
64 | // They may also be found in /usr/include/linux/icmp.h
65 | //
66 | #define ICMP_ECHOREPLY 0
67 | #define ICMP_ECHO 8
68 |
69 | // This number is used in a *very* rudimentary pseudo-random number generation
70 | // algorithm. THE ALGORITHM IS NOT CRYPTOGRAPHICALLY SECURE! This means that
71 | // any network protocol using this number can easily be hacked by anyone looking
72 | // hard enough into it. For now, we use it just to get ourselves off the
73 | // ground, hoping to come back to it later to make it more secure.
74 | #define BIG_PRIME 0x0134513b
75 |
76 | #endif // PROTOCONST_H
77 |
78 |
--------------------------------------------------------------------------------
/sw/board/txfns.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: txfns.h
4 | //
5 | // Project: VideoZip, a ZipCPU SoC supporting video functionality
6 | //
7 | // Purpose: These are some *very* simple UART routines, designed to support
8 | // a program before the C-library is up and running. Once the
9 | // C-library is running on a device, it is anticipated that these routines
10 | // will no longer be needed or used--since they access the raw hardware
11 | // device(s).
12 | //
13 | // Creator: Dan Gisselquist, Ph.D.
14 | // Gisselquist Technology, LLC
15 | //
16 | ////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
19 | //
20 | // This program is free software (firmware): you can redistribute it and/or
21 | // modify it under the terms of the GNU General Public License as published
22 | // by the Free Software Foundation, either version 3 of the License, or (at
23 | // your option) any later version.
24 | //
25 | // This program is distributed in the hope that it will be useful, but WITHOUT
26 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 | // for more details.
29 | //
30 | // You should have received a copy of the GNU General Public License along
31 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
32 | // target there if the PDF file isn't present.) If not, see
33 | // for a copy.
34 | //
35 | // License: GPL, v3, as defined and found on www.gnu.org,
36 | // http://www.gnu.org/licenses/gpl.html
37 | //
38 | //
39 | ////////////////////////////////////////////////////////////////////////////////
40 | //
41 | //
42 | #ifndef TXFNS_H
43 | #define TXFNS_H
44 |
45 | #include "board.h"
46 |
47 | extern void txchr(char ch);
48 | extern void txstr(const char *str);
49 | extern void txhex(unsigned val);
50 | extern void txdecimal(int val);
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/sw/board/zipcpu.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: zipsystem.c
4 | //
5 | // Project: Zip CPU -- a small, lightweight, RISC CPU soft core
6 | //
7 | // Purpose: Implements some ZipCPU specific functions. Specifically, these
8 | // are the system call trap (which just switches to supervisor
9 | // mode), and the two context switching functions.
10 | //
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // License: GPL, v3, as defined and found on www.gnu.org,
30 | // http://www.gnu.org/licenses/gpl.html
31 | //
32 | //
33 | ////////////////////////////////////////////////////////////////////////////////
34 | //
35 | //
36 | #include "zipcpu.h"
37 |
38 | // Implement a save_context function. This really boils into a long series of
39 | // instructions within the compiler. For this reason, it makes more sense
40 | // for it to be a function call rather than an inline function--although
41 | // zip_save_context could be either. Of course, the difficult part of placing
42 | // it in line is that the CPU may not realize the context changes between one
43 | // invocation of save_context and the corresponding restore_context function...
44 | void save_context(int *c) {
45 | zip_save_context(c);
46 | }
47 |
48 | void restore_context(int *c) {
49 | zip_restore_context(c);
50 | }
51 |
52 | #ifdef C_SYSCALL
53 | /* While the following system call *should* be identical to the assembly
54 | * equivalent beneath it, the dependency is actually dependent upon any
55 | * optimizations within the compiler. If the compiler is not optimized,
56 | * then it may try to create a stack frame, store id, a, b, and c, on the
57 | * stack frame, call the system call, clear the stack frame and return.
58 | *
59 | * The problem with this is that system traps may believe that they can replace
60 | * the system call with a goto. In that case, there is no knowledge of the
61 | * stack frame that needs to be unwound. Hence, we need to make certain that
62 | * the system call does not create a stack frame, and thus use the assembly
63 | * form beneath here.
64 | */
65 | int syscall(const int id, const int a, const int b, const int c) {
66 | zip_syscall();
67 | }
68 | #else
69 | /* By making this into an assembly language equivalent, we can be specific about
70 | * what we are expecting. That way the kernel can just set the PC address and
71 | * the system call may believe that it was called like any ordinary subroutine.
72 | */
73 | asm(ASMFNSTR("syscall")
74 | "\tCLR\tCC\n"
75 | "\tRETN\n"
76 | );
77 | #endif
78 |
79 |
80 |
--------------------------------------------------------------------------------
/sw/host/.gitignore:
--------------------------------------------------------------------------------
1 | capgps
2 | cfgscope
3 | cpuscope
4 | crctest
5 | dbg.txt
6 | dbg2.txt
7 | *.64t
8 | dcachescope
9 | debug.txt
10 | divutb
11 | dumpflash
12 | eqspiscope
13 | flashscope
14 | flashid
15 | eqspidump-original.bin
16 | eqspidump.bin
17 | erxscope
18 | etxscope
19 | genoimage
20 | genoimage.cpp
21 | gpscoeffs
22 | gpsscope
23 | gps/*
24 | manping
25 | mdioscope
26 | mtee.txt
27 | mtest
28 | netsetup
29 | netuart
30 | oled_splash.c
31 | oled_splash.png
32 | oled_splash_jr.png
33 | scopout
34 | scopout.txt
35 | scopout2.txt
36 | sdramscope
37 | tags
38 | tstgps
39 | wbprogram
40 | wbregs
41 | wbsettime
42 | wbuscope
43 | zipdbg
44 | zipload
45 | zipstate
46 | obj-pc/*
47 | .*.swp
48 |
--------------------------------------------------------------------------------
/sw/host/byteswap.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: byteswap.cpp
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose:
8 | //
9 | // Creator: Dan Gisselquist, Ph.D.
10 | // Gisselquist Technology, LLC
11 | //
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
15 | //
16 | // This program is free software (firmware): you can redistribute it and/or
17 | // modify it under the terms of the GNU General Public License as published
18 | // by the Free Software Foundation, either version 3 of the License, or (at
19 | // your option) any later version.
20 | //
21 | // This program is distributed in the hope that it will be useful, but WITHOUT
22 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 | // for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License along
27 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
28 | // target there if the PDF file isn't present.) If not, see
29 | // for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | #include
39 | #include "byteswap.h"
40 |
41 | uint32_t
42 | byteswap(uint32_t v) {
43 | uint32_t r = 0;
44 |
45 | r = (v & 0x0ff);
46 | r <<= 8; v >>= 8;
47 | r |= (v & 0x0ff);
48 | r <<= 8; v >>= 8;
49 | r |= (v & 0x0ff);
50 | r <<= 8; v >>= 8;
51 | r |= (v & 0x0ff);
52 |
53 | return r;
54 | }
55 |
56 | uint32_t
57 | buildword(const unsigned char *p) {
58 | uint32_t r = 0;
59 |
60 | r = (*p++); r <<= 8;
61 | r |= (*p++); r <<= 8;
62 | r |= (*p++); r <<= 8;
63 | r |= (*p );
64 |
65 | return r;
66 | }
67 |
68 | uint32_t
69 | buildswap(const unsigned char *p) {
70 | uint32_t r = 0;
71 |
72 | r = p[3]; r <<= 8;
73 | r |= p[2]; r <<= 8;
74 | r |= p[1]; r <<= 8;
75 | r |= p[0];
76 |
77 | return r;
78 | }
79 |
80 | void
81 | byteswapbuf(int ln, uint32_t *buf) {
82 | for(int i=0; i for a copy.
30 | //
31 | // License: GPL, v3, as defined and found on www.gnu.org,
32 | // http://www.gnu.org/licenses/gpl.html
33 | //
34 | //
35 | ////////////////////////////////////////////////////////////////////////////////
36 | //
37 | //
38 | #ifndef BYTESWAP_H
39 | #define BYTESWAP_H
40 |
41 | #include
42 |
43 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
44 | extern uint32_t byteswap(uint32_t v);
45 | extern void byteswapbuf(int ln, uint32_t *buf);
46 | #else
47 | #define byteswap(A) (A)
48 | #define byteswapbuf(A, B)
49 | #endif
50 |
51 | extern uint32_t buildword(const unsigned char *p);
52 | extern uint32_t buildswap(const unsigned char *p);
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/sw/host/crctest.cpp:
--------------------------------------------------------------------------------
1 | //
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | unsigned calccrc(const int bytelen, const unsigned *buf) {
12 | const unsigned int taps = 0xedb88320u;
13 | #ifdef DONT_INVERT
14 | unsigned int crc = 0;
15 | #else
16 | unsigned int crc = 0xffffffff; // initial value
17 | #endif
18 | int bidx;
19 | int bp = 0;
20 |
21 | for(bidx = 0; bidx>2)]>>(24-((bidx&3)<<3));
23 |
24 | // printf("CRC[%2d]: %02x ([%2d]0x%08x)\n", bidx, byte, (bidx>>2), buf[(bidx>>2)]);
25 |
26 | for(int bit=8; --bit>= 0; byte >>= 1) {
27 | if ((crc ^ byte) & 1) {
28 | crc >>= 1;
29 | crc ^= taps;
30 | } else
31 | crc >>= 1;
32 | } bp++;
33 | }
34 | #ifndef DONT_INVERT
35 | crc ^= 0xffffffff;
36 | #endif
37 | // Now, we need to reverse these bytes
38 | // ABCD
39 | unsigned a,b,c,d;
40 | a = (crc>>24); // &0x0ff;
41 | b = (crc>>16)&0x0ff;
42 | c = (crc>> 8)&0x0ff;
43 | d = crc; // (crc )&0x0ff;
44 | crc = (d<<24)|(c<<16)|(b<<8)|a;
45 |
46 | // printf("%d bytes processed\n", bp);
47 | return crc;
48 | }
49 |
50 | int main(int argc, char **argv) {
51 | unsigned packet[32];
52 |
53 | for(int i=0; i<32; i++)
54 | packet[i] = 0;
55 | packet[ 0] = 0x000ae6f0;
56 | packet[ 1] = 0x05a30012;
57 | packet[ 2] = 0x34567890;
58 | packet[ 3] = 0x08004500;
59 | packet[ 4] = 0x0030b3fe;
60 | packet[ 5] = 0x00008011;
61 | packet[ 6] = 0x72ba0a00;
62 | packet[ 7] = 0x00030a00;
63 | packet[ 8] = 0x00020400;
64 | packet[ 9] = 0x0400001c;
65 | packet[10] = 0x894d0001;
66 | packet[11] = 0x02030405;
67 | packet[12] = 0x06070809;
68 | packet[13] = 0x0a0b0c0d;
69 | packet[14] = 0x0e0f1011;
70 | packet[15] = 0x12130000;
71 |
72 | packet[16] = calccrc(15*4+2, packet);
73 |
74 | for(int i=0; i<16; i++)
75 | printf("PKT[%3d] = 0x%08x\n", i, packet[i]);
76 | printf("PKT[CRC] = 0x%08x\n", packet[16]);
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/sw/host/flashdrvr.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: flashdrvr.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Flash driver. Encapsulates writing, both erasing sectors and
8 | // the programming pages, to the flash device.
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | //
40 | #ifndef FLASHDRVR_H
41 | #define FLASHDRVR_H
42 |
43 | #include "regdefs.h"
44 |
45 | class FLASHDRVR {
46 | private:
47 | DEVBUS *m_fpga;
48 | bool m_debug;
49 | unsigned m_id; // ID of the flash device
50 |
51 | //
52 | void take_offline(void);
53 | void place_online(void);
54 | void restore_dualio(void);
55 | void restore_quadio(void);
56 | static void restore_dualio(DEVBUS *fpga);
57 | static void restore_quadio(DEVBUS *fpga);
58 | //
59 | bool verify_config(void);
60 | void set_config(void);
61 | void flwait(void);
62 | public:
63 | FLASHDRVR(DEVBUS *fpga);
64 | bool erase_sector(const unsigned sector, const bool verify_erase=true);
65 | bool page_program(const unsigned addr, const unsigned len,
66 | const char *data, const bool verify_write=true);
67 | bool write(const unsigned addr, const unsigned len,
68 | const char *data, const bool verify=false);
69 |
70 | unsigned flashid(void);
71 |
72 | static void take_offline(DEVBUS *fpga);
73 | static void place_online(DEVBUS *fpga);
74 | };
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/sw/host/flashid.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: flashid.cpp
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Reads the ID from the flash, and verifies that the flash can
8 | // be put back into QSPI mode after reading the ID.
9 | //
10 | //
11 | // Creator: Dan Gisselquist, Ph.D.
12 | // Gisselquist Technology, LLC
13 | //
14 | ////////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 | //
18 | // This program is free software (firmware): you can redistribute it and/or
19 | // modify it under the terms of the GNU General Public License as published
20 | // by the Free Software Foundation, either version 3 of the License, or (at
21 | // your option) any later version.
22 | //
23 | // This program is distributed in the hope that it will be useful, but WITHOUT
24 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | // for more details.
27 | //
28 | // You should have received a copy of the GNU General Public License along
29 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
30 | // target there if the PDF file isn't present.) If not, see
31 | // for a copy.
32 | //
33 | // License: GPL, v3, as defined and found on www.gnu.org,
34 | // http://www.gnu.org/licenses/gpl.html
35 | //
36 | //
37 | ////////////////////////////////////////////////////////////////////////////////
38 | //
39 | //
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 |
49 | #include "port.h"
50 | #include "regdefs.h"
51 | #include "ttybus.h"
52 | #include "flashdrvr.h"
53 |
54 | FPGA *m_fpga;
55 | void closeup(int v) {
56 | m_fpga->kill();
57 | exit(0);
58 | }
59 |
60 | void usage(void) {
61 | printf("USAGE: flashid\n"
62 | "\n"
63 | "\tflashid reads the ID from the flash, and then attempts to place the\n"
64 | "\tflash back into QSPI mode, followed by reading several values from it\n"
65 | "\tin order to demonstrate that it was truly returned to QSPI mode\n");
66 | }
67 |
68 | int main(int argc, char **argv) {
69 | #ifndef R_FLASH
70 | printf(
71 | "The \"flashid\" program depends upon a flash being built into the design.\n"
72 | "This needs to be done via AutoFPGA. When this program was built, there was\n"
73 | "no flash device built into the design. Please adjust your project settings,\n"
74 | "and particularly the devices contained within it, before coming back and\n"
75 | "trying to use this program.\n");
76 | #else
77 | FLASHDRVR *m_flash;
78 | FPGAOPEN(m_fpga);
79 |
80 | m_flash = new FLASHDRVR(m_fpga);
81 | printf("Flash device ID: 0x%08x\n", m_flash->flashid());
82 | printf("First several words:\n");
83 | for(int k=0; k<12; k++)
84 | printf("\t0x%08x\n", m_fpga->readio(R_FLASH+(k<<2)));
85 |
86 | #ifdef RESET_ADDRESS
87 | printf("From the RESET_ADDRESS:\n");
88 | for(int k=0; k<5; k++) {
89 | printf("%08x: ", RESET_ADDRESS + (k<<2)); fflush(stdout);
90 | printf("\t0x%08x\n", m_fpga->readio(RESET_ADDRESS+(k<<2)));
91 | fflush(stdout);
92 | }
93 | #endif
94 |
95 | delete m_flash;
96 | delete m_fpga;
97 | #endif
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/sw/host/llcomms.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: llcomms.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: This is the C++ program on the command side that will interact
8 | // with a UART on an FPGA, both sending and receiving characters.
9 | // Any bus interaction will call routines from this lower level library to
10 | // accomplish the actual connection to and transmission to/from the board.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #ifndef LLCOMMS_H
42 | #define LLCOMMS_H
43 |
44 | class LLCOMMSI {
45 | protected:
46 | int m_fdw, m_fdr;
47 | LLCOMMSI(void);
48 | public:
49 | unsigned long m_total_nread, m_total_nwrit;
50 |
51 | virtual ~LLCOMMSI(void) { close(); }
52 | virtual void kill(void) { this->close(); };
53 | virtual void close(void);
54 | virtual void write(char *buf, int len);
55 | virtual int read(char *buf, int len);
56 | virtual bool poll(unsigned ms);
57 |
58 | // Tests whether or not bytes are available to be read, returns a
59 | // count of the bytes that may be immediately read
60 | virtual int available(void); // { return 0; };
61 | };
62 |
63 | class TTYCOMMS : public LLCOMMSI {
64 | public:
65 | TTYCOMMS(const char *dev);
66 | };
67 |
68 | class NETCOMMS : public LLCOMMSI {
69 | public:
70 | NETCOMMS(const char *dev, const int port);
71 | virtual void close(void);
72 | };
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/sw/host/port.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: port.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Defines the communication parameters necessary for communicating
8 | // with either the device or its simulation.
9 | //
10 | //
11 | // Creator: Dan Gisselquist, Ph.D.
12 | // Gisselquist Technology, LLC
13 | //
14 | ////////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 | //
18 | // This program is free software (firmware): you can redistribute it and/or
19 | // modify it under the terms of the GNU General Public License as published
20 | // by the Free Software Foundation, either version 3 of the License, or (at
21 | // your option) any later version.
22 | //
23 | // This program is distributed in the hope that it will be useful, but WITHOUT
24 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | // for more details.
27 | //
28 | // You should have received a copy of the GNU General Public License along
29 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
30 | // target there if the PDF file isn't present.) If not, see
31 | // for a copy.
32 | //
33 | // License: GPL, v3, as defined and found on www.gnu.org,
34 | // http://www.gnu.org/licenses/gpl.html
35 | //
36 | //
37 | ////////////////////////////////////////////////////////////////////////////////
38 | //
39 | //
40 | #ifndef PORT_H
41 | #define PORT_H
42 |
43 | // There are two ways to connect: via a serial port, and via a TCP socket
44 | // connected to a serial port. This way, we can connect the device on one
45 | // computer, test it, and when/if it doesn't work we can replace the device
46 | // with the test-bench. Across the network, no one will know any better that
47 | // anything had changed.
48 | #define FPGAHOST "jericho"
49 | #define FPGATTY "/dev/ttyUSB1"
50 | #define FPGAPORT 6510
51 |
52 | #ifndef FORCE_UART
53 | #define FPGAOPEN(V) V= new FPGA(new NETCOMMS(FPGAHOST, FPGAPORT))
54 | #else
55 | #define FPGAOPEN(V) V= new FPGA(new TTYCOMMS(FPGATTY))
56 | #endif
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/sw/host/program.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ################################################################################
3 | ##
4 | ## Filename: program.sh
5 | ##
6 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
7 | ##
8 | ## Purpose: To install a new program into the Arty, using the alternate
9 | ## programming slot (slot 1, starting at 0x470000).
10 | ##
11 | ## Creator: Dan Gisselquist, Ph.D.
12 | ## Gisselquist Technology, LLC
13 | ##
14 | ################################################################################
15 | ##
16 | ## Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 | ##
18 | ## This program is free software (firmware): you can redistribute it and/or
19 | ## modify it under the terms of the GNU General Public License as published
20 | ## by the Free Software Foundation, either version 3 of the License, or (at
21 | ## your option) any later version.
22 | ##
23 | ## This program is distributed in the hope that it will be useful, but WITHOUT
24 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | ## for more details.
27 | ##
28 | ## You should have received a copy of the GNU General Public License along
29 | ## with this program. (It's in the $(ROOT)/doc directory, run make with no
30 | ## target there if the PDF file isn't present.) If not, see
31 | ## for a copy.
32 | ##
33 | ## License: GPL, v3, as defined and found on www.gnu.org,
34 | ## http://www.gnu.org/licenses/gpl.html
35 | ##
36 | ##
37 | ################################################################################
38 | ##
39 | ##
40 | export PATH=$PATH:.
41 | export BINFILE=../../xilinx/openarty.runs/impl_1/toplevel.bit
42 |
43 | WBREGS=wbregs
44 | WBPROG=wbprogram
45 |
46 | RED=0x000f0000
47 | GREEN=0x0000ff00
48 | YELLOW=0x00170700
49 | WHITE=0x000f0f0f
50 | BLACK=0x00000000
51 | DIMGREEN=0x00001f00
52 |
53 | $WBREGS led 0x0ff
54 | $WBREGS clrled0 $YELLOW
55 | $WBREGS clrled1 $YELLOW
56 | $WBREGS clrled2 $YELLOW
57 | $WBREGS clrled3 $YELLOW
58 |
59 | #
60 | # $WBREGS qspiv 0x8b # Accomplished by the flash driver
61 | #
62 | $WBREGS stopwatch 2 # Clear and stop the stopwatch
63 | $WBREGS stopwatch 1 # Start the stopwatch
64 | $WBPROG @0x011c0000 $BINFILE
65 | $WBREGS stopwatch 0 # Stop the stopwatch, we are done
66 | $WBREGS stopwatch # Print out the time on the stopwatch
67 |
68 | $WBREGS led 0x0f0
69 | $WBREGS clrled0 $DIMGREEN
70 | $WBREGS clrled1 $DIMGREEN
71 | $WBREGS clrled2 $DIMGREEN
72 | $WBREGS clrled3 $DIMGREEN
73 |
74 | $WBREGS wbstar 0x01c0000
75 | $WBREGS fpgacmd 15
76 | sleep 1
77 |
78 | if [[ -x ./wbsettime ]]; then
79 | ./wbsettime
80 | fi
81 |
82 |
--------------------------------------------------------------------------------
/sw/host/qflexpress.gtkw:
--------------------------------------------------------------------------------
1 | [*]
2 | [*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
3 | [*] Sat Dec 1 17:47:50 2018
4 | [*]
5 | [dumpfile] "/home/dan/work/rnd/opencores/openarty/trunk/sw/host/qflexpress.vcd"
6 | [dumpfile_mtime] "Sat Dec 1 17:18:15 2018"
7 | [dumpfile_size] 140128
8 | [savefile] "/home/dan/work/rnd/opencores/openarty/trunk/sw/host/qflexpress.gtkw"
9 | [timestart] 5468559
10 | [size] 1925 600
11 | [pos] -1 -1
12 | *-5.000000 5350000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
13 | [sst_width] 196
14 | [signals_width] 134
15 | [sst_expanded] 1
16 | [sst_vpaned_height] 155
17 | @28
18 | WBSCOPE._trigger
19 | WBSCOPE.wb_cyc[0]
20 | WBSCOPE.cfg_stb[0]
21 | WBSCOPE.wb_stb[0]
22 | WBSCOPE.wb_ack[0]
23 | @22
24 | WBSCOPE.wb_data[7:0]
25 | @28
26 | WBSCOPE.wb_stall[0]
27 | @200
28 | -
29 | @28
30 | WBSCOPE.o_cs_n[0]
31 | WBSCOPE.o_sck[0]
32 | @22
33 | WBSCOPE.o_qdat[3:0]
34 | @28
35 | WBSCOPE.o_qmod[1:0]
36 | @800022
37 | WBSCOPE.i_qdat[3:0]
38 | @28
39 | (0)WBSCOPE.i_qdat[3:0]
40 | (1)WBSCOPE.i_qdat[3:0]
41 | (2)WBSCOPE.i_qdat[3:0]
42 | (3)WBSCOPE.i_qdat[3:0]
43 | @1001200
44 | -group_end
45 | @29
46 | [color] 1
47 | WBSCOPE.actual_sck[0]
48 | @200
49 | -
50 | @28
51 | WBSCOPE.cfg_cs[0]
52 | WBSCOPE.cfg_dir[0]
53 | WBSCOPE.cfg_mode[0]
54 | WBSCOPE.cfg_speed[0]
55 | [pattern_trace] 1
56 | [pattern_trace] 0
57 |
--------------------------------------------------------------------------------
/sw/host/twoc.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: twoc.cpp
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Some various two's complement related C++ helper routines.
8 | // Specifically, these help extract signed numbers from
9 | // packed bitfields, while guaranteeing that the upper bits
10 | // are properly sign extended (or not) as desired.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #include
42 | #include
43 | #include "twoc.h"
44 |
45 | long sbits(const long val, const int bits) {
46 | long r;
47 |
48 | r = val & ((1l< bits_out);
72 | if (bits_in == bits_out)
73 | r = s;
74 | else if (bits_in-1 == bits_out) {
75 | t = sbits(val>>1, bits_out);
76 | // printf("TEST! S = %ld, T = %ld\n", s, t);
77 | if (3 == (s&3))
78 | t = t+1;
79 | r = t;
80 | } else {
81 | // A. 0XXXX.0xxxxx -> 0XXXX
82 | // B. 0XXX0.100000 -> 0XXX0;
83 | // C. 0XXX1.100000 -> 0XXX1+1;
84 | // D. 0XXXX.1zzzzz -> 0XXXX+1;
85 | // E. 1XXXX.0xxxxx -> 1XXXX
86 | // F. 1XXX0.100000 -> ??? XXX0;
87 | // G. 1XXX1.100000 -> ??? XXX1+1;
88 | // H. 1XXXX.1zzzzz -> 1XXXX+1;
89 | t = sbits(val>>(bits_in-bits_out), bits_out); // Truncated value
90 | if (0 == ((s >> (bits_in-bits_out-1))&1)) {
91 | // printf("A\n");
92 | r = t;
93 | } else if (0 != (s & ((1<<(bits_in-bits_out-1))-1))) {
94 | // printf("D\n");
95 | r = t+1;
96 | } else if (t&1) {
97 | // printf("C\n");
98 | r = t+1;
99 | } else { // 3 ..?11
100 | // printf("B\n");
101 | r = t;
102 | }
103 | } return r;
104 | }
105 |
106 |
107 |
--------------------------------------------------------------------------------
/sw/host/twoc.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: twoc.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Some various two's complement related C++ helper routines.
8 | // Specifically, these help extract signed numbers from
9 | // packed bitfields, while guaranteeing that the upper bits
10 | // are properly sign extended (or not) as desired.
11 | //
12 | // Creator: Dan Gisselquist, Ph.D.
13 | // Gisselquist Technology, LLC
14 | //
15 | ////////////////////////////////////////////////////////////////////////////////
16 | //
17 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
18 | //
19 | // This program is free software (firmware): you can redistribute it and/or
20 | // modify it under the terms of the GNU General Public License as published
21 | // by the Free Software Foundation, either version 3 of the License, or (at
22 | // your option) any later version.
23 | //
24 | // This program is distributed in the hope that it will be useful, but WITHOUT
25 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | // for more details.
28 | //
29 | // You should have received a copy of the GNU General Public License along
30 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | // target there if the PDF file isn't present.) If not, see
32 | // for a copy.
33 | //
34 | // License: GPL, v3, as defined and found on www.gnu.org,
35 | // http://www.gnu.org/licenses/gpl.html
36 | //
37 | //
38 | ////////////////////////////////////////////////////////////////////////////////
39 | //
40 | //
41 | #ifndef TWOC_H
42 | #define TWOC_H
43 |
44 | extern long sbits(const long val, const int bits);
45 | extern bool sfits(const long val, const int bits);
46 | extern unsigned long ubits(const long val, const int bits);
47 | extern unsigned long rndbits(const long val, const int bi, const int bo);
48 |
49 | #endif
50 |
51 |
--------------------------------------------------------------------------------
/sw/host/zipelf.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: zipelf.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose:
8 | //
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | #ifndef ZIPELF_H
40 | #define ZIPELF_H
41 |
42 | #include
43 |
44 | class ELFSECTION {
45 | public:
46 | uint32_t m_start, m_len;
47 | char m_data[4];
48 | };
49 |
50 | bool iself(const char *fname);
51 | void elfread(const char *fname, uint32_t &entry, ELFSECTION **§ions);
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/sw/host/zprog.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ################################################################################
3 | ##
4 | ## Filename: zprog.sh
5 | ##
6 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
7 | ##
8 | ## Purpose: To install a new program into the Arty, using the main
9 | ## programming slot (slot 0).
10 | ##
11 | ## Creator: Dan Gisselquist, Ph.D.
12 | ## Gisselquist Technology, LLC
13 | ##
14 | ################################################################################
15 | ##
16 | ## Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 | ##
18 | ## This program is free software (firmware): you can redistribute it and/or
19 | ## modify it under the terms of the GNU General Public License as published
20 | ## by the Free Software Foundation, either version 3 of the License, or (at
21 | ## your option) any later version.
22 | ##
23 | ## This program is distributed in the hope that it will be useful, but WITHOUT
24 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | ## for more details.
27 | ##
28 | ## You should have received a copy of the GNU General Public License along
29 | ## with this program. (It's in the $(ROOT)/doc directory, run make with no
30 | ## target there if the PDF file isn't present.) If not, see
31 | ## for a copy.
32 | ##
33 | ## License: GPL, v3, as defined and found on www.gnu.org,
34 | ## http://www.gnu.org/licenses/gpl.html
35 | ##
36 | ##
37 | ################################################################################
38 | ##
39 | ##
40 | export PATH=$PATH:.
41 | export BINFILE=../../xilinx/openarty.runs/impl_1/toplevel.bit
42 |
43 | WBREGS=wbregs
44 | WBPROG=wbprogram
45 |
46 | RED=0x000f0000
47 | GREEN=0x0000ff00
48 | YELLOW=0x00170700
49 | WHITE=0x000f0f0f
50 | BLACK=0x00000000
51 | DIMGREEN=0x00001f00
52 |
53 | $WBREGS led 0x0ff
54 | $WBREGS clrled0 $YELLOW
55 | $WBREGS clrled1 $YELLOW
56 | $WBREGS clrled2 $YELLOW
57 | $WBREGS clrled3 $YELLOW
58 |
59 | #
60 | # $WBREGS qspiv 0x8b # Accomplished by the flash driver
61 | #
62 | $WBREGS stopwatch 2 # Clear and stop the stopwatch
63 | $WBREGS stopwatch 1 # Start the stopwatch
64 | echo $WBPROG @0x1000000 $BINFILE
65 | $WBPROG @0x1000000 $BINFILE
66 | $WBREGS stopwatch 0 # Stop the stopwatch, we are done
67 | $WBREGS stopwatch # Print out the time on the stopwatch
68 |
69 | $WBREGS led 0x0f0
70 | $WBREGS clrled0 $DIMGREEN
71 | $WBREGS clrled1 $DIMGREEN
72 | $WBREGS clrled2 $DIMGREEN
73 | $WBREGS clrled3 $DIMGREEN
74 |
75 | $WBREGS wbstar 0
76 | $WBREGS fpgacmd 15
77 | sleep 1
78 |
79 | if [[ -x ./wbsettime ]]; then
80 | ./wbsettime
81 | fi
82 |
83 |
--------------------------------------------------------------------------------
/sw/loopy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | WBREGS=host/wbregs
4 |
5 | bash startupex.sh
6 | sleep 4;
7 | while true; do
8 | echo $WBREGS
9 | $WBREGS leds 0x0f8 ; sleep 1
10 | $WBREGS leds 0x0f4 ; sleep 1
11 | $WBREGS leds 0x0f2 ; sleep 1
12 | $WBREGS leds 0x0f1 ; sleep 1
13 | done
14 |
--------------------------------------------------------------------------------
/sw/startupex.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ################################################################################
3 | ##
4 | ## Filename: startupex.sh
5 | ##
6 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
7 | ##
8 | ## Purpose: A simple, but rather neat, demonstration proving that the wishbone
9 | ## command capability works and that the FPGA is at least somewhat responsive.
10 | ##
11 | ## Creator: Dan Gisselquist, Ph.D.
12 | ## Gisselquist Technology, LLC
13 | ##
14 | ################################################################################
15 | ##
16 | ## Copyright (C) 2015-2016, Gisselquist Technology, LLC
17 | ##
18 | ## This program is free software (firmware): you can redistribute it and/or
19 | ## modify it under the terms of the GNU General Public License as published
20 | ## by the Free Software Foundation, either version 3 of the License, or (at
21 | ## your option) any later version.
22 | ##
23 | ## This program is distributed in the hope that it will be useful, but WITHOUT
24 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 | ## for more details.
27 | ##
28 | ## You should have received a copy of the GNU General Public License along
29 | ## with this program. (It's in the $(ROOT)/doc directory, run make with no
30 | ## target there if the PDF file isn't present.) If not, see
31 | ## for a copy.
32 | ##
33 | ## License: GPL, v3, as defined and found on www.gnu.org,
34 | ## http://www.gnu.org/licenses/gpl.html
35 | ##
36 | ##
37 | ################################################################################
38 | ##
39 | ##
40 | export PATH=$PATH:.
41 | export BINFILE=../../xilinx/openarty/openarty.runs/impl_1/fasttop.bin
42 |
43 | WBREGS=host/wbregs
44 | RED=0x00ff0000
45 | GREEN=0x0000ff00
46 | WHITE=0x00070707
47 | BLACK=0x00000000
48 | DIMGREEN=0x00001f00
49 |
50 | $WBREGS led 0x0ff
51 | $WBREGS clrled0 $RED
52 | $WBREGS clrled1 $RED
53 | $WBREGS clrled2 $RED
54 | $WBREGS clrled3 $RED
55 |
56 | sleep 1
57 | $WBREGS clrled0 $GREEN
58 | $WBREGS led 0x10
59 | sleep 1
60 | $WBREGS clrled1 $GREEN
61 | $WBREGS clrled0 $DIMGREEN
62 | $WBREGS led 0x20
63 | sleep 1
64 | $WBREGS clrled2 $GREEN
65 | $WBREGS clrled1 $DIMGREEN
66 | $WBREGS led 0x40
67 | sleep 1
68 | $WBREGS clrled3 $GREEN
69 | $WBREGS clrled2 $DIMGREEN
70 | $WBREGS led 0x80
71 | sleep 1
72 | $WBREGS clrled0 $WHITE
73 | $WBREGS clrled1 $WHITE
74 | $WBREGS clrled2 $WHITE
75 | $WBREGS clrled3 $WHITE
76 | $WBREGS led 0x00
77 |
78 |
79 |
--------------------------------------------------------------------------------
/sw/zlib/.gitignore:
--------------------------------------------------------------------------------
1 | libarty.a
2 |
--------------------------------------------------------------------------------
/sw/zlib/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | ##
3 | ## Filename: Makefile
4 | ##
5 | ## Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | ##
7 | ## Purpose: To guide/direct the build of the board-specific portion of
8 | ## newlib.
9 | ##
10 | ## Targets:
11 | ##
12 | ## Creator: Dan Gisselquist, Ph.D.
13 | ## Gisselquist Technology, LLC
14 | ##
15 | ################################################################################
16 | ##
17 | ## Copyright (C) 2017-2019, Gisselquist Technology, LLC
18 | ##
19 | ## This program is free software (firmware): you can redistribute it and/or
20 | ## modify it under the terms of the GNU General Public License as published
21 | ## by the Free Software Foundation, either version 3 of the License, or (at
22 | ## your option) any later version.
23 | ##
24 | ## This program is distributed in the hope that it will be useful, but WITHOUT
25 | ## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
26 | ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 | ## for more details.
28 | ##
29 | ## You should have received a copy of the GNU General Public License along
30 | ## with this program. (It's in the $(ROOT)/doc directory. Run make with no
31 | ## target there if the PDF file isn't present.) If not, see
32 | ## for a copy.
33 | ##
34 | ## License: GPL, v3, as defined and found on www.gnu.org,
35 | ## http://www.gnu.org/licenses/gpl.html
36 | ##
37 | ##
38 | ################################################################################
39 | ##
40 | ##
41 | CC := zip-gcc
42 | AR := zip-ar
43 | OBJDIR := obj-zip
44 | INCS := -I. -I../../rtl
45 | CFLAGS := -O3 $(INCS)
46 | LIBSRCS := udiv.c umod.c syscalls.c crt0.c
47 | LIBOBJS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(LIBSRCS)))
48 | ZIPLIB := libarty.a
49 | all: $(ZIPLIB)
50 |
51 | $(OBJDIR)/%.o: %.c
52 | $(mk-objdir)
53 | $(CC) $(CFLAGS) -c $< -o $@
54 |
55 | $(OBJDIR)/%.s: %.c
56 | $(mk-objdir)
57 | $(CC) $(CFLAGS) -fdump-rtl-all -S $< -o $@
58 |
59 | $(OBJDIR)/crt0.o: crt0.c
60 | $(mk-objdir)
61 | $(CC) $(CFLAGS) -ffreestanding -c $< -o $@
62 |
63 | $(ZIPLIB): $(LIBOBJS)
64 | $(AR) -cru $@ $(LIBOBJS)
65 |
66 | clean:
67 | rm -rf $(ZIPLIB) $(OBJDIR)/
68 |
69 | define mk-objdir
70 | @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
71 | endef
72 |
73 | define build-depends
74 | @echo "Building dependency file(s)"
75 | $(mk-objdir)
76 | @$(CC) $(CFLAGS) -MM $(LIBSRCS) > $(OBJDIR)/xdepends.txt
77 | @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
78 | @rm $(OBJDIR)/xdepends.txt
79 | endef
80 |
81 | tags: $(LIBSRCS) $(HEADERS)
82 | @echo "Generating tags"
83 | @ctags $(LIBSRCS) $(HEADERS)
84 |
85 |
86 | .PHONY: depends
87 | depends: tags
88 | $(build-depends)
89 |
90 | $(OBJDIR)/depends.txt: $(SOURCES) $(HEADERS)
91 | $(build-depends)
92 |
93 | -include $(OBJDIR)/depends.txt
94 |
--------------------------------------------------------------------------------
/sw/zlib/bootloader.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: bootloader.h
4 | //
5 | // Project: Zip CPU -- a small, lightweight, RISC CPU soft core
6 | //
7 | // Purpose:
8 | //
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // License: GPL, v3, as defined and found on www.gnu.org,
28 | // http://www.gnu.org/licenses/gpl.html
29 | //
30 | //
31 | ////////////////////////////////////////////////////////////////////////////////
32 | //
33 | //
34 | #ifndef BOOTLOADER_H
35 | #define BOOTLOADER_H
36 |
37 | extern int _top_of_heap[1], _top_of_stack[1];
38 | extern int _boot_address[1];
39 |
40 | extern int _ram[1], _rom[1], _kram[1];
41 |
42 | extern int _boot_address[1],
43 | _kram_start[1], _kram_end[1],
44 | _ram_image_start[1], _ram_image_end[1],
45 | _bss_image_end[1];
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/sw/zlib/umod.c:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: umod.c
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: This is a temporary file--a crutch if you will--until a similar
8 | // capability is merged into GCC. Right now, GCC has no way of
9 | // taking the module of two 64-bit numbers, and this routine provides that
10 | // capability.
11 | //
12 | // This routine is required by and used by newlib's printf in order to
13 | // print decimal numbers (%d) to an IO stream.
14 | //
15 | // Once gcc is properly patched, this will be removed from the
16 | // repository.
17 | //
18 | // Creator: Dan Gisselquist, Ph.D.
19 | // Gisselquist Technology, LLC
20 | //
21 | ////////////////////////////////////////////////////////////////////////////////
22 | //
23 | // Copyright (C) 2017-2019, Gisselquist Technology, LLC
24 | //
25 | // This program is free software (firmware): you can redistribute it and/or
26 | // modify it under the terms of the GNU General Public License as published
27 | // by the Free Software Foundation, either version 3 of the License, or (at
28 | // your option) any later version.
29 | //
30 | // This program is distributed in the hope that it will be useful, but WITHOUT
31 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
32 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
33 | // for more details.
34 | //
35 | // You should have received a copy of the GNU General Public License along
36 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
37 | // target there if the PDF file isn't present.) If not, see
38 | // for a copy.
39 | //
40 | // License: GPL, v3, as defined and found on www.gnu.org,
41 | // http://www.gnu.org/licenses/gpl.html
42 | //
43 | //
44 | ////////////////////////////////////////////////////////////////////////////////
45 | //
46 | //
47 | #include
48 |
49 |
50 | unsigned long __udivdi3(unsigned long, unsigned long);
51 |
52 | __attribute((noinline))
53 | unsigned long __umoddi3(unsigned long a, unsigned long b) {
54 | unsigned long r;
55 |
56 | // Return a modulo b, or a%b in C syntax
57 | r = __udivdi3(a, b);
58 | r = r * b;
59 | r = a - r;
60 | return r;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/sw/zlib/zipcpu.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Filename: zipsys.h
4 | //
5 | // Project: OpenArty, an entirely open SoC based upon the Arty platform
6 | //
7 | // Purpose: Declare the capabilities and memory structure of the ZipSystem
8 | // for programs that must interact with it.
9 | //
10 | // Creator: Dan Gisselquist, Ph.D.
11 | // Gisselquist Technology, LLC
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Copyright (C) 2015-2019, Gisselquist Technology, LLC
16 | //
17 | // This program is free software (firmware): you can redistribute it and/or
18 | // modify it under the terms of the GNU General Public License as published
19 | // by the Free Software Foundation, either version 3 of the License, or (at
20 | // your option) any later version.
21 | //
22 | // This program is distributed in the hope that it will be useful, but WITHOUT
23 | // ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 | // for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License along
28 | // with this program. (It's in the $(ROOT)/doc directory. Run make with no
29 | // target there if the PDF file isn't present.) If not, see
30 | // for a copy.
31 | //
32 | // License: GPL, v3, as defined and found on www.gnu.org,
33 | // http://www.gnu.org/licenses/gpl.html
34 | //
35 | //
36 | ////////////////////////////////////////////////////////////////////////////////
37 | //
38 | //
39 | #ifndef ZIPCPU_H
40 | #define ZIPCPU_H
41 |
42 | #define CC_Z 0x0001
43 | #define CC_C 0x0002
44 | #define CC_N 0x0004
45 | #define CC_V 0x0008
46 | #define CC_SLEEP 0x0010
47 | #define CC_GIE 0x0020
48 | #define CC_STEP 0x0040
49 | #define CC_BREAK 0x0080
50 | #define CC_ILL 0x0100
51 | #define CC_TRAP 0x0200
52 | #define CC_BUSERR 0x0400
53 | #define CC_DIVERR 0x0800
54 | #define CC_FPUERR 0x1000
55 | #define CC_IPHASE 0x2000
56 | #define CC_MMUERR 0x8000
57 | #define CC_FAULT (CC_ILL|CC_BUSERR|CC_DIVERR|CC_FPUERR)
58 | #define CC_EXCEPTION (CC_BREAK|CC_FAULT|CC_MMUERR)
59 |
60 | #define CLEAR_CACHE asm("OR 16384,CC")
61 |
62 | // extern void zip_break(void);
63 | #define zip_break() asm("BREAK\n")
64 | // #define BREAK(ID) asm("BREAK " ##ID "\n")
65 | #define GETUREG(A,ID) asm("MOV " ID ",%0" : "=r"(A))
66 | #define SETUREG(A,ID) asm("MOV %0," ID : : "r"(A))
67 | #define NSTR(A) asm("NSTR \"" A "\\n\"")
68 | #define NVAL(V) do { unsigned tmp = (unsigned)(V); asm volatile("NDUMP %0":"=r"(tmp):"0"(tmp)); } while(0)
69 | extern void zip_rtu(void);
70 | extern void zip_halt(void);
71 | extern void zip_idle(void);
72 | extern void zip_syscall(void);
73 | extern void zip_restore_context(int *);
74 | extern void zip_save_context(int *);
75 | extern int zip_bitrev(int v);
76 | extern unsigned zip_cc(void);
77 | extern unsigned zip_ucc(void);
78 |
79 | extern void save_context(int *);
80 | extern void restore_context(int *);
81 | extern int syscall(int,int,int,int);
82 |
83 | #ifndef NULL
84 | #define NULL ((void *)0)
85 | #endif
86 |
87 | #define ASMFNSTR(A) "\t.section\t.text\n\t.global\t" A "\n\t.type\t" A ",@function\n" A ":\n"
88 |
89 | #endif
90 |
--------------------------------------------------------------------------------