├── LICENSE
├── README.md
├── debugger
├── .gitignore
├── makefiles
│ ├── make_appdbg64g
│ ├── make_cpu_fnc_plugin
│ ├── make_cpu_sysc_plugin
│ ├── make_gui_plugin
│ ├── make_libdbg64g
│ ├── make_simple_plugin
│ ├── make_socsim_plugin
│ ├── makefile
│ └── util.mak
├── msvc13
│ ├── appdbg64g
│ │ ├── appdbg64g.vcxproj
│ │ ├── appdbg64g.vcxproj.filters
│ │ ├── appdbg64g.vcxproj.user
│ │ └── runthis.cmd
│ ├── cpu_fnc_plugin
│ │ ├── cpu_fnc_plugin.vcxproj
│ │ ├── cpu_fnc_plugin.vcxproj.filters
│ │ ├── cpu_fnc_plugin.vcxproj.user
│ │ └── exportmap.def
│ ├── cpu_sysc_plugin
│ │ ├── cpu_sysc_plugin.vcxproj
│ │ ├── cpu_sysc_plugin.vcxproj.filters
│ │ ├── cpu_sysc_plugin.vcxproj.user
│ │ └── exportmap.def
│ ├── gui_plugin
│ │ ├── exportmap.def
│ │ ├── gui_plugin.vcxproj
│ │ ├── gui_plugin.vcxproj.filters
│ │ ├── gui_plugin.vcxproj.user
│ │ ├── post_build_event.bat
│ │ └── pre_build_event.bat
│ ├── libdbg64g
│ │ ├── exportmap.def
│ │ ├── libdbg64g.vcxproj
│ │ ├── libdbg64g.vcxproj.filters
│ │ └── libdbg64g.vcxproj.user
│ ├── riscvdebugger.sln
│ ├── simple_plugin
│ │ ├── exportmap.def
│ │ ├── simple_plugin.vcxproj
│ │ ├── simple_plugin.vcxproj.filters
│ │ └── simple_plugin.vcxproj.user
│ └── socsim_plugin
│ │ ├── exportmap.def
│ │ ├── socsim_plugin.vcxproj
│ │ ├── socsim_plugin.vcxproj.filters
│ │ └── socsim_plugin.vcxproj.user
├── src
│ ├── appdbg64g
│ │ └── main.cpp
│ ├── common
│ │ ├── api_core.h
│ │ ├── api_types.h
│ │ ├── api_utils.h
│ │ ├── async_tqueue.cpp
│ │ ├── async_tqueue.h
│ │ ├── attribute.cpp
│ │ ├── attribute.h
│ │ ├── autobuffer.cpp
│ │ ├── autobuffer.h
│ │ ├── coreservices
│ │ │ ├── iautocomplete.h
│ │ │ ├── ibus.h
│ │ │ ├── iclklistener.h
│ │ │ ├── iclock.h
│ │ │ ├── icmdexec.h
│ │ │ ├── icommand.h
│ │ │ ├── icpuriscv.h
│ │ │ ├── ielfreader.h
│ │ │ ├── ikeylistener.h
│ │ │ ├── ilink.h
│ │ │ ├── imemop.h
│ │ │ ├── irawlistener.h
│ │ │ ├── iserial.h
│ │ │ ├── isignal.h
│ │ │ ├── isignallistener.h
│ │ │ ├── isocinfo.h
│ │ │ ├── isrccode.h
│ │ │ ├── itap.h
│ │ │ ├── ithread.h
│ │ │ └── iwire.h
│ │ ├── iattr.h
│ │ ├── iclass.h
│ │ ├── iface.h
│ │ ├── ihap.h
│ │ ├── iservice.h
│ │ └── riscv-isa.h
│ ├── cpu_fnc_plugin
│ │ ├── cpu_riscv_func.cpp
│ │ ├── cpu_riscv_func.h
│ │ ├── iinstr.h
│ │ ├── instructions.cpp
│ │ ├── instructions.h
│ │ ├── plugin_init.cpp
│ │ ├── riscv-ext-a.cpp
│ │ ├── riscv-ext-f.cpp
│ │ ├── riscv-ext-m.cpp
│ │ ├── riscv-rv64i-priv.cpp
│ │ └── riscv-rv64i-user.cpp
│ ├── cpu_sysc_plugin
│ │ ├── cpu_riscv_rtl.cpp
│ │ ├── cpu_riscv_rtl.h
│ │ ├── plugin_init.cpp
│ │ ├── riverlib
│ │ │ ├── cache
│ │ │ │ ├── cache_top.cpp
│ │ │ │ ├── cache_top.h
│ │ │ │ ├── dcache.cpp
│ │ │ │ ├── dcache.h
│ │ │ │ ├── icache.cpp
│ │ │ │ └── icache.h
│ │ │ ├── core
│ │ │ │ ├── arith
│ │ │ │ │ ├── int_div.cpp
│ │ │ │ │ ├── int_div.h
│ │ │ │ │ ├── int_mul.cpp
│ │ │ │ │ ├── int_mul.h
│ │ │ │ │ ├── shift.cpp
│ │ │ │ │ └── shift.h
│ │ │ │ ├── br_predic.cpp
│ │ │ │ ├── br_predic.h
│ │ │ │ ├── csr.cpp
│ │ │ │ ├── csr.h
│ │ │ │ ├── dbg_port.cpp
│ │ │ │ ├── dbg_port.h
│ │ │ │ ├── decoder.cpp
│ │ │ │ ├── decoder.h
│ │ │ │ ├── execute.cpp
│ │ │ │ ├── execute.h
│ │ │ │ ├── fetch.cpp
│ │ │ │ ├── fetch.h
│ │ │ │ ├── memaccess.cpp
│ │ │ │ ├── memaccess.h
│ │ │ │ ├── proc.cpp
│ │ │ │ ├── proc.h
│ │ │ │ ├── regibank.cpp
│ │ │ │ ├── regibank.h
│ │ │ │ ├── stacktrbuf.cpp
│ │ │ │ └── stacktrbuf.h
│ │ │ ├── river_cfg.h
│ │ │ ├── river_top.cpp
│ │ │ └── river_top.h
│ │ ├── rtl_wrapper.cpp
│ │ └── rtl_wrapper.h
│ ├── gui_plugin
│ │ ├── ControlWidget
│ │ │ ├── ConsoleWidget.cpp
│ │ │ ├── ConsoleWidget.h
│ │ │ ├── PnpWidget.cpp
│ │ │ └── PnpWidget.h
│ │ ├── CpuWidgets
│ │ │ ├── AsmArea.cpp
│ │ │ ├── AsmArea.h
│ │ │ ├── AsmControl.cpp
│ │ │ ├── AsmControl.h
│ │ │ ├── AsmViewWidget.cpp
│ │ │ ├── AsmViewWidget.h
│ │ │ ├── MemArea.cpp
│ │ │ ├── MemArea.h
│ │ │ ├── MemControl.cpp
│ │ │ ├── MemControl.h
│ │ │ ├── MemViewWidget.cpp
│ │ │ ├── MemViewWidget.h
│ │ │ ├── RegWidget.cpp
│ │ │ ├── RegWidget.h
│ │ │ ├── RegsViewWidget.cpp
│ │ │ ├── RegsViewWidget.h
│ │ │ ├── StackTraceArea.cpp
│ │ │ ├── StackTraceArea.h
│ │ │ ├── StackTraceWidget.cpp
│ │ │ ├── StackTraceWidget.h
│ │ │ ├── SymbolBrowserArea.cpp
│ │ │ ├── SymbolBrowserArea.h
│ │ │ ├── SymbolBrowserControl.cpp
│ │ │ ├── SymbolBrowserControl.h
│ │ │ ├── SymbolBrowserWidget.cpp
│ │ │ └── SymbolBrowserWidget.h
│ │ ├── GnssWidgets
│ │ │ ├── MapWidget.cpp
│ │ │ ├── MapWidget.h
│ │ │ ├── PlotWidget.cpp
│ │ │ ├── PlotWidget.h
│ │ │ ├── StreetMapObject.cpp
│ │ │ ├── StreetMapObject.h
│ │ │ ├── linecommon.cpp
│ │ │ └── linecommon.h
│ │ ├── MainWindow
│ │ │ ├── DbgMainWindow.cpp
│ │ │ ├── DbgMainWindow.h
│ │ │ ├── MdiAreaWidget.cpp
│ │ │ ├── MdiAreaWidget.h
│ │ │ ├── ebreakhandler.cpp
│ │ │ └── ebreakhandler.h
│ │ ├── PeriphWidgets
│ │ │ ├── DipArea.cpp
│ │ │ ├── DipArea.h
│ │ │ ├── GpioWidget.cpp
│ │ │ ├── GpioWidget.h
│ │ │ ├── LedArea.cpp
│ │ │ ├── LedArea.h
│ │ │ ├── UartEditor.cpp
│ │ │ ├── UartEditor.h
│ │ │ ├── UartWidget.cpp
│ │ │ └── UartWidget.h
│ │ ├── gui_plugin.cpp
│ │ ├── gui_plugin.h
│ │ ├── igui.h
│ │ ├── qt_wrapper.cpp
│ │ ├── qt_wrapper.h
│ │ └── resources
│ │ │ ├── gui.qrc
│ │ │ └── images
│ │ │ ├── asm_96x96.png
│ │ │ ├── board_96x96.png
│ │ │ ├── cpu_96x96.png
│ │ │ ├── dip_down.png
│ │ │ ├── dip_t4_l21_up.png
│ │ │ ├── gpio_96x96.png
│ │ │ ├── info_96x96.png
│ │ │ ├── kc705_top.png
│ │ │ ├── led_off.png
│ │ │ ├── led_on.png
│ │ │ ├── mem_96x96.png
│ │ │ ├── ml605_top.png
│ │ │ ├── opmap_96x96.png
│ │ │ ├── pause_96x96.png
│ │ │ ├── plot_96x96.png
│ │ │ ├── serial_96x96.png
│ │ │ ├── stack_96x96.png
│ │ │ ├── start_96x96.png
│ │ │ ├── stepinto_96x96.png
│ │ │ └── toggle.png
│ ├── libdbg64g
│ │ ├── api_core.cpp
│ │ ├── api_utils.cpp
│ │ ├── include
│ │ │ └── dirent.h
│ │ └── services
│ │ │ ├── .gitignore
│ │ │ ├── bus
│ │ │ ├── bus.cpp
│ │ │ └── bus.h
│ │ │ ├── comport
│ │ │ ├── com_linux.cpp
│ │ │ ├── com_win.cpp
│ │ │ ├── comport.cpp
│ │ │ └── comport.h
│ │ │ ├── console
│ │ │ ├── autocompleter.cpp
│ │ │ ├── autocompleter.h
│ │ │ ├── console.cpp
│ │ │ └── console.h
│ │ │ ├── debug
│ │ │ ├── edcl.cpp
│ │ │ ├── edcl.h
│ │ │ ├── edcl_types.h
│ │ │ ├── serial_dbglink.cpp
│ │ │ ├── serial_dbglink.h
│ │ │ ├── udp_dbglink.cpp
│ │ │ └── udp_dbglink.h
│ │ │ ├── elfloader
│ │ │ ├── elf_types.h
│ │ │ ├── elfreader.cpp
│ │ │ ├── elfreader.h
│ │ │ ├── srcproc.cpp
│ │ │ └── srcproc.h
│ │ │ ├── exec
│ │ │ ├── cmd
│ │ │ │ ├── cmd_br.cpp
│ │ │ │ ├── cmd_br.h
│ │ │ │ ├── cmd_busutil.cpp
│ │ │ │ ├── cmd_busutil.h
│ │ │ │ ├── cmd_cpi.cpp
│ │ │ │ ├── cmd_cpi.h
│ │ │ │ ├── cmd_csr.cpp
│ │ │ │ ├── cmd_csr.h
│ │ │ │ ├── cmd_disas.cpp
│ │ │ │ ├── cmd_disas.h
│ │ │ │ ├── cmd_exit.cpp
│ │ │ │ ├── cmd_exit.h
│ │ │ │ ├── cmd_halt.cpp
│ │ │ │ ├── cmd_halt.h
│ │ │ │ ├── cmd_isrunning.cpp
│ │ │ │ ├── cmd_isrunning.h
│ │ │ │ ├── cmd_loadelf.cpp
│ │ │ │ ├── cmd_loadelf.h
│ │ │ │ ├── cmd_log.cpp
│ │ │ │ ├── cmd_log.h
│ │ │ │ ├── cmd_memdump.cpp
│ │ │ │ ├── cmd_memdump.h
│ │ │ │ ├── cmd_read.cpp
│ │ │ │ ├── cmd_read.h
│ │ │ │ ├── cmd_reg.cpp
│ │ │ │ ├── cmd_reg.h
│ │ │ │ ├── cmd_regs.cpp
│ │ │ │ ├── cmd_regs.h
│ │ │ │ ├── cmd_reset.cpp
│ │ │ │ ├── cmd_reset.h
│ │ │ │ ├── cmd_run.cpp
│ │ │ │ ├── cmd_run.h
│ │ │ │ ├── cmd_stack.cpp
│ │ │ │ ├── cmd_stack.h
│ │ │ │ ├── cmd_status.cpp
│ │ │ │ ├── cmd_status.h
│ │ │ │ ├── cmd_symb.cpp
│ │ │ │ ├── cmd_symb.h
│ │ │ │ ├── cmd_write.cpp
│ │ │ │ └── cmd_write.h
│ │ │ ├── cmdexec.cpp
│ │ │ └── cmdexec.h
│ │ │ ├── info
│ │ │ ├── soc_info.cpp
│ │ │ └── soc_info.h
│ │ │ └── mem
│ │ │ ├── memsim.cpp
│ │ │ └── memsim.h
│ ├── simple_plugin
│ │ ├── isimple_plugin.h
│ │ └── simple_plugin.cpp
│ └── socsim_plugin
│ │ ├── boardsim.cpp
│ │ ├── boardsim.h
│ │ ├── dsu.cpp
│ │ ├── dsu.h
│ │ ├── fifo.h
│ │ ├── fsev2.cpp
│ │ ├── fsev2.h
│ │ ├── gnss_stub.cpp
│ │ ├── gnss_stub.h
│ │ ├── gpio.cpp
│ │ ├── gpio.h
│ │ ├── gptimers.cpp
│ │ ├── gptimers.h
│ │ ├── greth.cpp
│ │ ├── greth.h
│ │ ├── iboardsim.h
│ │ ├── irqctrl.cpp
│ │ ├── irqctrl.h
│ │ ├── plugin_init.cpp
│ │ ├── pnp.cpp
│ │ ├── pnp.h
│ │ ├── rfctrl.cpp
│ │ ├── rfctrl.h
│ │ ├── ringbuf.h
│ │ ├── types_amba.h
│ │ ├── uart.cpp
│ │ ├── uart.h
│ │ ├── uartmst.cpp
│ │ └── uartmst.h
└── targets
│ ├── default.h.json
│ ├── fpga_gui.json
│ ├── functional_sim_gui.json
│ └── sysc_river_gui.json
├── rocket_soc
├── .gitignore
├── ambalib
│ ├── axictrl.vhd
│ └── types_amba4.vhd
├── bit_files
│ └── v6.0
│ │ ├── kintex7_kc705.zip
│ │ └── virtex6_ml605.zip
├── commonlib
│ ├── types_common.vhd
│ └── types_util.vhd
├── docs
│ ├── .gitignore
│ ├── Doxyfile
│ ├── maingroup.vhd
│ ├── mainpage.vhd
│ ├── pics
│ │ ├── dbg_gnss.png
│ │ ├── dbg_gui_symb.png
│ │ ├── debugger_demo.gif
│ │ ├── river_top.png
│ │ ├── soc_top.png
│ │ ├── soc_top_v4.png
│ │ ├── soc_top_v5.png
│ │ └── zephyr_demo.gif
│ ├── riscv_soc_descr.pdf
│ └── style
│ │ ├── footer.tex
│ │ └── header.tex
├── fw
│ ├── boot
│ │ ├── makefiles
│ │ │ ├── make_boot
│ │ │ ├── makefile
│ │ │ ├── test.ld
│ │ │ └── util.mak
│ │ └── src
│ │ │ ├── crt.S
│ │ │ ├── encoding.h
│ │ │ ├── main.c
│ │ │ └── trap.c
│ ├── common
│ │ ├── axi_const.h
│ │ ├── axi_maps.h
│ │ ├── iface.h
│ │ └── maps
│ │ │ ├── map_ethmac.h
│ │ │ ├── map_fsev2.h
│ │ │ ├── map_gnssengine.h
│ │ │ ├── map_gpio.h
│ │ │ ├── map_gptimers.h
│ │ │ ├── map_irqctrl.h
│ │ │ ├── map_pnp.h
│ │ │ ├── map_rfctrl.h
│ │ │ └── map_uart.h
│ ├── elf2raw64
│ │ ├── makefiles
│ │ │ ├── makefile
│ │ │ └── util.mak
│ │ └── src
│ │ │ ├── elfreader.cpp
│ │ │ ├── elfreader.h
│ │ │ ├── elftypes.h
│ │ │ ├── main.cpp
│ │ │ └── stdtypes.h
│ └── helloworld
│ │ ├── makefiles
│ │ ├── app.ld
│ │ ├── make_example
│ │ ├── makefile
│ │ └── util.mak
│ │ └── src
│ │ ├── helloworld.c
│ │ └── main.c
├── fw_images
│ ├── bootimage.hex
│ ├── fwimage.hex
│ └── gnssfw.hex
├── gnsslib
│ ├── gnssengine_stub
│ │ └── nasti_gnssstub.vhd
│ ├── rf3b
│ │ └── axi_rfctrl.vhd
│ ├── sync
│ │ ├── afifo.vhd
│ │ ├── greycnt.vhd
│ │ ├── reclk.vhd
│ │ └── types_sync.vhd
│ └── types_gnss.vhd
├── prj
│ ├── kc705
│ │ ├── config_k7.vhd
│ │ ├── riscv_soc.xpr
│ │ └── riscv_soc_kc705.xdc
│ ├── kc705_gnss
│ │ ├── config_k7.vhd
│ │ ├── riscv_soc_gnss.xpr
│ │ └── riscv_soc_gnss_kc705.xdc
│ ├── ml605
│ │ ├── config_v6.vhd
│ │ ├── riscv_soc.xise
│ │ └── riscv_soc_v6.ucf
│ ├── ml605_gnss
│ │ ├── config_v6.vhd
│ │ ├── riscv_soc_gnss.xise
│ │ └── riscv_soc_gnss_v6.ucf
│ ├── modelsim
│ │ ├── .gitignore
│ │ ├── _info
│ │ ├── ambalib
│ │ │ └── _info
│ │ ├── commonlib
│ │ │ └── _info
│ │ ├── config_msim.vhd
│ │ ├── riverlib
│ │ │ └── _info
│ │ ├── rocket.mpf
│ │ ├── rocketlib
│ │ │ └── _info
│ │ ├── techmap
│ │ │ └── _info
│ │ └── work
│ │ │ └── _info
│ └── modelsim_gnss
│ │ ├── .gitignore
│ │ ├── _info
│ │ ├── ambalib
│ │ └── _info
│ │ ├── commonlib
│ │ └── _info
│ │ ├── config_msim.vhd
│ │ ├── riscv_soc_gnss.mpf
│ │ ├── riverlib
│ │ └── _info
│ │ ├── rocketlib
│ │ └── _info
│ │ ├── techmap
│ │ └── _info
│ │ └── work
│ │ └── _info
├── riverlib
│ ├── cache
│ │ ├── cache_top.vhd
│ │ ├── dcache.vhd
│ │ └── icache.vhd
│ ├── core
│ │ ├── arith
│ │ │ ├── int_div.vhd
│ │ │ ├── int_mul.vhd
│ │ │ └── shift.vhd
│ │ ├── bp_predic.vhd
│ │ ├── csr.vhd
│ │ ├── dbg_port.vhd
│ │ ├── decoder.vhd
│ │ ├── execute.vhd
│ │ ├── fetch.vhd
│ │ ├── memaccess.vhd
│ │ ├── proc.vhd
│ │ ├── regibank.vhd
│ │ └── stacktrbuf.vhd
│ ├── dsu
│ │ └── axi_dsu.vhd
│ ├── river_amba.vhd
│ ├── river_cfg.vhd
│ ├── river_top.vhd
│ └── types_river.vhd
├── rocketlib
│ ├── behav_srams.v
│ ├── eth
│ │ ├── eth_axi_mst.vhd
│ │ ├── eth_rstgen.vhd
│ │ ├── greth_pkg.vhd
│ │ ├── greth_rx.vhd
│ │ ├── greth_tx.vhd
│ │ ├── grethaxi.vhd
│ │ └── grethc64.vhd
│ ├── misc
│ │ ├── nasti_bootrom.vhd
│ │ ├── nasti_gpio.vhd
│ │ ├── nasti_gptimers.vhd
│ │ ├── nasti_irqctrl.vhd
│ │ ├── nasti_pnp.vhd
│ │ ├── nasti_romimage.vhd
│ │ ├── nasti_sram.vhd
│ │ ├── nasti_uart.vhd
│ │ ├── reset_glb.vhd
│ │ └── tap_uart.vhd
│ ├── rocket_l1only.vhd
│ ├── rocketchip.GnssConfig.v
│ ├── tilelink
│ │ └── axibridge.vhd
│ ├── tl2axi.vhd
│ └── types_rocket.vhd
├── techmap
│ ├── bufg
│ │ ├── bufgmux_fpga.vhd
│ │ ├── bufgmux_micron180.vhd
│ │ ├── bufgmux_tech.vhd
│ │ ├── ibuf_inferred.vhd
│ │ ├── ibuf_tech.vhd
│ │ ├── ibufg_tech.vhd
│ │ ├── ibufg_xilinx.vhd
│ │ ├── idsbuf_tech.vhd
│ │ ├── idsbuf_xilinx.vhd
│ │ ├── igdsbuf_k7.vhd
│ │ ├── igdsbuf_tech.vhd
│ │ ├── igdsbuf_v6.vhd
│ │ ├── iobuf_inferred.vhd
│ │ ├── iobuf_tech.vhd
│ │ ├── iobuf_virtex6.vhd
│ │ ├── obuf_inferred.vhd
│ │ ├── obuf_tech.vhd
│ │ └── types_buf.vhd
│ ├── gencomp
│ │ └── gencomp.vhd
│ ├── mem
│ │ ├── bootrom_inferred.vhd
│ │ ├── bootrom_tech.vhd
│ │ ├── ram32_inferred.vhd
│ │ ├── ram32_tech.vhd
│ │ ├── ram32x2_tech.vhd
│ │ ├── romimage_inferred.vhd
│ │ ├── romimage_tech.vhd
│ │ ├── romprn.hex
│ │ ├── romprn_inferred.vhd
│ │ ├── romprn_micron180.vhd
│ │ ├── romprn_tech.vhd
│ │ ├── sram8_inferred.vhd
│ │ ├── sram8_inferred_init.vhd
│ │ ├── srambytes_tech.vhd
│ │ ├── syncram_2p_inferred.vhd
│ │ ├── syncram_2p_tech.vhd
│ │ └── types_mem.vhd
│ └── pll
│ │ ├── SysPLL_inferred.vhd
│ │ ├── SysPLL_k7.vhd
│ │ ├── SysPLL_micron180.vhd
│ │ ├── SysPLL_tech.vhd
│ │ ├── SysPLL_v6.vhd
│ │ ├── clkp90_k7.vhd
│ │ ├── clkp90_tech.vhd
│ │ ├── clkp90_v6.vhd
│ │ └── types_pll.vhd
└── work
│ ├── config_common.vhd
│ ├── riscv_soc.vhd
│ ├── riscv_soc_gnss.vhd
│ └── tb
│ ├── ethphy_sim.vhd
│ ├── fsebr0_tb.vhd
│ ├── riscv_soc_tb.vhd
│ └── uart_sim.vhd
└── zephyr
├── .gitignore
├── _howto_build
├── v1.6.0-riscv64-base.diff
└── v1.6.0-riscv64-exten.diff
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, sergeykhbr
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
25 |
--------------------------------------------------------------------------------
/debugger/.gitignore:
--------------------------------------------------------------------------------
1 | *.sdf
2 | *.opensdf
3 | *.suo
4 | *.err
5 | Debug
6 | Release
7 | *.log
8 | *.rcc
9 | linuxbuild
10 | win32build
11 | win64build
12 | moc_*.h
13 |
--------------------------------------------------------------------------------
/debugger/makefiles/make_cpu_fnc_plugin:
--------------------------------------------------------------------------------
1 | ###
2 | ## @file
3 | ## @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | ## @author Sergey Khabarov - sergeykhbr@gmail.com
5 | ##
6 |
7 | include util.mak
8 |
9 | CC=gcc
10 | CPP=gcc
11 | CFLAGS=-g -c -Wall -Werror -fPIC -pthread
12 | LDFLAGS=-shared -pthread -L$(PLUGINS_ELF_DIR)/..
13 | INCL_KEY=-I
14 | DIR_KEY=-B
15 |
16 |
17 | # include sub-folders list
18 | INCL_PATH= \
19 | $(TOP_DIR)src/common
20 |
21 | # source files directories list:
22 | SRC_PATH =\
23 | $(TOP_DIR)src/common \
24 | $(TOP_DIR)src/cpu_fnc_plugin
25 |
26 | VPATH = $(SRC_PATH)
27 |
28 | SOURCES = \
29 | attribute \
30 | autobuffer \
31 | async_tqueue \
32 | plugin_init \
33 | cpu_riscv_func \
34 | riscv-rv64i-user \
35 | riscv-rv64i-priv \
36 | instructions \
37 | riscv-ext-a \
38 | riscv-ext-m \
39 | riscv-ext-f
40 |
41 | LIBS = \
42 | m \
43 | stdc++ \
44 | dbg64g
45 |
46 | SRC_FILES = $(addsuffix .cpp,$(SOURCES))
47 | OBJ_FILES = $(addprefix $(PLUGINS_OBJ_DIR)/,$(addsuffix .o,$(SOURCES)))
48 | EXECUTABLE = $(addprefix $(PLUGINS_ELF_DIR)/,cpu_fnc_plugin.so)
49 |
50 | all: $(EXECUTABLE)
51 |
52 | all: $(EXECUTABLE)
53 |
54 | $(EXECUTABLE): $(OBJ_FILES)
55 | echo $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@
56 | $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@ $(addprefix -l,$(LIBS))
57 | $(ECHO) "\n Plugin '"$@"' has been built successfully.\n"
58 |
59 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.cpp
60 | echo $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
61 | $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
62 |
63 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.c
64 | echo $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
65 | $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
66 |
--------------------------------------------------------------------------------
/debugger/makefiles/make_simple_plugin:
--------------------------------------------------------------------------------
1 | ###
2 | ## @file
3 | ## @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | ## @author Sergey Khabarov - sergeykhbr@gmail.com
5 | ##
6 |
7 | include util.mak
8 |
9 | CC=gcc
10 | CPP=gcc
11 | CFLAGS=-g -c -Wall -Werror -fPIC -pthread
12 | LDFLAGS=-shared -pthread -L$(PLUGINS_ELF_DIR)/..
13 | INCL_KEY=-I
14 | DIR_KEY=-B
15 |
16 |
17 | # include sub-folders list
18 | INCL_PATH= \
19 | $(TOP_DIR)src/common
20 |
21 | # source files directories list:
22 | SRC_PATH =\
23 | $(TOP_DIR)src/common \
24 | $(TOP_DIR)src/simple_plugin
25 |
26 | VPATH = $(SRC_PATH)
27 |
28 | SOURCES = \
29 | attribute \
30 | autobuffer \
31 | simple_plugin
32 |
33 | LIBS = \
34 | m \
35 | stdc++ \
36 | dbg64g
37 |
38 | SRC_FILES = $(addsuffix .cpp,$(SOURCES))
39 | OBJ_FILES = $(addprefix $(PLUGINS_OBJ_DIR)/,$(addsuffix .o,$(SOURCES)))
40 | EXECUTABLE = $(addprefix $(PLUGINS_ELF_DIR)/,simple_plugin.so)
41 |
42 | all: $(EXECUTABLE)
43 |
44 | $(EXECUTABLE): $(OBJ_FILES)
45 | echo $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@
46 | $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@ $(addprefix -l,$(LIBS))
47 | $(ECHO) "\n Plugin '"$@"' has been built successfully.\n"
48 |
49 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.cpp
50 | echo $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
51 | $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
52 |
53 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.c
54 | echo $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
55 | $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
56 |
--------------------------------------------------------------------------------
/debugger/makefiles/make_socsim_plugin:
--------------------------------------------------------------------------------
1 | ###
2 | ## @file
3 | ## @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | ## @author Sergey Khabarov - sergeykhbr@gmail.com
5 | ##
6 |
7 | include util.mak
8 |
9 | CC=gcc
10 | CPP=gcc
11 | CFLAGS=-g -c -Wall -Werror -fPIC
12 | LDFLAGS=-shared -L$(PLUGINS_ELF_DIR)/..
13 | INCL_KEY=-I
14 | DIR_KEY=-B
15 |
16 |
17 | # include sub-folders list
18 | INCL_PATH= \
19 | $(TOP_DIR)src/common
20 |
21 | # source files directories list:
22 | SRC_PATH =\
23 | $(TOP_DIR)src/common \
24 | $(TOP_DIR)src/socsim_plugin
25 |
26 | VPATH = $(SRC_PATH)
27 |
28 | SOURCES = \
29 | attribute \
30 | autobuffer \
31 | boardsim \
32 | gnss_stub \
33 | irqctrl \
34 | gpio \
35 | uart \
36 | pnp \
37 | dsu \
38 | greth \
39 | gptimers \
40 | fsev2 \
41 | rfctrl \
42 | uartmst \
43 | plugin_init
44 |
45 | LIBS = \
46 | m \
47 | stdc++ \
48 | dbg64g
49 |
50 | SRC_FILES = $(addsuffix .cpp,$(SOURCES))
51 | OBJ_FILES = $(addprefix $(PLUGINS_OBJ_DIR)/,$(addsuffix .o,$(SOURCES)))
52 | EXECUTABLE = $(addprefix $(PLUGINS_ELF_DIR)/,socsim_plugin.so)
53 |
54 | all: $(EXECUTABLE)
55 |
56 | $(EXECUTABLE): $(OBJ_FILES)
57 | echo $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@
58 | $(CPP) $(LDFLAGS) $(OBJ_FILES) -o $@ $(addprefix -l,$(LIBS))
59 | $(ECHO) "\n Plugin '"$@"' has been built successfully.\n"
60 |
61 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.cpp
62 | echo $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
63 | $(CPP) $(CFLAGS) -std=c++0x $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
64 |
65 | $(addprefix $(PLUGINS_OBJ_DIR)/,%.o): %.c
66 | echo $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
67 | $(CC) $(CFLAGS) -std=c99 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $@
68 |
--------------------------------------------------------------------------------
/debugger/makefiles/util.mak:
--------------------------------------------------------------------------------
1 | ###
2 | ## @file
3 | ## @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | ## @author Sergey Khabarov - sergeykhbr@gmail.com
5 | ##
6 |
7 | # mkdir: -p = --parents. No error if dir exists
8 | # -v = --verbose. print a message for each created directory
9 | MKDIR = mkdir -pv
10 | # rm: -r = --recursive. Remove the contents of dirs recursively
11 | # -v = --verbose. Explain what is being done
12 | # -f = --force.Ignore nonexistent files, never prompt
13 | # --no-preserve-root.
14 | RM = rm -rvf --no-preserve-root
15 |
16 | ECHO = echo
17 |
18 | export MKDIR RM ECHO
19 |
--------------------------------------------------------------------------------
/debugger/msvc13/appdbg64g/appdbg64g.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -c ../../targets/functional_sim_gui.json
5 | WindowsLocalDebugger
6 | PATH=%PATH%;$(QT_PATH)/bin
7 |
8 |
9 | -c ../../targets/functional_sim_gui.json
10 | WindowsLocalDebugger
11 | PATH=%PATH%;$(QT_PATH)/bin
12 |
13 |
14 | -c ../../targets/functional_sim_gui.json
15 | WindowsLocalDebugger
16 | PATH=%PATH%;$(QT_PATH)/bin
17 |
18 |
19 | -nocfg -sim
20 | WindowsLocalDebugger
21 |
22 |
--------------------------------------------------------------------------------
/debugger/msvc13/cpu_fnc_plugin/cpu_fnc_plugin.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/cpu_fnc_plugin/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY cpu_fnc_plugin
2 | EXPORTS
3 | plugin_init
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/cpu_sysc_plugin/cpu_sysc_plugin.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/cpu_sysc_plugin/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY cpu_sysc_plugin
2 | EXPORTS
3 | plugin_init
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/gui_plugin/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY gui_plugin
2 | EXPORTS
3 | plugin_init
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/gui_plugin/gui_plugin.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | WindowsLocalDebugger
7 |
8 |
9 |
10 | WindowsLocalDebugger
11 |
12 |
--------------------------------------------------------------------------------
/debugger/msvc13/gui_plugin/post_build_event.bat:
--------------------------------------------------------------------------------
1 | set GUI_PLUGIN_SRC=..\..\src\gui_plugin
2 | set COPY_TO=%1..
3 |
4 | xcopy %QT_PATH%\plugins\platforms\qwindows.dll %COPY_TO%\platforms\ /F /R /Y /D
5 | xcopy %QT_PATH%\lib\Qt5Core.lib %COPY_TO%\ /F /R /Y /D
6 | xcopy %QT_PATH%\bin\Qt5Core.dll %COPY_TO%\ /F /R /Y /D
7 | xcopy %QT_PATH%\lib\Qt5Gui.lib %COPY_TO%\ /F /R /Y /D
8 | xcopy %QT_PATH%\bin\Qt5Gui.dll %COPY_TO%\ /F /R /Y /D
9 | xcopy %QT_PATH%\lib\Qt5Widgets.lib %COPY_TO%\ /F /R /Y /D
10 | xcopy %QT_PATH%\bin\Qt5Widgets.dll %COPY_TO%\ /F /R /Y /D
11 | xcopy %QT_PATH%\lib\Qt5Network.lib %COPY_TO%\ /F /R /Y /D
12 | xcopy %QT_PATH%\bin\Qt5Network.dll %COPY_TO%\ /F /R /Y /D
13 | xcopy %QT_PATH%\lib\libEGL.lib %COPY_TO%\ /F /R /Y /D
14 | xcopy %QT_PATH%\bin\libEGL.dll %COPY_TO%\ /F /R /Y /D
15 | xcopy %QT_PATH%\bin\icudt*.dll %COPY_TO%\ /F /R /Y /D
16 | xcopy %QT_PATH%\bin\icuin*.dll %COPY_TO%\ /F /R /Y /D
17 | xcopy %QT_PATH%\bin\icuuc*.dll %COPY_TO%\ /F /R /Y /D
18 | xcopy %GUI_PLUGIN_SRC%\resources\gui.rcc %COPY_TO%\resources\ /F /R /Y /D
19 |
20 | @echo off
21 | @echo appdbg64g.exe -c ../../targets/functional_sim_gui.json > %COPY_TO%\_run_functional_sim.bat
22 | @echo appdbg64g.exe -c ../../targets/sysc_river_gui.json > %COPY_TO%\_run_systemc_sim.bat
23 | @echo appdbg64g.exe -c ../../targets/fpga_gui.json > %COPY_TO%\_run_fpga_gui.bat
24 |
--------------------------------------------------------------------------------
/debugger/msvc13/libdbg64g/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY LIBDBG64G
2 | EXPORTS
3 | RISCV_init
4 | RISCV_cleanup
5 | RISCV_read_json_file
6 | RISCV_write_json_file
7 | RISCV_get_configuration
8 | RISCV_set_configuration
9 | RISCV_get_global_settings
10 | RISCV_register_class
11 | RISCV_register_hap
12 | RISCV_trigger_hap
13 | RISCV_get_class
14 | RISCV_create_service
15 | RISCV_get_service
16 | RISCV_get_service_iface
17 | RISCV_generate_name
18 | RISCV_add_default_output
19 | RISCV_remove_default_output
20 | RISCV_sprintf
21 | RISCV_printf
22 | RISCV_print_bin
23 | RISCV_sleep_ms
24 | RISCV_get_time_ms
25 | RISCV_get_pid
26 | RISCV_memory_barrier
27 | RISCV_thread_create
28 | RISCV_thread_id
29 | RISCV_thread_join
30 | RISCV_mutex_init
31 | RISCV_mutex_lock
32 | RISCV_mutex_unlock
33 | RISCV_mutex_destroy
34 | RISCV_event_create
35 | RISCV_event_close
36 | RISCV_event_set
37 | RISCV_event_is_set
38 | RISCV_event_clear
39 | RISCV_event_wait
40 | RISCV_event_wait_ms
41 | RISCV_get_core_folder
42 | RISCV_set_current_dir
43 | RISCV_get_services_with_iface
44 | RISCV_get_clock_services
45 | RISCV_break_simulation
46 | RISCV_malloc
47 | RISCV_free
48 | RISCV_enable_log
49 | RISCV_disable_log
50 | RISCV_dispatcher_start
51 | RISCV_register_timer
52 | RISCV_unregister_timer
53 |
--------------------------------------------------------------------------------
/debugger/msvc13/libdbg64g/libdbg64g.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/simple_plugin/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY simple_plugin
2 | EXPORTS
3 | plugin_init
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/simple_plugin/simple_plugin.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {f5a16e1a-fd0c-436b-9f2e-d8942e1ccf15}
6 |
7 |
8 |
9 |
10 | common
11 |
12 |
13 | common
14 |
15 |
16 |
17 |
18 |
19 | common
20 |
21 |
22 | common
23 |
24 |
25 | common
26 |
27 |
28 | common
29 |
30 |
31 | common
32 |
33 |
34 | common
35 |
36 |
37 | common
38 |
39 |
40 | common
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/debugger/msvc13/simple_plugin/simple_plugin.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/socsim_plugin/exportmap.def:
--------------------------------------------------------------------------------
1 | LIBRARY socsim_plugin
2 | EXPORTS
3 | plugin_init
4 |
--------------------------------------------------------------------------------
/debugger/msvc13/socsim_plugin/socsim_plugin.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/debugger/src/common/async_tqueue.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Asynchronous queue with time markers.
6 | */
7 |
8 | #ifndef __DEBUGGER_ASYNC_TQUEUE_H__
9 | #define __DEBUGGER_ASYNC_TQUEUE_H__
10 |
11 | #include "api_types.h"
12 | #include "iface.h"
13 | #include "attribute.h"
14 |
15 | namespace debugger {
16 |
17 | class AsyncTQueueType {
18 | public:
19 | AsyncTQueueType();
20 | ~AsyncTQueueType();
21 |
22 | /** Thread safe method of the calbacks registration */
23 | void put(uint64_t time, IFace *cb);
24 |
25 | /** push registered to the main queue */
26 | void pushPreQueued();
27 |
28 | /** Reset proccessed counter at the begining of each iteration */
29 | void initProc();
30 |
31 | /**
32 | * Get next registered interface with counter less or equal to 'step_cnt'
33 | */
34 | IFace *getNext(uint64_t step_cnt);
35 |
36 | private:
37 | enum QueueItemNames {
38 | Queue_Time,
39 | Queue_IFace,
40 | Queue_Total
41 | };
42 | AttributeType item_;
43 | AttributeType stepQueue_;
44 | AttributeType stepPreQueued_;
45 | unsigned curIdx_;
46 | unsigned preLen_;
47 | unsigned curLen_; // to avoid reallocation
48 | mutex_def mutex_;
49 | };
50 |
51 | } // namespace debugger
52 |
53 | #endif // __DEBUGGER_ASYNC_TQUEUE_H__
54 |
--------------------------------------------------------------------------------
/debugger/src/common/autobuffer.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Dynamically allocated buffer implementation.
6 | */
7 |
8 | #include "api_core.h"
9 | #include "autobuffer.h"
10 | #include
11 | #include // memcpy definition
12 |
13 | namespace debugger {
14 |
15 | AutoBuffer::AutoBuffer() {
16 | buf_ = NULL;
17 | buf_len_ = 0;
18 | buf_size_ = 0;
19 | }
20 |
21 | AutoBuffer::~AutoBuffer() {
22 | if (buf_) {
23 | delete [] buf_;
24 | }
25 | }
26 |
27 | void AutoBuffer::write_bin(const char *p, int sz) {
28 | if (buf_len_ + sz >= buf_size_) {
29 | if (buf_size_ == 0) {
30 | buf_size_ = 1024;
31 | buf_ = new char[buf_size_];
32 | } else {
33 | while (buf_len_ + sz >= buf_size_) {
34 | buf_size_ <<= 1;
35 | }
36 | char *t1 = new char[buf_size_];
37 | memcpy(t1, buf_, buf_len_);
38 | delete [] buf_;
39 | buf_ = t1;
40 | }
41 | }
42 | memcpy(&buf_[buf_len_], p, sz);
43 | buf_len_ += sz;
44 | buf_[buf_len_] = '\0';
45 | }
46 |
47 | void AutoBuffer::write_string(const char s) {
48 | write_bin(&s, 1);
49 | }
50 |
51 | void AutoBuffer::write_string(const char *s) {
52 | write_bin(s, static_cast(strlen(s)));
53 | }
54 |
55 | void AutoBuffer::write_uint64(uint64_t v) {
56 | char tmp[128];
57 | int sz = RISCV_sprintf(tmp, sizeof(tmp),"0x%" RV_PRI64 "x", v);
58 | write_bin(tmp, sz);
59 | }
60 |
61 | void AutoBuffer::write_byte(uint8_t v) {
62 | char tmp[8];
63 | int sz = RISCV_sprintf(tmp, sizeof(tmp), "%02X", v);
64 | write_bin(tmp, sz);
65 | }
66 |
67 | } // namespace debugger
68 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/ibus.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief System with Bus Direct Memory Access interface.
6 | * @details Blocking and non-blocking transactions are supported.
7 | */
8 |
9 | #ifndef __DEBUGGER_IBUS_PLUGIN_H__
10 | #define __DEBUGGER_IBUS_PLUGIN_H__
11 |
12 | #include "iface.h"
13 | #include
14 | #include "imemop.h"
15 |
16 | namespace debugger {
17 |
18 | static const char *const IFACE_BUS = "IBus";
19 |
20 | enum ETransStatus {
21 | TRANS_OK,
22 | TRANS_ERROR
23 | };
24 |
25 | struct BusUtilType {
26 | uint64_t w_cnt;
27 | uint64_t r_cnt;
28 | };
29 |
30 | /**
31 | * Bus interface
32 | */
33 | class IBus : public IFace {
34 | public:
35 | IBus() : IFace(IFACE_BUS) {}
36 |
37 | virtual void map(IMemoryOperation *imemop) =0;
38 |
39 | /**
40 | * Blocking transaction. It is used for functional modeling of devices.
41 | */
42 | virtual ETransStatus b_transport(Axi4TransactionType *trans) =0;
43 |
44 | /**
45 | * Non-blocking transaction. Is is used to interract with SystemC models.
46 | * Usage with a functional models is also possible.
47 | */
48 | virtual ETransStatus nb_transport(Axi4TransactionType *trans,
49 | IAxi4NbResponse *cb) =0;
50 |
51 | /**
52 | * This method emulates connection between bus controller and DSU module.
53 | * It allows to read bus utilization statistic via mapped DSU registers.
54 | */
55 | virtual BusUtilType *bus_utilization() =0;
56 | };
57 |
58 | } // namespace debugger
59 |
60 | #endif // __DEBUGGER_IBUS_PLUGIN_H__
61 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/iclklistener.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Clock listener interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_PLUGIN_ICLOCK_LISTENER_H__
9 | #define __DEBUGGER_PLUGIN_ICLOCK_LISTENER_H__
10 |
11 | #include "iface.h"
12 | #include
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_CLOCK_LISTENER = "IClockListener";
17 |
18 | class IClockListener : public IFace {
19 | public:
20 | IClockListener() : IFace(IFACE_CLOCK_LISTENER) {}
21 |
22 | virtual void stepCallback(uint64_t t) =0;
23 | };
24 |
25 | } // namespace debugger
26 |
27 | #endif // __DEBUGGER_PLUGIN_ICLOCK_LISTENER_H__
28 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/iclock.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Clock interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_PLUGIN_ICLOCK_H__
9 | #define __DEBUGGER_PLUGIN_ICLOCK_H__
10 |
11 | #include "iface.h"
12 | #include
13 | #include "iclklistener.h"
14 | #include "attribute.h"
15 |
16 | namespace debugger {
17 |
18 | static const char *const IFACE_CLOCK = "IClock";
19 |
20 | class IClock : public IFace {
21 | public:
22 | IClock() : IFace(IFACE_CLOCK) {}
23 |
24 | virtual uint64_t getStepCounter() =0;
25 |
26 | /** Executed instruction counter.
27 | *
28 | * One executed instruction = 1 step for functional simulation.
29 | * And it can be more than 1 for precise SystemC model if enabled
30 | * GENERATE_CORE_TRACE.
31 | */
32 | virtual void registerStepCallback(IClockListener *cb, uint64_t t) =0;
33 | };
34 |
35 | } // namespace debugger
36 |
37 | #endif // __DEBUGGER_PLUGIN_ICLOCK_H__
38 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/icmdexec.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Command executer's interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_ICMDEXEC_H__
9 | #define __DEBUGGER_ICMDEXEC_H__
10 |
11 | #include "iface.h"
12 | #include "attribute.h"
13 | #include "icommand.h"
14 |
15 | namespace debugger {
16 |
17 | static const char *IFACE_CMD_EXECUTOR = "ICmdExecutor";
18 |
19 | class ICmdExecutor : public IFace {
20 | public:
21 | ICmdExecutor() : IFace(IFACE_CMD_EXECUTOR) {}
22 |
23 | /** Register command with ICommand interface */
24 | virtual void registerCommand(ICommand *icmd) =0;
25 | virtual void unregisterCommand(ICommand *icmd) =0;
26 |
27 | /** Execute string as a command */
28 | virtual void exec(const char *line, AttributeType *res, bool silent) =0;
29 |
30 | /** Get list of supported comands starting with substring 'substr' */
31 | virtual void commands(const char *substr, AttributeType *res) =0;
32 | };
33 |
34 | } // namespace debugger
35 |
36 | #endif // __DEBUGGER_ICMDEXEC_H__
37 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/icommand.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief User's command interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_ICOMMAND_H__
9 | #define __DEBUGGER_ICOMMAND_H__
10 |
11 | #include "iface.h"
12 | #include "attribute.h"
13 | #include "coreservices/itap.h"
14 | #include "coreservices/isocinfo.h"
15 |
16 |
17 | namespace debugger {
18 |
19 | static const char *IFACE_COMMAND = "ICommand";
20 |
21 | static const bool CMD_VALID = true;
22 | static const bool CMD_INVALID = false;
23 |
24 | class ICommand : public IFace {
25 | public:
26 | ICommand(const char *name, ITap *tap, ISocInfo *info)
27 | : IFace(IFACE_COMMAND) {
28 | cmdName_.make_string(name);
29 | tap_ = tap;
30 | info_ = info;
31 | }
32 | virtual ~ICommand() {}
33 |
34 | virtual const char *cmdName() { return cmdName_.to_string(); }
35 | virtual const char *briefDescr() { return briefDescr_.to_string(); }
36 | virtual const char *detailedDescr() { return detailedDescr_.to_string(); }
37 |
38 | virtual bool isValid(AttributeType *args) =0;
39 | virtual void exec(AttributeType *args, AttributeType *res) =0;
40 |
41 | virtual void generateError(AttributeType *res, const char *descr) {
42 | res->make_list(3);
43 | (*res)[0u].make_string("ERROR");
44 | (*res)[1].make_string(cmdName_.to_string());
45 | (*res)[2].make_string(descr);
46 | }
47 |
48 | protected:
49 | AttributeType cmdName_;
50 | AttributeType briefDescr_;
51 | AttributeType detailedDescr_;
52 | ITap *tap_;
53 | ISocInfo *info_;
54 | };
55 |
56 | } // namespace debugger
57 |
58 | #endif // __DEBUGGER_ICOMMAND_H__
59 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/icpuriscv.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief RISC-V simulating CPU interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOCSIM_PLUGIN_CPU_RISCV_H__
9 | #define __DEBUGGER_SOCSIM_PLUGIN_CPU_RISCV_H__
10 |
11 | #include "iface.h"
12 | #include
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_CPU_RISCV = "ICpuRiscV";
17 | static const char *const IFACE_DBG_NB_RESPONSE = "IDbgNbResponse";
18 |
19 | static const uint64_t REG_INVALID = ~0;
20 | /** Signal types */
21 | static const int CPU_SIGNAL_RESET = 0;
22 | static const int CPU_SIGNAL_EXT_IRQ = 1;
23 |
24 | struct DebugPortTransactionType {
25 | bool write;
26 | uint8_t region;
27 | uint16_t addr;
28 | uint64_t wdata;
29 | uint64_t rdata;
30 | };
31 |
32 | class IDbgNbResponse : public IFace {
33 | public:
34 | IDbgNbResponse() : IFace(IFACE_DBG_NB_RESPONSE) {}
35 |
36 | virtual void nb_response_debug_port(DebugPortTransactionType *trans) =0;
37 | };
38 |
39 |
40 | class ICpuRiscV : public IFace {
41 | public:
42 | ICpuRiscV() : IFace(IFACE_CPU_RISCV) {}
43 |
44 | virtual void raiseSignal(int idx) =0;
45 | virtual void lowerSignal(int idx) =0;
46 | virtual void nb_transport_debug_port(DebugPortTransactionType *trans,
47 | IDbgNbResponse *cb) =0;
48 | };
49 |
50 | } // namespace debugger
51 |
52 | #endif // __DEBUGGER_SOCSIM_PLUGIN_CPU_RISCV_H__
53 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/ielfreader.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Interface of elf-file reader.
6 | */
7 |
8 | #ifndef __DEBUGGER_ELFREADER_H__
9 | #define __DEBUGGER_ELFREADER_H__
10 |
11 | #include
12 | #include "iface.h"
13 | #include "attribute.h"
14 |
15 | namespace debugger {
16 |
17 | static const char *const IFACE_ELFREADER = "IElfReader";
18 |
19 | enum ESymbolType {
20 | SYMBOL_TYPE_FILE = 0x01,
21 | SYMBOL_TYPE_FUNCTION = 0x02,
22 | SYMBOL_TYPE_DATA = 0x04
23 | };
24 |
25 | enum ESymbolInfoListItem {
26 | Symbol_Name,
27 | Symbol_Addr,
28 | Symbol_Size,
29 | Symbol_Type,
30 | Symbol_Total
31 | };
32 |
33 |
34 | class IElfReader : public IFace {
35 | public:
36 | IElfReader() : IFace(IFACE_ELFREADER) {}
37 |
38 | virtual int readFile(const char *filename) =0;
39 |
40 | virtual unsigned loadableSectionTotal() =0;
41 |
42 | virtual const char *sectionName(unsigned idx) =0;
43 |
44 | virtual uint64_t sectionAddress(unsigned idx) =0;
45 |
46 | virtual uint64_t sectionSize(unsigned idx) =0;
47 |
48 | virtual uint8_t *sectionData(unsigned idx) =0;
49 |
50 | virtual void getSymbols(AttributeType *list) =0;
51 |
52 | virtual void addressToSymbol(uint64_t addr, AttributeType *info) =0;
53 | };
54 |
55 | } // namespace debugger
56 |
57 | #endif // __DEBUGGER_ELFREADER_H__
58 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/ikeylistener.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Keyboard events listener interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_IKEYLISTENER_H__
9 | #define __DEBUGGER_IKEYLISTENER_H__
10 |
11 | #include "iface.h"
12 |
13 | namespace debugger {
14 |
15 | static const char *IFACE_KEY_LISTENER = "IKeyListener";
16 |
17 | class IKeyListener : public IFace {
18 | public:
19 | IKeyListener() : IFace(IFACE_KEY_LISTENER) {}
20 |
21 | virtual int keyDown(int value) =0;
22 | virtual int keyUp(int value) =0;
23 | };
24 |
25 | } // namespace debugger
26 |
27 | #endif // __DEBUGGER_IKEYLISTENER_H__
28 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/ilink.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Link interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_ILINK_H__
9 | #define __DEBUGGER_ILINK_H__
10 |
11 | #include "iface.h"
12 | #include "irawlistener.h"
13 | #include "attribute.h"
14 |
15 | namespace debugger {
16 |
17 | static const char *const IFACE_LINK = "ILink";
18 |
19 | class ILink : public IFace {
20 | public:
21 | ILink() : IFace(IFACE_LINK) {}
22 |
23 | /** Get opened socket connection settings. */
24 | virtual void getConnectionSettings(AttributeType *settings) =0;
25 |
26 | /** Setup remote host settings */
27 | virtual void setConnectionSettings(const AttributeType *target) =0;
28 |
29 | /** Send datagram buffer. */
30 | virtual int sendData(const uint8_t *msg, int len) =0;
31 |
32 | /** Read datagram buffer. */
33 | virtual int readData(const uint8_t *buf, int maxlen) =0;
34 | };
35 |
36 | } // namespace debugger
37 |
38 | #endif // __DEBUGGER_ILINK_H__
39 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/irawlistener.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Raw Data listener interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_IRAW_LISTENER_H__
9 | #define __DEBUGGER_IRAW_LISTENER_H__
10 |
11 | #include "iface.h"
12 |
13 | namespace debugger {
14 |
15 | static const char *IFACE_RAW_LISTENER = "IRawListener";
16 |
17 | class IRawListener : public IFace {
18 | public:
19 | IRawListener() : IFace(IFACE_RAW_LISTENER) {}
20 |
21 | virtual void updateData(const char *buf, int buflen) =0;
22 | };
23 |
24 | } // namespace debugger
25 |
26 | #endif // __DEBUGGER_IRAW_LISTENER_H__
27 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/iserial.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Serial Interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_ISERIAL_H__
9 | #define __DEBUGGER_ISERIAL_H__
10 |
11 | #include "iface.h"
12 |
13 | namespace debugger {
14 |
15 | static const char *IFACE_SERIAL = "ISerial";
16 |
17 | class ISerial : public IFace {
18 | public:
19 | ISerial() : IFace(IFACE_SERIAL) {}
20 |
21 | /**
22 | * @brief Write data buffer from external module.
23 | * @return Number of written bytes.
24 | */
25 | virtual int writeData(const char *buf, int sz) =0;
26 |
27 | virtual void registerRawListener(IFace *listener) =0;
28 | virtual void unregisterRawListener(IFace *listener) =0;
29 | };
30 |
31 | } // namespace debugger
32 |
33 | #endif // __DEBUGGER_ISERIAL_H__
34 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/isignal.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Signal Interface declaration.
6 | *
7 | * This interface corresponds to a IO-pin or a group of pins.
8 | */
9 |
10 | #ifndef __DEBUGGER_ISIGNAL_H__
11 | #define __DEBUGGER_ISIGNAL_H__
12 |
13 | #include "iface.h"
14 | #include
15 |
16 | namespace debugger {
17 |
18 | static const char *IFACE_SIGNAL = "ISignal";
19 |
20 | class ISignal : public IFace {
21 | public:
22 | ISignal() : IFace(IFACE_SIGNAL) {}
23 |
24 | /**
25 | * @brief Assign new value from an external module.
26 | * @param[in] start Index of the start pin to change.
27 | * @param[in] width Total number of pins to change.
28 | * @param[in] value New value that will be written to pins.
29 | */
30 | virtual void setLevel(int start, int width, uint64_t value) =0;
31 |
32 | /**
33 | * @brief Register listener of signal changing.
34 | */
35 | virtual void registerSignalListener(IFace *listener) =0;
36 |
37 | /**
38 | * @brief Unregister listener.
39 | */
40 | virtual void unregisterSignalListener(IFace *listener) =0;
41 | };
42 |
43 | } // namespace debugger
44 |
45 | #endif // __DEBUGGER_ISIGNAL_H__
46 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/isignallistener.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Signal listener interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_ISIGNAL_LISTENER_H__
9 | #define __DEBUGGER_ISIGNAL_LISTENER_H__
10 |
11 | #include "iface.h"
12 | #include
13 |
14 | namespace debugger {
15 |
16 | static const char *IFACE_SIGNAL_LISTENER = "ISignalListener";
17 |
18 | class ISignalListener : public IFace {
19 | public:
20 | ISignalListener() : IFace(IFACE_SIGNAL_LISTENER) {}
21 |
22 | /**
23 | * @brief Levels of the specified pins were changed.
24 | * @param[in] start Index of the start pin to change.
25 | * @param[in] width Total number of pins to change.
26 | * @param[in] value New value that will be written to pins.
27 | */
28 | virtual void updateSignal(int start, int width, uint64_t value) =0;
29 | };
30 |
31 | } // namespace debugger
32 |
33 | #endif // __DEBUGGER_ISIGNAL_LISTENER_H__
34 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/itap.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief General interface of the hardware access.
6 | */
7 |
8 | #ifndef __DEBUGGER_ITAP_H__
9 | #define __DEBUGGER_ITAP_H__
10 |
11 | #include "iface.h"
12 | #include "attribute.h"
13 | #include
14 |
15 | namespace debugger {
16 |
17 | static const char *const IFACE_TAP = "ITap";
18 |
19 | static const char *const ITap_brief =
20 | "Test Access Point (TAP) software interface.";
21 |
22 | static const char *const ITap_detail =
23 | "This interface is used for the direct access to the Hardware. "
24 | "Typically, it is doing via JTAG or other transport interface.";
25 |
26 | static const int TAP_ERROR = -1;
27 |
28 | class ITap : public IFace {
29 | public:
30 | ITap() : IFace(IFACE_TAP) {}
31 |
32 | virtual const char *getBrief() { return ITap_brief; }
33 |
34 | virtual const char *getDetail() { return ITap_detail; }
35 |
36 | virtual int read(uint64_t addr, int bytes, uint8_t *obuf) =0;
37 | virtual int write(uint64_t addr, int bytes, uint8_t *ibuf) =0;
38 | };
39 |
40 | } // namespace debugger
41 |
42 | #endif // __DEBUGGER_ITAP_H__
43 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/ithread.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Thread interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_ITHREAD_H__
9 | #define __DEBUGGER_ITHREAD_H__
10 |
11 | #include "iface.h"
12 | #include "api_core.h"
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_THREAD = "IThread";
17 |
18 | class IThread : public IFace {
19 | public:
20 | IThread() : IFace(IFACE_THREAD) {
21 | AttributeType t1;
22 | RISCV_generate_name(&t1);
23 | RISCV_event_create(&loopEnable_, t1.to_string());
24 | threadInit_.Handle = 0;
25 | }
26 |
27 | /** create and start seperate thread */
28 | virtual bool run() {
29 | threadInit_.func = reinterpret_cast(runThread);
30 | threadInit_.args = this;
31 | RISCV_thread_create(&threadInit_);
32 |
33 | if (threadInit_.Handle) {
34 | RISCV_event_set(&loopEnable_);
35 | }
36 | return loopEnable_.state;
37 | }
38 |
39 | /** @brief Stop and join thread */
40 | virtual void stop() {
41 | RISCV_event_clear(&loopEnable_);
42 | if (threadInit_.Handle) {
43 | RISCV_thread_join(threadInit_.Handle, 50000);
44 | }
45 | threadInit_.Handle = 0;
46 | }
47 |
48 | /** check thread status */
49 | virtual bool isEnabled() { return loopEnable_.state; }
50 |
51 | protected:
52 | /** working cycle function */
53 | virtual void busyLoop() =0;
54 |
55 | static void runThread(void *arg) {
56 | reinterpret_cast(arg)->busyLoop();
57 | }
58 |
59 | protected:
60 | event_def loopEnable_;
61 | LibThreadType threadInit_;
62 | };
63 |
64 | } // namespace debugger
65 |
66 | #endif // __DEBUGGER_ITHREAD_H__
67 |
--------------------------------------------------------------------------------
/debugger/src/common/coreservices/iwire.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Single wire interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_PLUGIN_IWIRE_H__
9 | #define __DEBUGGER_PLUGIN_IWIRE_H__
10 |
11 | #include "iface.h"
12 | #include
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_WIRE = "IWire";
17 |
18 | class IWire : public IFace {
19 | public:
20 | IWire() : IFace(IFACE_WIRE) {}
21 |
22 | virtual void raiseLine(int idx) =0;
23 | virtual void lowerLine() =0;
24 | virtual void setLevel(bool level) =0;
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_PLUGIN_IWIRE_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/common/iattr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Core Attribute interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_IATTRIBUTE_H__
9 | #define __DEBUGGER_IATTRIBUTE_H__
10 |
11 | #include "iface.h"
12 |
13 | namespace debugger {
14 |
15 | static const char *const IFACE_ATTRIBUTE = "IAttribute";
16 |
17 | class IAttribute : public IFace {
18 | public:
19 | IAttribute() : IFace(IFACE_ATTRIBUTE), attr_name_ (NULL) {}
20 |
21 | virtual void setAttrName(const char *name) { attr_name_ = name; }
22 |
23 | virtual const char *getAttrName() { return attr_name_; }
24 |
25 | virtual void setAttrDescription(const char *descr) { attr_descr_ = descr; }
26 |
27 | virtual const char *getAttrDescription() { return attr_descr_; }
28 |
29 | protected:
30 | const char *attr_name_;
31 | const char *attr_descr_;
32 | };
33 |
34 | } // namespace debugger
35 |
36 | #endif // __DEBUGGER_IATTRIBUTE_H__
37 |
--------------------------------------------------------------------------------
/debugger/src/common/iface.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Base interface declaration of the Core.
6 | */
7 |
8 | #ifndef __DEBUGGER_IFACE_H__
9 | #define __DEBUGGER_IFACE_H__
10 |
11 | namespace debugger {
12 |
13 | class IFace {
14 | public:
15 | IFace(const char *name) : ifname_(name) {}
16 | virtual ~IFace() {}
17 |
18 | /** Get brief information. */
19 | virtual const char *getBrief() { return "Brief info not defined"; }
20 |
21 | /** Get detailed description. */
22 | virtual const char *getDetail() { return "Detail info not defined"; }
23 |
24 | /** Get interface name. */
25 | const char *getFaceName() { return ifname_; }
26 |
27 | protected:
28 | const char *ifname_;
29 | };
30 |
31 | } // namespace debugger
32 |
33 | #endif // __DEBUGGER_IFACE_H__
34 |
--------------------------------------------------------------------------------
/debugger/src/common/ihap.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Hap interface declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_IHAP_H__
9 | #define __DEBUGGER_IHAP_H__
10 |
11 | #include "iface.h"
12 | #include
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_HAP = "IHap";
17 |
18 | enum EHapType {
19 | HAP_All,
20 | HAP_ConfigDone,
21 | HAP_BreakSimulation
22 | };
23 |
24 | class IHap : public IFace {
25 | public:
26 | IHap(EHapType type = HAP_All) : IFace(IFACE_HAP), type_(type) {}
27 |
28 | EHapType getType() { return type_; }
29 |
30 | virtual void hapTriggered(IFace *isrc, EHapType type,
31 | const char *descr) =0;
32 |
33 | protected:
34 | EHapType type_;
35 | };
36 |
37 | } // namespace debugger
38 |
39 | #endif // __DEBUGGER_IHAP_H__
40 |
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/cpu_riscv_func.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/cpu_fnc_plugin/cpu_riscv_func.cpp
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/iinstr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Base interface declaration of the Core.
6 | */
7 |
8 | #ifndef __DEBUGGER_IINSTRUCTION_H__
9 | #define __DEBUGGER_IINSTRUCTION_H__
10 |
11 | #include
12 | #include
13 | #include "riscv-isa.h"
14 | #include "coreservices/ibus.h"
15 | #include "coreservices/isocinfo.h"
16 |
17 | namespace debugger {
18 |
19 | static const int STACK_TRACE_BUF_SIZE = 256;
20 |
21 | struct CpuContextType {
22 | uint64_t regs[Reg_Total];
23 | uint64_t csr[1<<12];
24 | uint64_t pc;
25 | uint64_t npc;
26 | uint64_t exception;
27 | uint64_t interrupt;
28 | uint64_t interrupt_pending;
29 | uint64_t step_cnt;
30 | uint64_t cur_prv_level;
31 | DsuMapType::udbg_type::debug_region_type::breakpoint_control_reg br_ctrl;
32 | bool br_status_ena; // show breakpoint bit in common status register
33 | bool br_inject_fetch;
34 | uint64_t br_address_fetch;
35 | uint32_t br_instr_fetch;
36 | bool reset;
37 | IBus *ibus;
38 | char disasm[256];
39 | std::ofstream *reg_trace_file;
40 | std::ofstream *mem_trace_file;
41 | uint64_t stack_trace_buf[STACK_TRACE_BUF_SIZE]; // [[from,to],*]
42 | int stack_trace_cnt;
43 | };
44 |
45 |
46 | static const char *const IFACE_INSTRUCTION = "IInstruction";
47 |
48 | class IInstruction : public IFace {
49 | public:
50 | IInstruction() : IFace(IFACE_INSTRUCTION) {}
51 |
52 | virtual const char *name() =0;
53 | virtual bool parse(uint32_t *payload) =0;
54 | virtual void exec(uint32_t *payload, CpuContextType *regs) =0;
55 | virtual uint32_t hash() =0;
56 | };
57 |
58 | } // namespace debugger
59 |
60 | #endif // __DEBUGGER_IINSTRUCTION_H__
61 |
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/instructions.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Instruction types parser.
6 | */
7 |
8 | #include "api_utils.h"
9 | #include "riscv-isa.h"
10 | #include "instructions.h"
11 |
12 | namespace debugger {
13 |
14 | unsigned addSupportedInstruction(IsaProcessor *instr, AttributeType *out) {
15 | AttributeType tmp(instr);
16 | out[instr->hash()].add_to_list(&tmp);
17 | return 0;
18 | }
19 |
20 | } // namespace debugger
21 |
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/instructions.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Instruction object declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_CPU_RISCV_INSTRUCTIONS_H__
9 | #define __DEBUGGER_CPU_RISCV_INSTRUCTIONS_H__
10 |
11 | #include
12 | #include "iface.h"
13 | #include "attribute.h"
14 | #include "iinstr.h"
15 |
16 | namespace debugger {
17 |
18 | class IsaProcessor : public IInstruction {
19 | public:
20 | IsaProcessor(const char *name, const char *bits) {
21 | name_ = name;
22 | mask_ = 0;
23 | opcode_ = 0;
24 | for (int i = 0; i < 32; i++) {
25 | switch (bits[i]) {
26 | case '0':
27 | break;
28 | case '1':
29 | opcode_ |= (1 << (31 - i));
30 | break;
31 | case '?':
32 | mask_ |= (1 << (31 - i));
33 | break;
34 | default:;
35 | }
36 | }
37 | mask_ ^= ~0;
38 | }
39 |
40 | // IInstruction interface:
41 | virtual const char *name() { return name_; }
42 |
43 | virtual bool parse(uint32_t *payload) {
44 | return ((payload[0] & mask_) == opcode_);
45 | }
46 |
47 | virtual void exec(uint32_t *payload, CpuContextType *regs) =0;
48 |
49 | virtual uint32_t hash() {
50 | return (opcode_ >> 2) & 0x1F;
51 | }
52 |
53 | protected:
54 | const char *name_;
55 | uint32_t mask_;
56 | uint32_t opcode_;
57 | };
58 |
59 | unsigned addSupportedInstruction(IsaProcessor *instr, AttributeType *out);
60 |
61 | } // namespace debugger
62 |
63 | #endif // __DEBUGGER_CPU_RISCV_INSTRUCTIONS_H__
64 |
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/plugin_init.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Plugin library initialization method.
6 | */
7 |
8 | #include "cpu_riscv_func.h"
9 |
10 | namespace debugger {
11 |
12 | extern "C" void plugin_init(void) {
13 | REGISTER_CLASS(CpuRiscV_Functional);
14 | }
15 |
16 | } // namespace debugger
17 |
--------------------------------------------------------------------------------
/debugger/src/cpu_fnc_plugin/riscv-rv64i-user.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/cpu_fnc_plugin/riscv-rv64i-user.cpp
--------------------------------------------------------------------------------
/debugger/src/cpu_sysc_plugin/plugin_init.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Plugin library initialization method.
6 | */
7 |
8 | #include "cpu_riscv_rtl.h"
9 |
10 | namespace debugger {
11 |
12 | extern "C" void plugin_init(void) {
13 | REGISTER_CLASS(CpuRiscV_RTL);
14 | }
15 |
16 | } // namespace debugger
17 |
--------------------------------------------------------------------------------
/debugger/src/cpu_sysc_plugin/riverlib/core/arith/shift.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Left/Right shifter arithmetic/logic 32/64 bits.
6 | *
7 | * @details Vivado synthesizer (2016.2) doesn't support shift
8 | * from dynamic value, so implement this mux.
9 | */
10 |
11 | #ifndef __DEBUGGER_RIVERLIB_RSHIFT_H__
12 | #define __DEBUGGER_RIVERLIB_RSHIFT_H__
13 |
14 | #include
15 | #include "../../river_cfg.h"
16 |
17 | namespace debugger {
18 |
19 | SC_MODULE(Shifter) {
20 | sc_in> i_a1; // Operand 1
21 | sc_in> i_a2; // Shift bits number
22 | sc_out> o_sll; // Logical shift left 64-bits operand
23 | sc_out> o_sllw; // Logical shift left 32-bits operand
24 | sc_out> o_srl; // Logical shift 64 bits
25 | sc_out> o_sra; // Arith. shift 64 bits
26 | sc_out> o_srlw; // Logical shift 32 bits
27 | sc_out> o_sraw; // Arith. shift 32 bits
28 |
29 | void comb();
30 |
31 | SC_HAS_PROCESS(Shifter);
32 |
33 | Shifter(sc_module_name name_);
34 |
35 | void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
36 |
37 | private:
38 | };
39 |
40 |
41 | } // namespace debugger
42 |
43 | #endif // __DEBUGGER_RIVERLIB_RSHIFT_H__
44 |
--------------------------------------------------------------------------------
/debugger/src/cpu_sysc_plugin/riverlib/core/br_predic.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Branch predictor.
6 | */
7 |
8 | #ifndef __DEBUGGER_RIVERLIB_BR_PREDIC_H__
9 | #define __DEBUGGER_RIVERLIB_BR_PREDIC_H__
10 |
11 | #include
12 | #include "../river_cfg.h"
13 |
14 | namespace debugger {
15 |
16 | SC_MODULE(BranchPredictor) {
17 | sc_in i_clk; // CPU clock
18 | sc_in i_nrst; // Reset. Active LOW.
19 | sc_in i_req_mem_fire; // Memory request was accepted
20 | sc_in i_resp_mem_valid; // Memory response from ICache is valid
21 | sc_in> i_resp_mem_addr; // Memory response address
22 | sc_in> i_resp_mem_data; // Memory response value
23 | sc_in i_f_predic_miss; // Fetch modul detects deviation between predicted and valid pc.
24 | sc_in> i_e_npc; // Valid instruction value awaited by 'Executor'
25 | sc_in> i_ra; // Return address register value
26 | sc_out> o_npc_predict; // Predicted next instruction address
27 |
28 | void comb();
29 | void registers();
30 |
31 | SC_HAS_PROCESS(BranchPredictor);
32 |
33 | BranchPredictor(sc_module_name name_);
34 |
35 | void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
36 |
37 | private:
38 | struct RegistersType {
39 | sc_signal> npc;
40 | } v, r;
41 | sc_signal> wb_npc;
42 | };
43 |
44 |
45 | } // namespace debugger
46 |
47 | #endif // __DEBUGGER_RIVERLIB_BR_PREDIC_H__
48 |
--------------------------------------------------------------------------------
/debugger/src/cpu_sysc_plugin/riverlib/core/stacktrbuf.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Stack trace buffer on hardware level.
6 | */
7 |
8 | #include "stacktrbuf.h"
9 |
10 | namespace debugger {
11 |
12 | StackTraceBuffer::StackTraceBuffer(sc_module_name name_) : sc_module(name_) {
13 | SC_METHOD(comb);
14 | sensitive << i_raddr;
15 | sensitive << i_we;
16 | sensitive << i_waddr;
17 | sensitive << i_wdata;
18 | sensitive << raddr;
19 |
20 | SC_METHOD(registers);
21 | sensitive << i_clk.pos();
22 | };
23 |
24 | void StackTraceBuffer::generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd) {
25 | }
26 |
27 | void StackTraceBuffer::comb() {
28 | o_rdata = stackbuf[raddr.read()];
29 | }
30 |
31 | void StackTraceBuffer::registers() {
32 | if (i_we.read()) {
33 | stackbuf[i_waddr.read()] = i_wdata;
34 | }
35 | raddr = i_raddr.read();
36 | }
37 |
38 | } // namespace debugger
39 |
40 |
--------------------------------------------------------------------------------
/debugger/src/cpu_sysc_plugin/riverlib/core/stacktrbuf.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Stack trace buffer on hardware level.
6 | */
7 |
8 | #ifndef __DEBUGGER_RIVERLIB_STACKTRBUF_H__
9 | #define __DEBUGGER_RIVERLIB_STACKTRBUF_H__
10 |
11 | #include
12 | #include "../river_cfg.h"
13 |
14 | namespace debugger {
15 |
16 | SC_MODULE(StackTraceBuffer) {
17 | sc_in i_clk;
18 | sc_in> i_raddr; // todo: log2(CFG_STACK_TRACE_BUF_SIZE)
19 | sc_out> o_rdata;
20 | sc_in i_we;
21 | sc_in> i_waddr; // todo: log2(CFG_STACK_TRACE_BUF_SIZE)
22 | sc_in> i_wdata;
23 |
24 | void comb();
25 | void registers();
26 |
27 | SC_HAS_PROCESS(StackTraceBuffer);
28 |
29 | StackTraceBuffer(sc_module_name name_);
30 |
31 | void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
32 |
33 | private:
34 | sc_signal> raddr;
35 | sc_signal> stackbuf[CFG_STACK_TRACE_BUF_SIZE]; // [pc, npc]
36 | };
37 |
38 |
39 | } // namespace debugger
40 |
41 | #endif // __DEBUGGER_RIVERLIB_STACKTRBUF_H__
42 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/ControlWidget/ConsoleWidget.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Serial console emulator.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 | #include "coreservices/iautocomplete.h"
14 | #include "coreservices/irawlistener.h"
15 | #include "coreservices/icmdexec.h"
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | namespace debugger {
22 |
23 | /**
24 | * QPlainTextEdit gives per-line scrolling (but optimized for plain text)
25 | * QTextEdit gives smooth scrolling (line partial move up-down)
26 | */
27 | class ConsoleWidget : public QPlainTextEdit,
28 | public IGuiCmdHandler,
29 | public IRawListener {
30 | Q_OBJECT
31 | public:
32 | ConsoleWidget(IGui *igui, QWidget *parent = 0);
33 | ~ConsoleWidget();
34 |
35 | /** IGuiCmdHandler */
36 | virtual void handleResponse(AttributeType *req, AttributeType *resp);
37 |
38 | // IRawListener
39 | virtual void updateData(const char *buf, int buflen);
40 |
41 | signals:
42 | void signalNewData();
43 | private slots:
44 | void slotUpdateByData();
45 |
46 | protected:
47 | virtual void keyPressEvent(QKeyEvent *e);
48 |
49 | private:
50 | IGui *igui_;
51 | IAutoComplete *iauto_;
52 |
53 | AttributeType cursorPos_;
54 |
55 | int cursorMinPos_;
56 |
57 | wchar_t *wcsConv_;
58 | char *mbsConv_;
59 | int sizeConv_;
60 | mutex_def mutexOutput_;
61 | QString strOutput_;
62 | QFont fontMainText_;
63 | QFont fontRISCV_;
64 | };
65 |
66 | } // namespace debugger
67 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/AsmControl.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Disassembler control panel.
6 | */
7 |
8 | #include "AsmControl.h"
9 | #include "moc_AsmControl.h"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | namespace debugger {
18 |
19 | AsmControl::AsmControl(QWidget *parent)
20 | : QWidget(parent) {
21 | QFont font = QFont("Courier");
22 | font.setStyleHint(QFont::Monospace);
23 | font.setPointSize(8);
24 | font.setFixedPitch(true);
25 | setFont(font);
26 | QFontMetrics fm(font);
27 |
28 | paletteModified_.setColor(QPalette::Base, Qt::yellow);
29 | paletteModified_.setColor(QPalette::Text, Qt::black);
30 |
31 | paletteDefault_.setColor(QPalette::Text, Qt::black);
32 | paletteDefault_.setColor(QPalette::Base, Qt::white);
33 |
34 |
35 | QGridLayout *gridLayout = new QGridLayout(this);
36 | setLayout(gridLayout);
37 |
38 |
39 | QLabel *lbl = new QLabel("Source view:");
40 | gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight);
41 |
42 |
43 | cmd_.make_list(2);
44 | }
45 |
46 | void AsmControl::slotModified() {
47 | }
48 |
49 | void AsmControl::slotUpdate() {
50 | if (!isChanged()) {
51 | return;
52 | }
53 | }
54 |
55 | bool AsmControl::isChanged() {
56 | return true;
57 | }
58 |
59 |
60 | } // namespace debugger
61 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/AsmControl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Disassembler control panel.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 |
14 | #include
15 | #include
16 |
17 |
18 | namespace debugger {
19 |
20 | class AsmControl : public QWidget {
21 | Q_OBJECT
22 | public:
23 | explicit AsmControl(QWidget *parent);
24 |
25 | signals:
26 | void signalAddressChanged(AttributeType *cmd);
27 |
28 | public slots:
29 | void slotModified();
30 | void slotUpdate();
31 |
32 | private:
33 | bool isChanged();
34 |
35 | private:
36 | QLineEdit *editAddr_;
37 | QLineEdit *editBytes_;
38 | QPalette paletteDefault_;
39 | QPalette paletteModified_;
40 | AttributeType cmd_;
41 | };
42 |
43 | } // namespace debugger
44 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/AsmViewWidget.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Disassembler viewer form.
6 | */
7 |
8 | #include "AsmArea.h"
9 | #include "AsmControl.h"
10 | #include "AsmViewWidget.h"
11 | #include "moc_AsmViewWidget.h"
12 |
13 | #include
14 |
15 | namespace debugger {
16 |
17 | AsmViewWidget::AsmViewWidget(IGui *igui, QWidget *parent, uint64_t fixaddr)
18 | : QWidget(parent) {
19 | igui_ = igui;
20 |
21 | gridLayout = new QGridLayout(this);
22 | gridLayout->setSpacing(4);
23 | gridLayout->setHorizontalSpacing(10);
24 | gridLayout->setVerticalSpacing(0);
25 | gridLayout->setContentsMargins(4, 4, 4, 4);
26 | setLayout(gridLayout);
27 |
28 | AsmControl *pctrl = new AsmControl(this);
29 |
30 | AsmArea *parea = new AsmArea(igui, this, fixaddr);
31 | gridLayout->addWidget(pctrl , 0, 0);
32 | gridLayout->addWidget(parea, 1, 0);
33 | gridLayout->setRowStretch(1, 10);
34 |
35 | connect(this, SIGNAL(signalUpdateByTimer()),
36 | parea, SLOT(slotUpdateByTimer()));
37 |
38 | connect(parea, SIGNAL(signalBreakpointsChanged()),
39 | this, SLOT(slotBreakpointsChanged()));
40 |
41 | connect(this, SIGNAL(signalRedrawDisasm()),
42 | parea, SLOT(slotRedrawDisasm()));
43 | }
44 |
45 | } // namespace debugger
46 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/MemArea.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Memory Editor area.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 | #include "coreservices/isocinfo.h"
14 |
15 | #include
16 | #include
17 |
18 | namespace debugger {
19 |
20 | class MemArea : public QPlainTextEdit,
21 | public IGuiCmdHandler {
22 | Q_OBJECT
23 | public:
24 | explicit MemArea(IGui *gui, QWidget *parent, uint64_t addr, uint64_t sz);
25 | virtual ~MemArea();
26 |
27 | /** IGuiCmdHandler */
28 | virtual void handleResponse(AttributeType *req, AttributeType *resp);
29 |
30 | signals:
31 | void signalUpdateData();
32 |
33 | public slots:
34 | void slotAddressChanged(AttributeType *cmd);
35 | void slotUpdateByTimer();
36 | void slotUpdateData();
37 |
38 | private:
39 | void to_string(uint64_t addr, unsigned bytes, AttributeType *out);
40 |
41 | private:
42 | AttributeType cmdRead_;
43 | QString name_;
44 | IGui *igui_;
45 |
46 | AttributeType data_;
47 | AttributeType tmpBuf_;
48 | AttributeType dataText_;
49 |
50 | uint64_t reqAddr_;
51 | unsigned reqBytes_;
52 | uint64_t reqAddrZ_;
53 | unsigned reqBytesZ_;
54 | bool waitingResponse_;
55 | };
56 |
57 | } // namespace debugger
58 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/MemControl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Memory Editor control panel.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 |
14 | #include
15 | #include
16 |
17 |
18 | namespace debugger {
19 |
20 | class MemControl : public QWidget {
21 | Q_OBJECT
22 | public:
23 | explicit MemControl(QWidget *parent, uint64_t addr, uint64_t sz);
24 |
25 | signals:
26 | void signalAddressChanged(AttributeType *cmd);
27 |
28 | public slots:
29 | void slotModified();
30 | void slotUpdate();
31 |
32 | private:
33 | bool isChanged();
34 |
35 | private:
36 | QLineEdit *editAddr_;
37 | QLineEdit *editBytes_;
38 | QPalette paletteDefault_;
39 | QPalette paletteModified_;
40 | AttributeType cmd_;
41 | };
42 |
43 | } // namespace debugger
44 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/MemViewWidget.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Memory editor form.
6 | */
7 |
8 | #include "MemArea.h"
9 | #include "MemControl.h"
10 | #include "MemViewWidget.h"
11 | #include "moc_MemViewWidget.h"
12 |
13 | #include
14 |
15 | namespace debugger {
16 |
17 | MemViewWidget::MemViewWidget(IGui *igui, QWidget *parent,
18 | uint64_t addr, uint64_t sz) : QWidget(parent) {
19 | igui_ = igui;
20 |
21 | gridLayout = new QGridLayout(this);
22 | gridLayout->setSpacing(4);
23 | gridLayout->setHorizontalSpacing(10);
24 | gridLayout->setVerticalSpacing(0);
25 | gridLayout->setContentsMargins(4, 4, 4, 4);
26 | setLayout(gridLayout);
27 |
28 | MemControl *pctrl = new MemControl(this, addr, sz);
29 |
30 | MemArea *parea = new MemArea(igui, this, addr, sz);
31 | gridLayout->addWidget(pctrl , 0, 0);
32 | gridLayout->addWidget(parea, 1, 0);
33 | gridLayout->setRowStretch(1, 10);
34 |
35 | connect(this, SIGNAL(signalUpdateByTimer()),
36 | parea, SLOT(slotUpdateByTimer()));
37 |
38 | connect(pctrl, SIGNAL(signalAddressChanged(AttributeType *)),
39 | parea, SLOT(slotAddressChanged(AttributeType *)));
40 | }
41 |
42 |
43 | void MemViewWidget::slotUpdateByTimer() {
44 | if (!isVisible()) {
45 | return;
46 | }
47 | emit signalUpdateByTimer();
48 | }
49 |
50 | } // namespace debugger
51 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/RegWidget.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief CPU' register editor.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 |
13 | #include
14 | #include
15 |
16 | namespace debugger {
17 |
18 | class RegWidget : public QWidget {
19 | Q_OBJECT
20 | public:
21 | explicit RegWidget(const char *name, QWidget *parent);
22 |
23 | signals:
24 | void signalChanged(AttributeType *req);
25 | private slots:
26 | void slotHandleResponse(AttributeType *resp);
27 | void slotEditingFinished();
28 |
29 | private:
30 | AttributeType regName_;
31 | AttributeType cmdRead_;
32 | AttributeType cmdWrite_;
33 | QString name_;
34 | QLineEdit *edit_;
35 | uint64_t value_;
36 | uint64_t respValue_;
37 | };
38 |
39 | } // namespace debugger
40 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/StackTraceArea.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Stack Trace main area.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 | #include "iservice.h"
14 | #include "coreservices/isocinfo.h"
15 | #include "coreservices/isrccode.h"
16 |
17 | #include
18 | #include
19 |
20 | namespace debugger {
21 |
22 | class StackTraceArea : public QTableWidget,
23 | public IGuiCmdHandler {
24 | Q_OBJECT
25 | public:
26 | explicit StackTraceArea(IGui *gui, QWidget *parent);
27 | virtual ~StackTraceArea();
28 |
29 | /** IGuiCmdHandler */
30 | virtual void handleResponse(AttributeType *req, AttributeType *resp);
31 |
32 | public slots:
33 | void slotUpdateByTimer();
34 | void slotHandleResponse();
35 | void slotCellDoubleClicked(int row, int column);
36 |
37 | signals:
38 | void signalHandleResponse();
39 | void signalShowFunction(uint64_t addr, uint64_t sz);
40 |
41 | private:
42 | void setListSize(int sz);
43 | QString makeSymbolQString(uint64_t addr, AttributeType &info);
44 |
45 | private:
46 | enum EColumnNames {
47 | COL_call_addr,
48 | COL_at_addr,
49 | COL_Total
50 | };
51 |
52 | AttributeType symbolList_;
53 | AttributeType symbolAddr_;
54 | IGui *igui_;
55 | int lineHeight_;
56 | int hideLineIdx_;
57 | };
58 |
59 | } // namespace debugger
60 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/StackTraceWidget.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Stack trace viewer form.
6 | */
7 |
8 | #include "StackTraceArea.h"
9 | #include "StackTraceWidget.h"
10 | #include "moc_StackTraceWidget.h"
11 |
12 | #include
13 |
14 | namespace debugger {
15 |
16 | StackTraceWidget::StackTraceWidget(IGui *igui, QWidget *parent)
17 | : QWidget(parent) {
18 | igui_ = igui;
19 |
20 | gridLayout = new QGridLayout(this);
21 | gridLayout->setSpacing(4);
22 | gridLayout->setHorizontalSpacing(10);
23 | gridLayout->setVerticalSpacing(0);
24 | gridLayout->setContentsMargins(4, 4, 4, 4);
25 | setLayout(gridLayout);
26 |
27 | StackTraceArea *parea = new StackTraceArea(igui, this);
28 | gridLayout->addWidget(parea, 0, 0);
29 | gridLayout->setRowStretch(0, 10);
30 |
31 | connect(this, SIGNAL(signalUpdateByTimer()),
32 | parea, SLOT(slotUpdateByTimer()));
33 |
34 | connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)),
35 | this, SLOT(slotShowFunction(uint64_t, uint64_t)));
36 | }
37 |
38 | } // namespace debugger
39 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/SymbolBrowserArea.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Symbol Browser main area.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 | #include "iservice.h"
14 | #include "coreservices/isocinfo.h"
15 | #include "coreservices/isrccode.h"
16 |
17 | #include
18 | #include
19 |
20 | namespace debugger {
21 |
22 | class SymbolBrowserArea : public QTableWidget,
23 | public IGuiCmdHandler {
24 | Q_OBJECT
25 | public:
26 | explicit SymbolBrowserArea(IGui *gui, QWidget *parent);
27 | virtual ~SymbolBrowserArea();
28 |
29 | /** IGuiCmdHandler */
30 | virtual void handleResponse(AttributeType *req, AttributeType *resp);
31 |
32 | public slots:
33 | void slotCellDoubleClicked(int row, int column);
34 | void slotFilterChanged(const QString &flt);
35 | void slotHandleResponse();
36 |
37 | signals:
38 | void signalHandleResponse();
39 | void signalShowFunction(uint64_t addr, uint64_t sz);
40 | void signalShowData(uint64_t addr, uint64_t sz);
41 |
42 | private:
43 | void setListSize(int sz);
44 |
45 | private:
46 | enum EColumnNames {
47 | COL_symbol,
48 | COL_type,
49 | COL_address,
50 | COL_Total
51 | };
52 |
53 | AttributeType symbolList_;
54 | AttributeType symbolFilter_;
55 | IGui *igui_;
56 | int lineHeight_;
57 | int hideLineIdx_;
58 | };
59 |
60 | } // namespace debugger
61 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/SymbolBrowserControl.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Symbol Browser control panel.
6 | */
7 |
8 | #include "SymbolBrowserControl.h"
9 | #include "moc_SymbolBrowserControl.h"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | namespace debugger {
18 |
19 | SymbolBrowserControl::SymbolBrowserControl(QWidget *parent)
20 | : QWidget(parent) {
21 | QFont font = QFont("Courier");
22 | font.setStyleHint(QFont::Monospace);
23 | font.setPointSize(8);
24 | font.setFixedPitch(true);
25 | setFont(font);
26 | QFontMetrics fm(font);
27 |
28 | paletteDefault_.setColor(QPalette::Text, Qt::black);
29 | paletteDefault_.setColor(QPalette::Base, Qt::white);
30 |
31 |
32 | QGridLayout *gridLayout = new QGridLayout(this);
33 | setLayout(gridLayout);
34 |
35 |
36 | QLabel *lbl = new QLabel("Filter:");
37 | gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight);
38 |
39 | editFilter_ = new QLineEdit(this);
40 | editFilter_->setText(tr("*"));
41 | editFilter_->setFixedWidth(fm.width(tr("*some_test_func*")));
42 | editFilter_->setPalette(paletteDefault_);
43 | gridLayout->addWidget(editFilter_, 0, 1, Qt::AlignLeft);
44 | gridLayout->setColumnStretch(1, 10);
45 |
46 | connect(editFilter_, SIGNAL(returnPressed()),
47 | this, SLOT(slotFilterEditingFinished()));
48 | }
49 |
50 | void SymbolBrowserControl::slotFilterEditingFinished() {
51 | emit signalFilterChanged(editFilter_->text());
52 | }
53 |
54 |
55 |
56 | } // namespace debugger
57 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/SymbolBrowserControl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Symbol Browser control panel.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 |
14 | #include
15 | #include
16 |
17 |
18 | namespace debugger {
19 |
20 | class SymbolBrowserControl : public QWidget {
21 | Q_OBJECT
22 | public:
23 | explicit SymbolBrowserControl(QWidget *parent);
24 |
25 | signals:
26 | void signalFilterChanged(const QString &flt);
27 |
28 | public slots:
29 | void slotFilterEditingFinished();
30 |
31 | private:
32 | QLineEdit *editFilter_;
33 | QPalette paletteDefault_;
34 | };
35 |
36 | } // namespace debugger
37 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/CpuWidgets/SymbolBrowserWidget.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Disassembler viewer form.
6 | */
7 |
8 | #include "SymbolBrowserArea.h"
9 | #include "SymbolBrowserControl.h"
10 | #include "SymbolBrowserWidget.h"
11 | #include "moc_SymbolBrowserWidget.h"
12 |
13 | #include
14 |
15 | namespace debugger {
16 |
17 | SymbolBrowserWidget::SymbolBrowserWidget(IGui *igui, QWidget *parent)
18 | : QWidget(parent) {
19 | igui_ = igui;
20 |
21 | gridLayout = new QGridLayout(this);
22 | gridLayout->setSpacing(4);
23 | gridLayout->setHorizontalSpacing(10);
24 | gridLayout->setVerticalSpacing(0);
25 | gridLayout->setContentsMargins(4, 4, 4, 4);
26 | setLayout(gridLayout);
27 |
28 | SymbolBrowserControl *pctrl = new SymbolBrowserControl(this);
29 |
30 | SymbolBrowserArea *parea = new SymbolBrowserArea(igui, this);
31 | gridLayout->addWidget(pctrl , 0, 0);
32 | gridLayout->addWidget(parea, 1, 0);
33 | gridLayout->setRowStretch(1, 10);
34 |
35 | connect(pctrl, SIGNAL(signalFilterChanged(const QString &)),
36 | parea, SLOT(slotFilterChanged(const QString &)));
37 |
38 | connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)),
39 | this, SLOT(slotShowFunction(uint64_t, uint64_t)));
40 |
41 | connect(parea, SIGNAL(signalShowData(uint64_t, uint64_t)),
42 | this, SLOT(slotShowData(uint64_t, uint64_t)));
43 | }
44 |
45 | } // namespace debugger
46 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/GnssWidgets/linecommon.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Plot's Line common class.
6 | */
7 | #pragma once
8 |
9 | #include "attribute.h"
10 |
11 | namespace debugger {
12 |
13 | class LineCommon {
14 | public:
15 | LineCommon(AttributeType &descr);
16 |
17 | const AttributeType &getDescription();
18 | unsigned size();
19 | void append(double y);
20 | void append(double x, double y);
21 | const char *getName() { return descr_["Name"].to_string(); }
22 | const char *getColor() { return color_; }
23 |
24 | void setPlotSize(int w, int h);
25 | void selectData(int start_idx, int total);
26 | bool getNext(int &x, int &y);
27 | bool getXY(int idx, int &x, int &y);
28 | bool getAxisValue(int axis, int idx, double &outval);
29 | bool getAxisValue(int axis, int idx, char *outbuf, size_t bufsz);
30 | void getAxisMin(int axis, char *outbuf, size_t bufsz);
31 | void getAxisMax(int axis, char *outbuf, size_t bufsz);
32 | int getNearestByX(int x);
33 |
34 | private:
35 | AttributeType descr_;
36 | struct AxisType {
37 | double *data;
38 | double accum;
39 | double minVal;
40 | double maxVal;
41 | } axis_[2];
42 | bool is_ring_;
43 | int start_;
44 | int cnt_;
45 | int len_;
46 | char color_[8];
47 | char format_[16];
48 | double plot_w;
49 | double plot_h;
50 | double dx;
51 | double dy;
52 | int sel_start_idx;
53 | int sel_cnt;
54 | };
55 |
56 | } // namespace debugger
57 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/MainWindow/MdiAreaWidget.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "MdiAreaWidget.h"
3 | #include "moc_MdiAreaWidget.h"
4 |
5 | namespace debugger {
6 |
7 | MdiAreaWidget::MdiAreaWidget(AttributeType &cfg, QWidget *parent)
8 | : QMdiArea(parent) {
9 | Config_ = cfg;
10 | if (Config_["Tabbed"].to_bool()) {
11 | setViewMode(QMdiArea::TabbedView);
12 | } else {
13 | }
14 | setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
15 | setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
16 | setTabsClosable(true);
17 | setTabsMovable(true);
18 | }
19 |
20 |
21 | void MdiAreaWidget::slotRemoveView(AttributeType &cfg)
22 | {
23 | QMdiSubWindow *v = findMdiChild(cfg["Class"].to_string());
24 | if (v) {
25 | v->close();
26 | }
27 | }
28 |
29 | QMdiSubWindow *MdiAreaWidget::findMdiChild(const char* name)
30 | {
31 | const char *check_name;
32 | QListlst = subWindowList();
33 | for (int i=0; iwidget()->metaObject()->className();
36 | if (strcmp(name, check_name) == 0) {
37 | return lst[i];
38 | }
39 | }
40 | return 0;
41 | }
42 |
43 | } // namespace debugger
44 |
45 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/MainWindow/MdiAreaWidget.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief MDI container of all other widgets.
6 | */
7 | #pragma once
8 |
9 | #include "attribute.h"
10 |
11 | #include
12 | #include
13 |
14 | namespace debugger {
15 |
16 | class MdiAreaWidget : public QMdiArea
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | MdiAreaWidget(AttributeType &cfg, QWidget *parent = 0);
22 |
23 | private slots:
24 | void slotRemoveView(AttributeType &cfg);
25 |
26 | private:
27 | QMdiSubWindow *findMdiChild(const char* name);
28 |
29 | AttributeType Config_;
30 |
31 | };
32 |
33 | } // namespace debugger
34 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/MainWindow/ebreakhandler.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Breakpoint feedback controller.
6 | * @details This class allows to read/write DSU control operations allowing
7 | * to correctly continue execution on breakpoints.
8 | */
9 |
10 | #pragma once
11 |
12 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
13 | #include "igui.h"
14 |
15 | namespace debugger {
16 |
17 | class EBreakHandler : public IGuiCmdHandler {
18 | public:
19 | EBreakHandler(IGui *gui);
20 | ~EBreakHandler();
21 |
22 | void setBrAddressFetch(uint64_t addr) { dsu_sw_br_ = addr; }
23 | void setHwRemoveBreakpoint(uint64_t addr) { dsu_hw_br_ = addr; }
24 |
25 | /** IGuiCmdHandler */
26 | virtual void handleResponse(AttributeType *req, AttributeType *resp);
27 |
28 | /** Write address and instruction into fetcher to skip EBREAK once */
29 | void skip();
30 |
31 | private:
32 | AttributeType readBr_;
33 | AttributeType readNpc_;
34 | AttributeType brList_;
35 | IGui *igui_;
36 | uint64_t dsu_sw_br_;
37 | uint64_t dsu_hw_br_;
38 | };
39 |
40 | } // namespace debugger
41 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/DipArea.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief DIP's area renderer definition.
6 | */
7 |
8 | #include "DipArea.h"
9 | #include "moc_DipArea.h"
10 |
11 | #include
12 |
13 | namespace debugger {
14 |
15 | DipArea::DipArea(QWidget *parent) : QWidget(parent) {
16 | dipTotal_.make_int64(8);
17 | dips_ = 0xF0;
18 |
19 | QImage img(tr(":/images/dip_t4_l21_up.png"));
20 | pixmapBody_ = QPixmap(size()).fromImage(img);
21 |
22 | QImage img2(tr(":/images/dip_down.png"));
23 | pixmapDown_ = QPixmap(size()).fromImage(img2);
24 |
25 | setMinimumWidth(pixmapBody_.size().width() * dipTotal_.to_int());
26 | setMinimumHeight(pixmapBody_.size().height());
27 | }
28 |
29 |
30 | void DipArea::paintEvent(QPaintEvent *event) {
31 | QPainter p(this);
32 |
33 | for (int i = 0; i < dipTotal_.to_int(); i++) {
34 | QPoint pos(i * pixmapBody_.size().width(), 0);
35 | p.drawPixmap(pos, pixmapBody_);
36 | // Count from left (DIP[0]) to right (DIP[n-1])
37 | if (((dips_ >> (dipTotal_.to_int() - 1 - i)) & 0x1) == 0) {
38 | pos += QPoint(4, 21);
39 | p.drawPixmap(pos, pixmapDown_);
40 | }
41 | }
42 | p.end();
43 | }
44 |
45 | void DipArea::slotUpdate(uint32_t value) {
46 | dips_ = value;
47 | update();
48 | }
49 |
50 | } // namespace debugger
51 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/DipArea.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief DIP's area renderer declaration.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace debugger {
18 |
19 | class DipArea : public QWidget {
20 | Q_OBJECT
21 | public:
22 | DipArea(QWidget *parent = 0);
23 |
24 | private slots:
25 | void slotUpdate(uint32_t val);
26 |
27 | protected:
28 | void paintEvent(QPaintEvent *event_) Q_DECL_OVERRIDE;
29 |
30 | private:
31 | AttributeType dipTotal_;
32 | uint32_t dips_;
33 | QPixmap pixmapBody_;
34 | QPixmap pixmapDown_;
35 | };
36 |
37 | } // namespace debugger
38 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/LedArea.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief LED's area renderer definition.
6 | */
7 |
8 | #include "LedArea.h"
9 | #include "moc_LedArea.h"
10 |
11 | #include
12 |
13 | namespace debugger {
14 |
15 | LedArea::LedArea(QWidget *parent) : QWidget(parent) {
16 | ledTotal_.make_int64(8);
17 | leds_ = 0xF0;
18 |
19 | QImage img1(tr(":/images/led_on.png"));
20 | pixmapOn_ = QPixmap(size()).fromImage(img1);
21 |
22 | QImage img2(tr(":/images/led_off.png"));
23 | pixmapOff_ = QPixmap(size()).fromImage(img2);
24 |
25 | setMinimumWidth(pixmapOff_.size().width() * ledTotal_.to_int());
26 | setMinimumHeight(pixmapOff_.size().height());
27 | }
28 |
29 |
30 | void LedArea::paintEvent(QPaintEvent *event) {
31 | QPainter p(this);
32 |
33 | for (int i = 0; i < ledTotal_.to_int(); i++) {
34 | QPoint pos(i * pixmapOff_.width(), 0);
35 |
36 | // Count from left (LED[0]) to right (LED[n-1])
37 | if (((leds_ >> (ledTotal_.to_int() - 1 - i)) & 0x1) == 0) {
38 | p.drawPixmap(pos, pixmapOff_);
39 | } else {
40 | p.drawPixmap(pos, pixmapOn_);
41 | }
42 | }
43 | p.end();
44 | }
45 |
46 | void LedArea::slotUpdate(uint32_t value) {
47 | leds_ = value;
48 | update();
49 | }
50 |
51 | } // namespace debugger
52 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/LedArea.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief LED's area renderer declaration.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace debugger {
18 |
19 | class LedArea : public QWidget {
20 | Q_OBJECT
21 | public:
22 | LedArea(QWidget *parent = 0);
23 |
24 | private slots:
25 | void slotUpdate(uint32_t val);
26 |
27 | protected:
28 | void paintEvent(QPaintEvent *event_) Q_DECL_OVERRIDE;
29 |
30 | private:
31 | AttributeType ledTotal_;
32 | uint32_t leds_;
33 | QPixmap pixmapOn_;
34 | QPixmap pixmapOff_;
35 | };
36 |
37 | } // namespace debugger
38 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/UartEditor.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Serial console emulator.
6 | */
7 |
8 | #pragma once
9 |
10 | #include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header.
11 | #include "attribute.h"
12 | #include "igui.h"
13 | #include "coreservices/irawlistener.h"
14 | #include "coreservices/iserial.h"
15 |
16 | #include
17 | #include
18 | #include
19 |
20 | namespace debugger {
21 |
22 | /**
23 | * QPlainTextEdit gives per-line scrolling (but optimized for plain text)
24 | * QTextEdit gives smooth scrolling (line partial move up-down)
25 | */
26 | class UartEditor : public QPlainTextEdit,
27 | public IRawListener {
28 | Q_OBJECT
29 | public:
30 | UartEditor(IGui *igui, QWidget *parent = 0);
31 | ~UartEditor();
32 |
33 | // IRawListener
34 | virtual void updateData(const char *buf, int buflen);
35 |
36 | signals:
37 | void signalClose(QWidget *, AttributeType &);
38 | void signalNewData();
39 |
40 | private slots:
41 | void slotUpdateByData();
42 |
43 | protected:
44 | virtual void keyPressEvent(QKeyEvent *e);
45 | virtual void closeEvent(QCloseEvent *event_);
46 |
47 | private:
48 | char keyevent2char(QKeyEvent *e);
49 |
50 | private:
51 | IGui *igui_;
52 | ISerial *uart_;
53 | QString strOutput_;
54 | mutex_def mutexStr_;
55 | char prevSymb_;
56 | };
57 |
58 | } // namespace debugger
59 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/PeriphWidgets/UartWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "UartWidget.h"
2 | #include "moc_UartWidget.h"
3 |
4 | #include
5 | #include
6 |
7 | namespace debugger {
8 |
9 | UartWidget::UartWidget(IGui *igui, QWidget *parent)
10 | : QWidget(parent) {
11 |
12 | QHBoxLayout *layout = new QHBoxLayout;
13 | editor_ = new UartEditor(igui, this);
14 | layout->addWidget(editor_);
15 | layout->setMargin(0);
16 | setLayout(layout);
17 | }
18 |
19 | } // namespace debugger
20 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/igui.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Graphical User Interface (GUI).
6 | */
7 |
8 | #ifndef __DEBUGGER_IGUI_H__
9 | #define __DEBUGGER_IGUI_H__
10 |
11 | #include "iface.h"
12 | #include "attribute.h"
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_GUI_PLUGIN = "IGui";
17 | static const char *const IFACE_GUI_CMD_HANDLER = "IGuiCmdHandler";
18 |
19 | class IGuiCmdHandler : public IFace {
20 | public:
21 | IGuiCmdHandler() : IFace(IFACE_GUI_CMD_HANDLER) {}
22 |
23 | virtual void handleResponse(AttributeType *req, AttributeType *resp) =0;
24 | };
25 |
26 |
27 | class IGui : public IFace {
28 | public:
29 | IGui() : IFace(IFACE_GUI_PLUGIN) {}
30 |
31 | virtual IFace *getSocInfo() =0;
32 |
33 | virtual const AttributeType *getpConfig() =0;
34 |
35 | virtual void registerCommand(IGuiCmdHandler *src, AttributeType *cmd,
36 | bool silent) =0;
37 | virtual void removeFromQueue(IFace *iface) =0;
38 | };
39 |
40 | } // namespace debugger
41 |
42 | #endif // __DEBUGGER_IGUI_H__
43 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/qt_wrapper.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief QT Wrapper connects QT libs to debugger core library.
6 | */
7 | #ifndef __DEBUGGER_UI_QTHREAD_H__
8 | #define __DEBUGGER_UI_QTHREAD_H__
9 |
10 | #include "iclass.h"
11 | #include "iservice.h"
12 | #include "igui.h"
13 | #include "MainWindow/DbgMainWindow.h"
14 |
15 | namespace debugger {
16 |
17 | class QtWrapper : public QObject {
18 | Q_OBJECT
19 | public:
20 | QtWrapper(IGui *igui);
21 | virtual ~QtWrapper();
22 |
23 | void postInit(AttributeType *gui_cfg);
24 | void eventsUpdate();
25 | void gracefulClose();
26 |
27 | signals:
28 | void signalPollingUpdate();
29 |
30 | private slots:
31 | void slotMainWindowAboutToClose();
32 |
33 | private:
34 | IGui *igui_;
35 | DbgMainWindow *mainWindow_;
36 | bool exiting_;
37 | };
38 |
39 | } // namespace debugger
40 |
41 | #endif // __DEBUGGER_UI_QTHREAD_H__
42 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/gui.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/toggle.png
4 | images/kc705_top.png
5 | images/ml605_top.png
6 | images/board_96x96.png
7 | images/gpio_96x96.png
8 | images/stepinto_96x96.png
9 | images/start_96x96.png
10 | images/pause_96x96.png
11 | images/asm_96x96.png
12 | images/cpu_96x96.png
13 | images/mem_96x96.png
14 | images/serial_96x96.png
15 | images/stack_96x96.png
16 | images/info_96x96.png
17 | images/dip_down.png
18 | images/dip_t4_l21_up.png
19 | images/led_on.png
20 | images/led_off.png
21 | images/opmap_96x96.png
22 | images/plot_96x96.png
23 |
24 |
25 |
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/asm_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/asm_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/board_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/board_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/cpu_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/cpu_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/dip_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/dip_down.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/dip_t4_l21_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/dip_t4_l21_up.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/gpio_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/gpio_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/info_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/info_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/kc705_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/kc705_top.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/led_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/led_off.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/led_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/led_on.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/mem_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/mem_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/ml605_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/ml605_top.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/opmap_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/opmap_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/pause_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/pause_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/plot_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/plot_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/serial_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/serial_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/stack_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/stack_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/start_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/start_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/stepinto_96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/stepinto_96x96.png
--------------------------------------------------------------------------------
/debugger/src/gui_plugin/resources/images/toggle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/debugger/src/gui_plugin/resources/images/toggle.png
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/.gitignore:
--------------------------------------------------------------------------------
1 | !debug
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/bus/bus.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief System Bus class declaration (AMBA or whatever).
6 | */
7 |
8 | #ifndef __DEBUGGER_BUS_H__
9 | #define __DEBUGGER_BUS_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/iclock.h"
14 | #include "coreservices/ibus.h"
15 | #include
16 |
17 | namespace debugger {
18 |
19 | class Bus : public IService,
20 | public IBus {
21 | public:
22 | explicit Bus(const char *name);
23 | virtual ~Bus();
24 |
25 | /** IService interface */
26 | virtual void postinitService();
27 |
28 | /** IBus interface */
29 | virtual void map(IMemoryOperation *imemop);
30 | virtual ETransStatus b_transport(Axi4TransactionType *trans);
31 | virtual ETransStatus nb_transport(Axi4TransactionType *trans,
32 | IAxi4NbResponse *cb);
33 | virtual BusUtilType *bus_utilization();
34 |
35 | private:
36 | AttributeType listMap_;
37 | AttributeType imap_;
38 | // Clock interface is used just to tag debug output with some step value,
39 | // in a case of several clocks the first found will be used.
40 | IClock *iclk0_;
41 | mutex_def mutexBAccess_;
42 | mutex_def mutexNBAccess_;
43 |
44 | BusUtilType info_[CFG_NASTI_MASTER_TOTAL];
45 | };
46 |
47 | DECLARE_CLASS(Bus)
48 |
49 | } // namespace debugger
50 |
51 | #endif // __DEBUGGER_BUS_H__
52 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/console/autocompleter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Auto-complete class declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_AUTOCOMPLETER_H__
9 | #define __DEBUGGER_AUTOCOMPLETER_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/iautocomplete.h"
14 | #include "coreservices/isocinfo.h"
15 | #include
16 | #include
17 |
18 | namespace debugger {
19 |
20 | class AutoCompleter : public IService,
21 | public IAutoComplete {
22 | public:
23 | explicit AutoCompleter(const char *name);
24 | virtual ~AutoCompleter();
25 |
26 | /** IService interface */
27 | virtual void postinitService();
28 |
29 | /** IAutoComplete */
30 | virtual bool processKey(uint32_t qt_key, AttributeType *cmd,
31 | AttributeType *cursor);
32 |
33 |
34 | private:
35 | void addToHistory(const char *cmd);
36 |
37 | private:
38 | //AttributeType console_;
39 | AttributeType socInfo_;
40 | AttributeType history_;
41 | AttributeType history_size_;
42 |
43 | std::string cmdLine_;
44 | unsigned carretPos_;
45 | ISocInfo *info_;
46 |
47 | // History switching
48 | std::string unfinshedLine_; // store the latest whe we look through history
49 | unsigned history_idx_;
50 | };
51 |
52 | DECLARE_CLASS(AutoCompleter)
53 |
54 | } // namespace debugger
55 |
56 | #endif // __DEBUGGER_AUTOCOMPLETER_H__
57 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/debug/edcl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Access to a hardware via Ethernet EDCL interface implementaion.
6 | */
7 |
8 | #ifndef __DEBUGGER_EDCL_H__
9 | #define __DEBUGGER_EDCL_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/itap.h"
14 | #include "coreservices/ilink.h"
15 | #include
16 |
17 | namespace debugger {
18 |
19 | class EdclService : public IService,
20 | public ITap {
21 | public:
22 | EdclService(const char *name);
23 |
24 | /** IService interface */
25 | virtual void postinitService();
26 |
27 | /** ITap interface */
28 | virtual int read(uint64_t addr, int bytes, uint8_t *obuf);
29 | virtual int write(uint64_t addr, int bytes, uint8_t *ibuf);
30 |
31 | private:
32 | int write16(uint8_t *buf, int off, uint16_t v);
33 | int write32(uint8_t *buf, int off, uint32_t v);
34 | uint32_t read32(uint8_t *buf);
35 |
36 | private:
37 | /** This is limitation of the MAC fifo. Protocol allows increase the
38 | * following value up to 242 words. */
39 | static const int EDCL_PAYLOAD_MAX_WORDS32 = 8;
40 | static const int EDCL_PAYLOAD_MAX_BYTES = 4*EDCL_PAYLOAD_MAX_WORDS32;
41 |
42 | uint8_t tx_buf_[4096];
43 | uint8_t rx_buf_[4096];
44 | ILink *itransport_;
45 | AttributeType transport_;
46 | AttributeType seq_cnt_;
47 |
48 | int dbgRdTRansactionCnt_;
49 | };
50 |
51 | DECLARE_CLASS(EdclService)
52 |
53 | } // namespace debugger
54 |
55 | #endif // __DEBUGGER_EDCL_H__
56 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/debug/edcl_types.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief EDCL user defined transport structure.
6 | */
7 |
8 | #ifndef __DEBUGGER_EDCL_TYPES_H__
9 | #define __DEBUGGER_EDCL_TYPES_H__
10 |
11 | #include
12 |
13 | namespace debugger {
14 |
15 | struct EdclControlRequestType {
16 | // 32 bits fields:
17 | uint32_t unused : 7;
18 | uint32_t len : 10;
19 | uint32_t write : 1; // read = 0; write = 1
20 | uint32_t seqidx : 14; // sequence id
21 | //uint32 data; // 0 to 242 words
22 | };
23 |
24 |
25 | struct EdclControlResponseType {
26 | // 32 bits fields:
27 | uint32_t unused : 7;
28 | uint32_t len : 10;
29 | uint32_t nak : 1; // ACK = 0; NAK = 1
30 | uint32_t seqidx : 14; // sequence id
31 | //uint32 data; // 0 to 242 words
32 | };
33 |
34 | #pragma pack(1)
35 | struct UdpEdclCommonType {
36 | uint16_t offset;
37 | union ControlType {
38 | uint32_t word;
39 | EdclControlRequestType request;
40 | EdclControlResponseType response;
41 | } control;
42 | uint32_t address;
43 | //uint32 data; // 0 to 242 words
44 | };
45 | #pragma pack()
46 |
47 | } // namespace debugger
48 |
49 | #endif // __DEBUGGER_EDCL_TYPES_H__
50 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/debug/udp_dbglink.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief UDP transport level implementation.
6 | */
7 |
8 | #ifndef __DEBUGGER_UDP_DBGLINK_SERVICE_H__
9 | #define __DEBUGGER_UDP_DBGLINK_SERVICE_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/ilink.h"
14 | #include "coreservices/itap.h"
15 |
16 | namespace debugger {
17 |
18 | class UdpService : public IService,
19 | public ILink {
20 | public:
21 | UdpService(const char *name);
22 | ~UdpService();
23 |
24 | /** IService interface */
25 | virtual void postinitService();
26 |
27 | /** ILink interface */
28 | virtual void getConnectionSettings(AttributeType *settings);
29 | virtual void setConnectionSettings(const AttributeType *target);
30 | virtual int sendData(const uint8_t *msg, int len);
31 | virtual int readData(const uint8_t *buf, int maxlen);
32 |
33 | protected:
34 | int createDatagramSocket();
35 | void closeDatagramSocket();
36 | bool setBlockingMode(bool mode);
37 |
38 | private:
39 | AttributeType timeout_;
40 | AttributeType blockmode_;
41 | AttributeType hostIP_;
42 | AttributeType boardIP_;
43 |
44 | struct sockaddr_in sockaddr_ipv4_;
45 | char sockaddr_ipv4_str_[16]; // 3 dots + 4 digits each 3 symbols + '\0' = 4*3 + 3 + 1;
46 | unsigned short sockaddr_ipv4_port_;
47 | struct sockaddr_in remote_sockaddr_ipv4_;
48 | socket_def hsock_;
49 | char rcvbuf[4096];
50 | };
51 |
52 | DECLARE_CLASS(UdpService)
53 |
54 | } // namespace debugger
55 |
56 | #endif // __DEBUGGER_UDP_DBGLINK_SERVICE_H__
57 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_br.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Add or remove memory breakpoint.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_BR_H__
9 | #define __DEBUGGER_CMD_BR_H__
10 |
11 | #include "api_core.h"
12 | #include "iservice.h"
13 | #include "coreservices/itap.h"
14 | #include "coreservices/isocinfo.h"
15 | #include "coreservices/icommand.h"
16 | #include "coreservices/isrccode.h"
17 |
18 | namespace debugger {
19 |
20 | class CmdBr : public ICommand {
21 | public:
22 | explicit CmdBr(ITap *tap, ISocInfo *info);
23 |
24 | /** ICommand */
25 | virtual bool isValid(AttributeType *args);
26 | virtual void exec(AttributeType *args, AttributeType *res);
27 |
28 | private:
29 | ISourceCode *isrc_;
30 | };
31 |
32 | } // namespace debugger
33 |
34 | #endif // __DEBUGGER_CMD_LOG_H__
35 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_busutil.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Bus utilization computation
6 | *
7 | * @details Read CPU dport registers: clock counter and per
8 | * master counters with read/write transactions to compute
9 | * utilization characteristic.
10 | */
11 |
12 | #ifndef __DEBUGGER_CMD_BUSUTIL_H__
13 | #define __DEBUGGER_CMD_BUSUTIL_H__
14 |
15 | #include "api_core.h"
16 | #include "coreservices/itap.h"
17 | #include "coreservices/isocinfo.h"
18 | #include "coreservices/icommand.h"
19 |
20 | namespace debugger {
21 |
22 | class CmdBusUtil : public ICommand {
23 | public:
24 | explicit CmdBusUtil(ITap *tap, ISocInfo *info);
25 |
26 | /** ICommand */
27 | virtual bool isValid(AttributeType *args);
28 | virtual void exec(AttributeType *args, AttributeType *res);
29 |
30 | private:
31 | uint64_t clock_cnt_z_;
32 | DsuMapType::local_regs_type::local_region_type::mst_bus_util_type
33 | bus_util_z_[32];
34 | };
35 |
36 | } // namespace debugger
37 |
38 | #endif // __DEBUGGER_CMD_BUSUTIL_H__
39 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_cpi.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read CPU dport registers (step counter and clock
6 | * counter) to compute CPI in run-time.
7 | */
8 |
9 | #ifndef __DEBUGGER_CMD_CPI_H__
10 | #define __DEBUGGER_CMD_CPI_H__
11 |
12 | #include "api_core.h"
13 | #include "coreservices/itap.h"
14 | #include "coreservices/isocinfo.h"
15 | #include "coreservices/icommand.h"
16 |
17 | namespace debugger {
18 |
19 | class CmdCpi : public ICommand {
20 | public:
21 | explicit CmdCpi(ITap *tap, ISocInfo *info);
22 |
23 | /** ICommand */
24 | virtual bool isValid(AttributeType *args);
25 | virtual void exec(AttributeType *args, AttributeType *res);
26 |
27 | private:
28 | uint64_t stepCnt_z;
29 | uint64_t clockCnt_z;
30 | };
31 |
32 | } // namespace debugger
33 |
34 | #endif // __DEBUGGER_CMD_CPI_H__
35 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_csr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read/write CSR register value.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_CSR_H__
9 | #define __DEBUGGER_CMD_CSR_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdCsr : public ICommand {
17 | public:
18 | explicit CmdCsr(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | void to_string(AttributeType *args, AttributeType *res, AttributeType *out);
26 |
27 | private:
28 | };
29 |
30 | } // namespace debugger
31 |
32 | #endif // __DEBUGGER_CMD_CSR_H__
33 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_disas.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Disassemble data block command.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_DISAS_H__
9 | #define __DEBUGGER_CMD_DISAS_H__
10 |
11 | #include "api_core.h"
12 | #include "iservice.h"
13 | #include "coreservices/itap.h"
14 | #include "coreservices/isocinfo.h"
15 | #include "coreservices/icommand.h"
16 | #include "coreservices/isrccode.h"
17 |
18 | namespace debugger {
19 |
20 | class CmdDisas : public ICommand {
21 | public:
22 | explicit CmdDisas(ITap *tap, ISocInfo *info);
23 |
24 | /** ICommand */
25 | virtual bool isValid(AttributeType *args);
26 | virtual void exec(AttributeType *args, AttributeType *res);
27 |
28 | private:
29 | void format(AttributeType *asmbuf, AttributeType *fmtstr);
30 |
31 | private:
32 | ISourceCode *isrc_;
33 | };
34 |
35 | } // namespace debugger
36 |
37 | #endif // __DEBUGGER_CMD_DISAS_H__
38 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_exit.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Exit and close application.
6 | */
7 |
8 | #include "cmd_exit.h"
9 |
10 | namespace debugger {
11 |
12 | CmdExit::CmdExit(ITap *tap, ISocInfo *info)
13 | : ICommand ("exit", tap, info) {
14 |
15 | briefDescr_.make_string("Exit and close application");
16 | detailedDescr_.make_string(
17 | "Description:\n"
18 | " Immediate close the application and exit.\n"
19 | "Example:\n"
20 | " exit\n");
21 | }
22 |
23 | bool CmdExit::isValid(AttributeType *args) {
24 | if ((*args)[0u].is_equal(cmdName_.to_string())) {
25 | return CMD_VALID;
26 | }
27 | return CMD_INVALID;
28 | }
29 |
30 | void CmdExit::exec(AttributeType *args, AttributeType *res) {
31 | res->make_nil();
32 | if (!isValid(args)) {
33 | generateError(res, "Wrong argument list");
34 | return;
35 | }
36 | RISCV_break_simulation();
37 | }
38 |
39 | } // namespace debugger
40 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_exit.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Exit and close application.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_EXIT_H__
9 | #define __DEBUGGER_CMD_EXIT_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdExit : public ICommand {
19 | public:
20 | explicit CmdExit(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_EXIT_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_halt.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Halt simulation.
6 | */
7 |
8 | #include "cmd_halt.h"
9 |
10 | namespace debugger {
11 |
12 | CmdHalt::CmdHalt(ITap *tap, ISocInfo *info)
13 | : ICommand ("halt", tap, info) {
14 |
15 | briefDescr_.make_string("Stop simulation");
16 | detailedDescr_.make_string(
17 | "Description:\n"
18 | " Stop simulation.\n"
19 | "Example:\n"
20 | " halt\n"
21 | " stop\n"
22 | " s\n");
23 | }
24 |
25 |
26 | bool CmdHalt::isValid(AttributeType *args) {
27 | AttributeType &name = (*args)[0u];
28 | if (name.is_equal("halt") || name.is_equal("break")
29 | || name.is_equal("stop") || name.is_equal("s")) {
30 | return CMD_VALID;
31 | }
32 | return CMD_INVALID;
33 | }
34 |
35 | void CmdHalt::exec(AttributeType *args, AttributeType *res) {
36 | res->make_nil();
37 | if (!isValid(args)) {
38 | generateError(res, "Wrong argument list");
39 | return;
40 | }
41 |
42 | Reg64Type t1;
43 | DsuMapType *dsu = info_->getpDsu();
44 | DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
45 | uint64_t addr_run_ctrl = reinterpret_cast(&dsu->udbg.v.control);
46 | ctrl.val = 0;
47 | ctrl.bits.halt = 1;
48 | t1.val = ctrl.val;
49 | tap_->write(addr_run_ctrl, 8, t1.buf);
50 | }
51 |
52 | } // namespace debugger
53 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_halt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Halt simulation.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_HALT_H__
9 | #define __DEBUGGER_CMD_HALT_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdHalt : public ICommand {
17 | public:
18 | explicit CmdHalt(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_CMD_HALT_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_isrunning.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Check target status: run or not.
6 | */
7 |
8 | #include "cmd_isrunning.h"
9 |
10 | namespace debugger {
11 |
12 | CmdIsRunning::CmdIsRunning(ITap *tap, ISocInfo *info)
13 | : ICommand ("isrunning", tap, info) {
14 |
15 | briefDescr_.make_string("Check target's status");
16 | detailedDescr_.make_string(
17 | "Description:\n"
18 | " Check target's status as a boolean value.\n"
19 | "Example:\n"
20 | " isrunning\n");
21 | }
22 |
23 | bool CmdIsRunning::isValid(AttributeType *args) {
24 | if ((*args)[0u].is_equal(cmdName_.to_string()) && args->size() == 1) {
25 | return CMD_VALID;
26 | }
27 | return CMD_INVALID;
28 | }
29 |
30 | void CmdIsRunning::exec(AttributeType *args, AttributeType *res) {
31 | res->make_boolean(false);
32 | if (!isValid(args)) {
33 | generateError(res, "Wrong argument list");
34 | return;
35 | }
36 |
37 | Reg64Type t1;
38 | DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
39 | DsuMapType *pdsu = info_->getpDsu();
40 | uint64_t addr = reinterpret_cast(&pdsu->udbg.v.control);
41 | tap_->read(addr, 8, t1.buf);
42 | ctrl.val = t1.val;
43 | if (ctrl.bits.halt) {
44 | res->make_boolean(false);
45 | } else {
46 | res->make_boolean(true);
47 | }
48 | }
49 |
50 | } // namespace debugger
51 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_isrunning.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Check target status: run or not.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_ISRUNNING_H__
9 | #define __DEBUGGER_CMD_ISRUNNING_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdIsRunning : public ICommand {
19 | public:
20 | explicit CmdIsRunning(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_ISRUNNING_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_loadelf.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Elf-file loader command.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_LOADELF_H__
9 | #define __DEBUGGER_CMD_LOADELF_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdLoadElf : public ICommand {
19 | public:
20 | explicit CmdLoadElf(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_LOADELF_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_log.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Log file enable/disable.
6 | */
7 |
8 | #include "cmd_log.h"
9 |
10 | namespace debugger {
11 |
12 | CmdLog::CmdLog(ITap *tap, ISocInfo *info)
13 | : ICommand ("log", tap, info) {
14 |
15 | briefDescr_.make_string("Enable log-file");
16 | detailedDescr_.make_string(
17 | "Description:\n"
18 | " Write console output into specified file.\n"
19 | " Close log-file if the filename not specified.\n"
20 | "Example:\n"
21 | " log session.log\n"
22 | " log /home/riscv/session.log\n");
23 | }
24 |
25 | bool CmdLog::isValid(AttributeType *args) {
26 | if ((*args)[0u].is_equal(cmdName_.to_string())
27 | && (args->size() == 1 || args->size() == 2)) {
28 | return CMD_VALID;
29 | }
30 | return CMD_INVALID;
31 | }
32 |
33 | void CmdLog::exec(AttributeType *args, AttributeType *res) {
34 | res->make_nil();
35 | if (!isValid(args)) {
36 | generateError(res, "Wrong argument list");
37 | return;
38 | }
39 |
40 | if (args->size() == 1) {
41 | RISCV_disable_log();
42 | } else {
43 | const char *filename = (*args)[1].to_string();
44 | if (RISCV_enable_log(filename)) {
45 | generateError(res, "Can't open file");
46 | }
47 | }
48 | }
49 |
50 | } // namespace debugger
51 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_log.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Log file enable/disable.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_LOG_H__
9 | #define __DEBUGGER_CMD_LOG_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdLog : public ICommand {
19 | public:
20 | explicit CmdLog(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_LOG_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_memdump.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Dump memory range into file.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_MEMDUMP_H__
9 | #define __DEBUGGER_CMD_MEMDUMP_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdMemDump : public ICommand {
17 | public:
18 | explicit CmdMemDump(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_CMD_MEMDUMP_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_read.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read/write memory.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_READ_H__
9 | #define __DEBUGGER_CMD_READ_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdRead : public ICommand {
17 | public:
18 | explicit CmdRead(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | void to_string(AttributeType *args, AttributeType *res, AttributeType *out);
26 |
27 | private:
28 | AttributeType rdData_;
29 | };
30 |
31 | } // namespace debugger
32 |
33 | #endif // __DEBUGGER_CMD_READ_H__
34 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_reg.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read/write register value.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_REG_H__
9 | #define __DEBUGGER_CMD_REG_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdReg : public ICommand {
17 | public:
18 | explicit CmdReg(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_CMD_REG_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_regs.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read only registers values.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_REGS_H__
9 | #define __DEBUGGER_CMD_REGS_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdRegs : public ICommand {
17 | public:
18 | explicit CmdRegs(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_CMD_REGS_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_reset.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Reset, Un-reset or Reboot target command.
6 | */
7 |
8 | #include "iservice.h"
9 | #include "cmd_reset.h"
10 |
11 | namespace debugger {
12 |
13 | CmdReset::CmdReset(ITap *tap, ISocInfo *info)
14 | : ICommand ("reset", tap, info) {
15 |
16 | briefDescr_.make_string("Reset, Un-reset or Reboot target");
17 | detailedDescr_.make_string(
18 | "Description:\n"
19 | " Reset, Un-reset or Reboot target.\n"
20 | "Warning:\n"
21 | " When reset is HIGH CPU debug port is resetting also and cannot\n"
22 | " response on debugger requests.\n"
23 | "Example:\n"
24 | " reset\n"
25 | " reset 1\n"
26 | " reset 0\n");
27 | }
28 |
29 | bool CmdReset::isValid(AttributeType *args) {
30 | if ((*args)[0u].is_equal("reset") && args->size() <= 2) {
31 | return CMD_VALID;
32 | }
33 | return CMD_INVALID;
34 | }
35 |
36 | void CmdReset::exec(AttributeType *args, AttributeType *res) {
37 | res->make_nil();
38 | if (!isValid(args)) {
39 | generateError(res, "Wrong argument list");
40 | return;
41 | }
42 |
43 | Reg64Type rst;
44 | DsuMapType *dsu = info_->getpDsu();
45 | uint64_t sw_rst_addr =
46 | reinterpret_cast(&dsu->ulocal.v.soft_reset);
47 |
48 | if (args->size() == 2) {
49 | rst.val = (*args)[1].to_uint64();
50 | tap_->write(sw_rst_addr, 8, rst.buf);
51 | } else {
52 | // Reboot
53 | rst.val = 1;
54 | tap_->write(sw_rst_addr, 8, rst.buf);
55 | RISCV_sleep_ms(10);
56 | rst.val = 0;
57 | tap_->write(sw_rst_addr, 8, rst.buf);
58 | }
59 | }
60 |
61 |
62 | } // namespace debugger
63 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_reset.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Reset, Un-reset or Reboot target command.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_RESET_H__
9 | #define __DEBUGGER_CMD_RESET_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdReset : public ICommand {
19 | public:
20 | explicit CmdReset(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_RESET_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_run.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Run simulation.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_RUN_H__
9 | #define __DEBUGGER_CMD_RUN_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdRun : public ICommand {
17 | public:
18 | explicit CmdRun(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | };
26 |
27 | } // namespace debugger
28 |
29 | #endif // __DEBUGGER_CMD_RUN_H__
30 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_stack.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read CPU stack trace buffer.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_STACK_H__
9 | #define __DEBUGGER_CMD_STACK_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdStack : public ICommand {
19 | public:
20 | explicit CmdStack(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_STACK_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_status.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Read target's status register.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_STATUS_H__
9 | #define __DEBUGGER_CMD_STATUS_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdStatus : public ICommand {
19 | public:
20 | explicit CmdStatus(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | };
28 |
29 | } // namespace debugger
30 |
31 | #endif // __DEBUGGER_CMD_STATUS_H__
32 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_symb.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Browse symbols command.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_SYMB_H__
9 | #define __DEBUGGER_CMD_SYMB_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/itap.h"
13 | #include "coreservices/isocinfo.h"
14 | #include "coreservices/icommand.h"
15 |
16 | namespace debugger {
17 |
18 | class CmdSymb : public ICommand {
19 | public:
20 | explicit CmdSymb(ITap *tap, ISocInfo *info);
21 |
22 | /** ICommand */
23 | virtual bool isValid(AttributeType *args);
24 | virtual void exec(AttributeType *args, AttributeType *res);
25 |
26 | private:
27 | void applyFilter(const char *filt, AttributeType *in, AttributeType *out);
28 | bool filt_pass(const char *filt, const char *symbname);
29 | };
30 |
31 | } // namespace debugger
32 |
33 | #endif // __DEBUGGER_CMD_SYMB_H__
34 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/exec/cmd/cmd_write.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Write memory.
6 | */
7 |
8 | #ifndef __DEBUGGER_CMD_WRITE_H__
9 | #define __DEBUGGER_CMD_WRITE_H__
10 |
11 | #include "api_core.h"
12 | #include "coreservices/icommand.h"
13 |
14 | namespace debugger {
15 |
16 | class CmdWrite : public ICommand {
17 | public:
18 | explicit CmdWrite(ITap *tap, ISocInfo *info);
19 |
20 | /** ICommand */
21 | virtual bool isValid(AttributeType *args);
22 | virtual void exec(AttributeType *args, AttributeType *res);
23 |
24 | private:
25 | AttributeType wrData_;
26 | };
27 |
28 | } // namespace debugger
29 |
30 | #endif // __DEBUGGER_CMD_WRITE_H__
31 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/info/soc_info.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief SOC information.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOC_INFO_H__
9 | #define __DEBUGGER_SOC_INFO_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/isocinfo.h"
14 | #include
15 | #include
16 |
17 | namespace debugger {
18 |
19 | class SocInfo : public IService,
20 | public ISocInfo {
21 | public:
22 | explicit SocInfo(const char *name);
23 |
24 | /** IService interface */
25 | virtual void postinitService();
26 |
27 | /** ISocInfo */
28 | virtual unsigned getMastersTotal();
29 | virtual unsigned getSlavesTotal();
30 | virtual unsigned getRegsTotal();
31 | virtual void getRegsList(AttributeType *lst);
32 | virtual unsigned getCsrTotal();
33 | virtual void getCsrList(AttributeType *lst);
34 | virtual uint64_t csr2addr(const char *name);
35 | virtual uint64_t reg2addr(const char *name);
36 |
37 | virtual DsuMapType *getpDsu() {
38 | return reinterpret_cast(dsuBase_.to_uint64());
39 | }
40 |
41 | virtual uint64_t addressPlugAndPlay();
42 | virtual uint64_t addressGpio();
43 |
44 | private:
45 | AttributeType pnpBase_;
46 | AttributeType gpioBase_;
47 | AttributeType dsuBase_;
48 | AttributeType listCSR_;
49 | AttributeType listRegs_;
50 | };
51 |
52 | DECLARE_CLASS(SocInfo)
53 |
54 | } // namespace debugger
55 |
56 | #endif // __DEBUGGER_SOC_INFO_H__
57 |
--------------------------------------------------------------------------------
/debugger/src/libdbg64g/services/mem/memsim.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief ROM functional model declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOCSIM_PLUGIN_ROM_H__
9 | #define __DEBUGGER_SOCSIM_PLUGIN_ROM_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/imemop.h"
14 |
15 | namespace debugger {
16 |
17 | class MemorySim : public IService,
18 | public IMemoryOperation {
19 | public:
20 | MemorySim(const char *name);
21 | ~MemorySim();
22 |
23 | /** IService interface */
24 | virtual void postinitService();
25 |
26 | /** IMemoryOperation */
27 | virtual void b_transport(Axi4TransactionType *trans);
28 |
29 | virtual uint64_t getBaseAddress() {
30 | return baseAddress_.to_uint64();
31 | }
32 | virtual uint64_t getLength() {
33 | return length_.to_uint64();
34 | }
35 |
36 | private:
37 | static const int SYMB_IN_LINE = 16/2;
38 | bool chishex(int s);
39 | uint8_t chtohex(int s);
40 |
41 | private:
42 | AttributeType initFile_;
43 | AttributeType readOnly_;
44 | AttributeType baseAddress_;
45 | AttributeType length_;
46 | uint8_t *mem_;
47 | };
48 |
49 | DECLARE_CLASS(MemorySim)
50 |
51 | } // namespace debugger
52 |
53 | #endif // __DEBUGGER_SOCSIM_PLUGIN_ROM_H__
54 |
--------------------------------------------------------------------------------
/debugger/src/simple_plugin/isimple_plugin.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Demo plugin interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_SIMPLE_PLUGIN_H__
9 | #define __DEBUGGER_SIMPLE_PLUGIN_H__
10 |
11 | #include "iface.h"
12 |
13 | namespace debugger {
14 |
15 | static const char *const IFACE_SIMPLE_PLUGIN = "ITap";
16 |
17 | static const char *const ISimplePlugin_brief =
18 | "Simple plugin interface example.";
19 |
20 | static const char *const ISimplePlugin_detail =
21 | "This interface is used to interact with the plugin library.";
22 |
23 | class ISimplePlugin : public IFace {
24 | public:
25 | ISimplePlugin() : IFace(IFACE_SIMPLE_PLUGIN) {}
26 |
27 | virtual const char *getBrief() { return ISimplePlugin_brief; }
28 |
29 | virtual const char *getDetail() { return ISimplePlugin_detail; }
30 |
31 | virtual int exampleAction(int val) =0;
32 | };
33 |
34 | } // namespace debugger
35 |
36 | #endif // __DEBUGGER_SIMPLE_PLUGIN_H__
37 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/boardsim.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Simulator of the FPGA board with Ethernet UDP/EDCL interface.
6 | */
7 |
8 | #include "api_core.h"
9 | #include "boardsim.h"
10 |
11 | namespace debugger {
12 |
13 | BoardSim::BoardSim(const char *name) : IService(name) {
14 | registerInterface(static_cast(this));
15 | }
16 |
17 | void BoardSim::postinitService() {
18 | }
19 |
20 | } // namespace debugger
21 |
22 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/boardsim.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Simulator of the Hardware interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_BOARDSIM_H__
9 | #define __DEBUGGER_BOARDSIM_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "iboardsim.h"
14 |
15 | namespace debugger {
16 |
17 | class BoardSim : public IService,
18 | public IBoardSim {
19 | public:
20 | BoardSim(const char *name);
21 |
22 | /** IService interface */
23 | virtual void postinitService();
24 |
25 | /** @name IBoardSim interface */
26 | virtual void getInfo(AttributeType *attr) {}
27 |
28 | private:
29 | };
30 |
31 | DECLARE_CLASS(BoardSim)
32 |
33 | } // namespace debugger
34 |
35 | #endif // __DEBUGGER_BOARDSIM_H__
36 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/fifo.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief FIFO implementation.
6 | */
7 |
8 | #ifndef __DEBUGGER_FIFO_H__
9 | #define __DEBUGGER_FIFO_H__
10 |
11 | #include
12 |
13 | namespace debugger {
14 |
15 | template class TFifo {
16 | public:
17 | TFifo(int sz) {
18 | arr_ = new T[size_ = sz];
19 | prd_ = &arr_[0];
20 | pwr_ = &arr_[1];
21 | }
22 | ~TFifo() {
23 | delete [] arr_;
24 | }
25 | bool isFull() {
26 | return pwr_ == prd_;
27 | }
28 | bool isEmpty() {
29 | if (pwr_ == (prd_ + 1)) {
30 | return true;
31 | }
32 | if ((prd_ - pwr_ + 1) == size_) {
33 | return true;
34 | }
35 | return false;
36 | }
37 | void get(T *out) {
38 | if (isEmpty()) {
39 | return;
40 | }
41 | if (prd_ >= &arr_[size_ - 1]) {
42 | *out = arr_[0];
43 | prd_ = arr_;
44 | } else {
45 | *out = prd_[1];
46 | prd_++;
47 | }
48 | }
49 | void put(T *in) {
50 | if (isFull()) {
51 | return;
52 | }
53 | *pwr_ = *in;
54 | if (pwr_ >= &arr_[size_ - 1]) {
55 | pwr_ = arr_;
56 | } else {
57 | pwr_++;
58 | }
59 | }
60 | private:
61 | T *arr_;
62 | T *prd_;
63 | T *pwr_;
64 | int size_;
65 | };
66 |
67 | } // namespace debugger
68 |
69 | #endif // __DEBUGGER_FIFO_H__
70 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/gpio.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief GPIO functional model.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOCSIM_PLUGIN_GPIO_H__
9 | #define __DEBUGGER_SOCSIM_PLUGIN_GPIO_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/imemop.h"
14 | #include "coreservices/isignal.h"
15 |
16 | namespace debugger {
17 |
18 | class GPIO : public IService,
19 | public IMemoryOperation,
20 | public ISignal {
21 | public:
22 | GPIO(const char *name);
23 | ~GPIO();
24 |
25 | /** IService interface */
26 | virtual void postinitService();
27 |
28 | /** IMemoryOperation */
29 | virtual void b_transport(Axi4TransactionType *trans);
30 |
31 | virtual uint64_t getBaseAddress() {
32 | return baseAddress_.to_uint64();
33 | }
34 | virtual uint64_t getLength() {
35 | return length_.to_uint64();
36 | }
37 |
38 | /** ISignal interface */
39 | virtual void setLevel(int start, int width, uint64_t value);
40 | virtual void registerSignalListener(IFace *listener);
41 | virtual void unregisterSignalListener(IFace *listener);
42 |
43 |
44 | private:
45 | AttributeType baseAddress_;
46 | AttributeType length_;
47 | AttributeType dip_;
48 | AttributeType listOfListerners_;
49 |
50 | struct gpio_map {
51 | volatile uint32_t led;
52 | volatile uint32_t dip;
53 | volatile uint32_t reg2;
54 | volatile uint32_t reg3;
55 | volatile uint32_t led_period;
56 | volatile uint32_t reg5;
57 | volatile uint32_t reg6;
58 | } regs_;
59 | };
60 |
61 | DECLARE_CLASS(GPIO)
62 |
63 | } // namespace debugger
64 |
65 | #endif // __DEBUGGER_SOCSIM_PLUGIN_GPIO_H__
66 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/iboardsim.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Simulator of the FPGA board with Ethernet UDP/EDCL interface.
6 | */
7 |
8 | #ifndef __DEBUGGER_IBOARD_SIM_H__
9 | #define __DEBUGGER_IBOARD_SIM_H__
10 |
11 | #include "iface.h"
12 | #include "attribute.h"
13 |
14 | namespace debugger {
15 |
16 | static const char *const IFACE_BOARDSIM = "IBoardSim";
17 |
18 | class IBoardSim : public IFace {
19 | public:
20 | IBoardSim() : IFace(IFACE_BOARDSIM) {}
21 |
22 | virtual const char *getBrief() {
23 | return "FPGA development board simulator interface";
24 | }
25 |
26 | virtual const char *getDetail() {
27 | return "This interface declares functionality of the emulator of the "
28 | "real hardware. Such emulator allows to develop network "
29 | "interfaces (UDP/EDCL) without connection to the FPGA that "
30 | "significantly simplify debugging.";
31 | }
32 |
33 | virtual void getInfo(AttributeType *attr) =0;
34 | };
35 |
36 | } // namespace debugger
37 |
38 | #endif // __DEBUGGER_IBOARD_SIM_H__
39 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/plugin_init.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Plugin library initialization method.
6 | */
7 |
8 | #include "boardsim.h"
9 | #include "gpio.h"
10 | #include "uart.h"
11 | #include "pnp.h"
12 | #include "irqctrl.h"
13 | #include "gnss_stub.h"
14 | #include "gptimers.h"
15 | #include "dsu.h"
16 | #include "rfctrl.h"
17 | #include "fsev2.h"
18 | #include "uartmst.h"
19 |
20 | namespace debugger {
21 |
22 | extern "C" void plugin_init(void) {
23 | REGISTER_CLASS_IDX(BoardSim, 1);
24 | REGISTER_CLASS_IDX(GPIO, 3);
25 | REGISTER_CLASS_IDX(UART, 4);
26 | REGISTER_CLASS_IDX(PNP, 5);
27 | REGISTER_CLASS_IDX(IrqController, 6);
28 | REGISTER_CLASS_IDX(GNSSStub, 7);
29 | REGISTER_CLASS_IDX(DSU, 8);
30 | REGISTER_CLASS_IDX(GPTimers, 9);
31 | REGISTER_CLASS_IDX(RfController, 10);
32 | REGISTER_CLASS_IDX(FseV2, 11);
33 | REGISTER_CLASS_IDX(UartMst, 12);
34 | }
35 |
36 | } // namespace debugger
37 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/pnp.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Plug'n'Play device functional model.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOCSIM_PLUGIN_PNP_H__
9 | #define __DEBUGGER_SOCSIM_PLUGIN_PNP_H__
10 |
11 | #include "iclass.h"
12 | #include "iservice.h"
13 | #include "coreservices/imemop.h"
14 | #include "coreservices/isocinfo.h"
15 |
16 | namespace debugger {
17 |
18 | class PNP : public IService,
19 | public IMemoryOperation {
20 | public:
21 | PNP(const char *name);
22 | ~PNP();
23 |
24 | /** IService interface */
25 | virtual void postinitService();
26 |
27 | /** IMemoryOperation */
28 | virtual void b_transport(Axi4TransactionType *trans);
29 |
30 | virtual uint64_t getBaseAddress() {
31 | return baseAddress_.to_uint64();
32 | }
33 | virtual uint64_t getLength() {
34 | return length_.to_uint64();
35 | }
36 |
37 | private:
38 | void addMaster(unsigned idx, unsigned vid, unsigned did);
39 | void addSlave(uint64_t addr, uint64_t size, unsigned irq, unsigned vid, unsigned did);
40 |
41 | AttributeType baseAddress_;
42 | AttributeType length_;
43 | AttributeType tech_;
44 | AttributeType adc_detector_;
45 |
46 | PnpMapType regs_;
47 | union DescriptorTableType {
48 | union DescriptorItemType {
49 | MasterConfigType mst;
50 | SlaveConfigType slv;
51 | } *item;
52 | uint8_t *buf;
53 | } iter_;
54 | };
55 |
56 | DECLARE_CLASS(PNP)
57 |
58 | } // namespace debugger
59 |
60 | #endif // __DEBUGGER_SOCSIM_PLUGIN_PNP_H__
61 |
--------------------------------------------------------------------------------
/debugger/src/socsim_plugin/types_amba.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file
3 | * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief System Bus configuration types declaration.
6 | */
7 |
8 | #ifndef __DEBUGGER_SOCSIM_TYPES_AMBA_H__
9 | #define __DEBUGGER_SOCSIM_TYPES_AMBA_H__
10 |
11 | #include
12 |
13 | namespace debugger {
14 |
15 | static const uint64_t CFG_NASTI_DATA_BITS = 128;
16 | static const uint64_t CFG_NASTI_DATA_BYTES = CFG_NASTI_DATA_BITS / 8;
17 | static const uint64_t CFG_NASTI_DATA_WORDS32 = CFG_NASTI_DATA_BYTES / 4;
18 | static const uint64_t CFG_NASTI_ADDR_BITS = 32;
19 | static const uint64_t CFG_NASTI_ADDR_OFFSET = 4;
20 | static const uint64_t CFG_NASTI_CFG_ADDR_BITS = CFG_NASTI_ADDR_BITS - 12;
21 |
22 | static const int CFG_NASTI_BOOTROM = 0;
23 | static const int CFG_NASTI_FWROM = CFG_NASTI_BOOTROM + 1;
24 | static const int CFG_NASTI_SRAM = CFG_NASTI_FWROM + 1;
25 | static const int CFG_NASTI_UART = CFG_NASTI_SRAM + 1;
26 | static const int CFG_NASTI_GPIO = CFG_NASTI_UART + 1;
27 | static const int CFG_NASTI_IRQCTRL = CFG_NASTI_GPIO + 1;
28 | static const int CFG_NASTI_GNSSENGINE = CFG_NASTI_IRQCTRL + 1;
29 | static const int CFG_NASTI_RFCTRL = CFG_NASTI_GNSSENGINE + 1;
30 | static const int CFG_NASTI_FSE_GPS = CFG_NASTI_RFCTRL + 1;
31 | static const int CFG_NASTI_ETHMAC = CFG_NASTI_FSE_GPS + 1;
32 | static const int CFG_NASTI_DSU = CFG_NASTI_ETHMAC + 1;
33 | static const int CFG_NASTI_PNP = CFG_NASTI_DSU + 1;
34 | static const int CFG_NASTI_SLAVES_TOTAL = CFG_NASTI_PNP + 1;
35 |
36 |
37 | } // namespace debugger
38 |
39 | #endif // __DEBUGGER_SOCSIM_TYPES_AMBA_H__
40 |
--------------------------------------------------------------------------------
/rocket_soc/.gitignore:
--------------------------------------------------------------------------------
1 | *.bak
2 | *.obj
3 | *.dump
4 | *.err
5 | *.lst
6 | html
7 | latex
8 | gnsslib
9 | fw/*
10 | !fw/common/
11 | !fw/boot/
12 | fw/boot/linuxbuild/
13 | !fw/helloworld/
14 | fw/helloworld/makefiles/obj/
15 | fw/helloworld/makefiles/bin/
16 | !fw/elf2raw64/
17 | fw/elf2raw64/makefiles/obj/
18 | fw/elf2raw64/makefiles/elf/
19 | patches/
20 | work/tb/*
21 | !work/tb/riscv_soc_tb.vhd
22 | !work/tb/uart_sim.vhd
23 | !work/tb/ethphy_sim.vhd
24 | docs/*.pptx
25 | docs/gnss_styles.css
26 |
27 |
--------------------------------------------------------------------------------
/rocket_soc/bit_files/v6.0/kintex7_kc705.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/bit_files/v6.0/kintex7_kc705.zip
--------------------------------------------------------------------------------
/rocket_soc/bit_files/v6.0/virtex6_ml605.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/bit_files/v6.0/virtex6_ml605.zip
--------------------------------------------------------------------------------
/rocket_soc/docs/.gitignore:
--------------------------------------------------------------------------------
1 | *.xml
2 | *.css
3 | refman.tex
4 |
--------------------------------------------------------------------------------
/rocket_soc/docs/maingroup.vhd:
--------------------------------------------------------------------------------
1 | --! @defgroup main_group RISC-V System-on-Chip VHDL IP library
2 | --! @copydoc mainpage
3 |
4 |
5 | --! @defgroup generic_group 1. VHDL Generic Parameters
6 | --! @ingroup main_group
7 | --! @details VHDL generic parameters.
8 |
9 | --! @defgroup axi4_config_generic_group AXI4 System Bus Generic Parameters
10 | --! @ingroup generic_group
11 | --! @details Definition of System Bus configuraiton parameters and templates
12 | --! methods that should be used by any master/slave device to be
13 | --! compatible with Bus Controller device.
14 |
15 |
16 | --! @defgroup verification_group 2. RTL Verificaton
17 | --! @ingroup main_group
18 | --! @copydoc verification_page
19 |
20 |
21 | --! @defgroup riscv_core_group 3. RISC-V Processor
22 | --! @ingroup main_group
23 | --! @copydoc riscv_core_page
24 |
25 |
26 | --! @defgroup peripheries_group 4. Peripheries
27 | --! @ingroup main_group
28 | --! @copydoc peripheries_page
29 |
30 |
31 | --! @defgroup debugger_group 5. RISC-V debugger
32 | --! @ingroup main_group
33 |
34 |
35 |
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/dbg_gnss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/dbg_gnss.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/dbg_gui_symb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/dbg_gui_symb.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/debugger_demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/debugger_demo.gif
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/river_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/river_top.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/soc_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/soc_top.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/soc_top_v4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/soc_top_v4.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/soc_top_v5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/soc_top_v5.png
--------------------------------------------------------------------------------
/rocket_soc/docs/pics/zephyr_demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/pics/zephyr_demo.gif
--------------------------------------------------------------------------------
/rocket_soc/docs/riscv_soc_descr.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/docs/riscv_soc_descr.pdf
--------------------------------------------------------------------------------
/rocket_soc/docs/style/footer.tex:
--------------------------------------------------------------------------------
1 | % Latex footer for doxygen 1.8.10
2 | %--- End generated contents ---
3 |
4 | % Index
5 | \backmatter
6 | \newpage
7 | \phantomsection
8 | \clearemptydoublepage
9 | \addcontentsline{toc}{chapter}{Index}
10 | \printindex
11 |
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/rocket_soc/fw/boot/makefiles/makefile:
--------------------------------------------------------------------------------
1 | include util.mak
2 |
3 | TOP_DIR=../
4 | OBJ_DIR = $(TOP_DIR)linuxbuild/obj
5 | ELF_DIR = $(TOP_DIR)linuxbuild/bin
6 |
7 |
8 | #-----------------------------------------------------------------------------
9 | .SILENT:
10 | TEA = 2>&1 | tee _$@-comp.err
11 |
12 | all: boot
13 | $(ECHO) " All done.\n"
14 |
15 | boot:
16 | $(ECHO) " Boot rom image building started:"
17 | $(MKDIR) ./$(OBJ_DIR)
18 | $(MKDIR) ./$(ELF_DIR)
19 | make -f make_boot TOP_DIR=$(TOP_DIR) OBJ_DIR=$(OBJ_DIR) ELF_DIR=$(ELF_DIR) $@ $(TEA)
20 |
--------------------------------------------------------------------------------
/rocket_soc/fw/boot/makefiles/test.ld:
--------------------------------------------------------------------------------
1 | /*----------------------------------------------------------------------*/
2 | /* Setup */
3 | /*----------------------------------------------------------------------*/
4 |
5 | /* The OUTPUT_ARCH command specifies the machine architecture where the
6 | argument is one of the names used in the BFD library. More
7 | specifically one of the entires in bfd/cpu-mips.c */
8 |
9 | OUTPUT_ARCH( "riscv" )
10 |
11 | /*----------------------------------------------------------------------*/
12 | /* Sections */
13 | /*----------------------------------------------------------------------*/
14 |
15 | SECTIONS
16 | {
17 |
18 | /* text: test code section */
19 | . = 0x1000;
20 | .text :
21 | {
22 | ../linuxbuild/obj/crt.o(.text)
23 | }
24 |
25 | /* data segment */
26 | .data : { *(.data) }
27 |
28 | .sdata : {
29 | _gp = . + 0x800;
30 | *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*)
31 | *(.sdata .sdata.* .gnu.linkonce.s.*)
32 | }
33 |
34 | /* bss segment */
35 | .sbss : {
36 | *(.sbss .sbss.* .gnu.linkonce.sb.*)
37 | *(.scommon)
38 | }
39 | .bss : { *(.bss) }
40 |
41 | /* thread-local data segment */
42 | .tdata :
43 | {
44 | _tls_data = .;
45 | ../linuxbuild/obj/crt.o(.tdata.begin)
46 | *(.tdata)
47 | ../linuxbuild/obj/crt.o(.tdata.end)
48 | }
49 | .tbss :
50 | {
51 | *(.tbss)
52 | ../linuxbuild/obj/crt.o(.tbss.end)
53 | }
54 |
55 | /* End of uninitalized data segement */
56 | _end = .;
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/rocket_soc/fw/boot/makefiles/util.mak:
--------------------------------------------------------------------------------
1 | # mkdir: -p = --parents. No error if dir exists
2 | # -v = --verbose. print a message for each created directory
3 | MKDIR = mkdir -pv
4 | # rm: -r = --recursive. Remove the contents of dirs recursively
5 | # -v = --verbose. Explain what is being done
6 | # -f = --force.Ignore nonexistent files, never prompt
7 | # --no-preserve-root.
8 | RM = rm -rvf --no-preserve-root
9 |
10 | ECHO = echo
11 |
12 | export MKDIR RM ECHO
13 |
--------------------------------------------------------------------------------
/rocket_soc/fw/boot/src/crt.S:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/fw/boot/src/crt.S
--------------------------------------------------------------------------------
/rocket_soc/fw/common/axi_maps.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief AXI4 device mapping
6 | * @details Don't use this address directly use Kernel interface to get
7 | * detected device interface.
8 | ******************************************************************************/
9 |
10 | #ifndef __AXI_MAPS_H__
11 | #define __AXI_MAPS_H__
12 |
13 | #include
14 | #include "axi_const.h"
15 | #include "maps/map_pnp.h"
16 | #include "maps/map_gpio.h"
17 | #include "maps/map_uart.h"
18 | #include "maps/map_irqctrl.h"
19 | #include "maps/map_rfctrl.h"
20 | #include "maps/map_gnssengine.h"
21 | #include "maps/map_ethmac.h"
22 |
23 | #define ADDR_NASTI_SLAVE_FWIMAGE 0x00100000
24 | #define ADDR_NASTI_SLAVE_SRAM 0x10000000
25 | #define ADDR_NASTI_SLAVE_GPIO 0x80000000
26 | #define ADDR_NASTI_SLAVE_UART1 0x80001000
27 | #define ADDR_NASTI_SLAVE_IRQCTRL 0x80002000
28 | #define ADDR_NASTI_SLAVE_GNSSENGINE 0x80003000
29 | #define ADDR_NASTI_SLAVE_RFCTRL 0x80004000
30 | #define ADDR_NASTI_SLAVE_GPTIMERS 0x80005000
31 | #define ADDR_NASTI_SLAVE_FSEGPS 0x8000a000
32 | #define ADDR_NASTI_SLAVE_ETHMAC 0x80040000
33 | #define ADDR_NASTI_SLAVE_PNP 0xfffff000
34 |
35 |
36 | // Interrupt pins assignemts:
37 | #define CFG_IRQ_UNUSED 0
38 | #define CFG_IRQ_UART1 1
39 | #define CFG_IRQ_ETHMAC 2
40 | #define CFG_IRQ_GPTIMERS 3
41 | #define CFG_IRQ_MISS_ACCESS 4
42 | #define CFG_IRQ_GNSSENGINE 5
43 | #define CFG_IRQ_TOTAL 6
44 |
45 |
46 | #endif // __AXI_MAPS_H__
47 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/iface.h:
--------------------------------------------------------------------------------
1 | //****************************************************************************
2 | // Entity: GNSS channels firmware
3 | // Contact: chief@gnss-sensor.com
4 | // Description: Virtual Firmware interface for any implementation
5 | //****************************************************************************
6 |
7 | #ifndef __IFACE_H__
8 | #define __IFACE_H__
9 |
10 | class IFace {
11 | public:
12 | IFace(const char *name) : face_name_(name) {}
13 | virtual const char *getFaceName() { return face_name_; }
14 | private:
15 | const char *face_name_;
16 | };
17 |
18 | #endif//__IFACE_H__
19 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_ethmac.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Ethernet MAC memory map.
6 | ******************************************************************************/
7 | #ifndef __MAP_ETHERNET_H__
8 | #define __MAP_ETHERNET_H__
9 |
10 | #include
11 |
12 | typedef struct eth_map {
13 | volatile uint32_t control;
14 | volatile uint32_t status;
15 | volatile uint64_t esa;
16 | //volatile uint32_t esa_msb;
17 | volatile uint32_t mdio;
18 | volatile uint32_t tx_desc_p;
19 | volatile uint32_t rx_desc_p;
20 | volatile uint32_t edclip;
21 | } eth_map;
22 |
23 | #endif // __MAP_ETHERNET_H__
24 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_gpio.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief GPIO register mapping definition.
6 | ******************************************************************************/
7 |
8 | #ifndef __MAP_GPIO_H__
9 | #define __MAP_GPIO_H__
10 |
11 | #include
12 |
13 | typedef struct gpio_map {
14 | volatile uint32_t led;
15 | volatile uint32_t dip;
16 | volatile uint32_t reg2;
17 | volatile uint32_t reg3;
18 | volatile uint32_t led_period;
19 | volatile uint32_t reg5;
20 | volatile uint32_t reg6;
21 | } gpio_map;
22 |
23 | #endif // __MAP_GPIO_H__
24 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_gptimers.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief General Purpose Timers register mapping definition.
6 | ******************************************************************************/
7 | #ifndef __MAP_GPTIMERS_H__
8 | #define __MAP_GPTIMERS_H__
9 |
10 | #include
11 |
12 | #define TIMER_CONTROL_ENA (1 << 0)
13 | #define TIMER_CONTROL_IRQ_ENA (1 << 1)
14 |
15 | typedef struct gptimer_type {
16 | volatile uint32_t control;
17 | volatile uint32_t rsv1;
18 | volatile uint64_t cur_value;
19 | volatile uint64_t init_value;
20 | } gptimer_type;
21 |
22 |
23 | typedef struct gptimers_map {
24 | uint64_t highcnt;
25 | uint32_t pending;
26 | uint32_t rsvr[13];
27 | gptimer_type timer[2];
28 | } gptimers_map;
29 |
30 | #endif // __MAP_GPTIMERS_H__
31 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_irqctrl.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief Interrupt Controller register mapping definition.
6 | ******************************************************************************/
7 |
8 | #ifndef __MAP_IRQCTRL_H__
9 | #define __MAP_IRQCTRL_H__
10 |
11 | #include
12 | typedef void (*IRQ_TABLE_HANDLER)(int idx, void *arg);
13 |
14 | typedef struct irqctrl_map {
15 | volatile uint32_t irq_mask; // 0x00: [RW] 1=disable; 0=enable
16 | volatile uint32_t irq_pending; // 0x04: [RW]
17 | volatile uint32_t irq_clear; // 0x08: [WO]
18 | volatile uint32_t irq_rise; // 0x0C: [WO]
19 | volatile uint64_t isr_table; // 0x10: [RW]
20 | volatile uint64_t dbg_cause; // 0x18:
21 | volatile uint64_t dbg_epc; // 0x20:
22 | volatile uint32_t irq_lock; // 0x28: lock/unlock all interrupts
23 | volatile uint32_t irq_cause_idx;// 0x2c:
24 | } irqctrl_map;
25 |
26 | #endif // __MAP_IRQCTRL_H__
27 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_rfctrl.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief RF Fron-end controller register mapping definition.
6 | ******************************************************************************/
7 | #ifndef __MAP_RFCTRL_H__
8 | #define __MAP_RFCTRL_H__
9 |
10 | #include
11 |
12 | typedef struct rfctrl_map {
13 | volatile uint32_t conf1; // 0x00
14 | volatile uint32_t conf2; // 0x04
15 | volatile uint32_t conf3; // 0x08/
16 | volatile uint32_t pllconf; // 0x0C/
17 | volatile uint32_t div; // 0x10
18 | volatile uint32_t fdiv; // 0x14
19 | volatile uint32_t strm; // 0x18
20 | volatile uint32_t clkdiv; // 0x1C
21 | volatile uint32_t test1; // 0x20
22 | volatile uint32_t test2; // 0x24
23 | volatile uint32_t scale; // 0x28
24 | volatile uint32_t run; // 0x2C
25 | volatile uint32_t reserved1[3]; // 0x30,0x34,0x38
26 | volatile uint32_t rw_ant_status;// 0x3C
27 | } rfctrl_map;
28 |
29 | #endif // __MAP_RFCTRL_H__
30 |
--------------------------------------------------------------------------------
/rocket_soc/fw/common/maps/map_uart.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file
3 | * @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | * @author Sergey Khabarov - sergeykhbr@gmail.com
5 | * @brief UART register mapping definition.
6 | ******************************************************************************/
7 |
8 | #ifndef __MAP_UART_H__
9 | #define __MAP_UART_H__
10 |
11 | #include
12 |
13 | static const uint32_t UART_STATUS_TX_FULL = 0x00000001;
14 | static const uint32_t UART_STATUS_TX_EMPTY = 0x00000002;
15 | static const uint32_t UART_STATUS_RX_FULL = 0x00000010;
16 | static const uint32_t UART_STATUS_RX_EMPTY = 0x00000020;
17 | static const uint32_t UART_STATUS_ERR_PARITY = 0x00000100;
18 | static const uint32_t UART_STATUS_ERR_STOPBIT = 0x00000200;
19 |
20 | typedef struct uart_map {
21 | volatile uint32_t status;
22 | volatile uint32_t scaler;
23 | uint32_t rsrv[2];
24 | volatile uint32_t data;
25 | } uart_map;
26 |
27 | #endif // __MAP_UART_H__
28 |
--------------------------------------------------------------------------------
/rocket_soc/fw/elf2raw64/makefiles/makefile:
--------------------------------------------------------------------------------
1 | include util.mak
2 |
3 | CC=gcc
4 | CFLAGS= -c -g -O2
5 | LDFLAGS=
6 | LIBS=-lstdc++
7 |
8 | SOURCES = \
9 | elfreader.cpp \
10 | main.cpp
11 | OBJECTS = $(SOURCES:.cpp=.o)
12 | EXECUTABLE = elf2raw64
13 | SRC_DIR = ../src
14 | OBJ_DIR = obj
15 | ELF_DIR = elf
16 |
17 | .PHONY: $(EXECUTABLE)
18 |
19 | all: $(EXECUTABLE)
20 |
21 | $(EXECUTABLE): $(OBJECTS)
22 | $(MKDIR) ./$(ELF_DIR)
23 | $(CC) $(LDFLAGS) $(addprefix $(OBJ_DIR)/,$(OBJECTS)) -o $(addprefix $(ELF_DIR)/,$@) -lstdc++
24 |
25 | #.cpp.o:
26 | %.o: $(SRC_DIR)/%.cpp
27 | $(MKDIR) ./$(OBJ_DIR)
28 | $(CC) $(CFLAGS) $< -o $(addprefix $(OBJ_DIR)/,$@)
29 |
--------------------------------------------------------------------------------
/rocket_soc/fw/elf2raw64/makefiles/util.mak:
--------------------------------------------------------------------------------
1 | # mkdir.exe: -p = --parents. No error if dir exists
2 | # -v = --verbose. print a message for each created directory
3 | MKDIR = mkdir -pv
4 | # rm.exe: -r = --recursive. Remove the contents of dirs recursively
5 | # -v = --verbose. Explain what is being done
6 | # -f = --force.Ignore nonexistent files, never prompt
7 | # --no-preserve-root.
8 | RM = rm -rvf --no-preserve-root
9 |
10 | export MKDIR RM
11 |
--------------------------------------------------------------------------------
/rocket_soc/fw/elf2raw64/src/elfreader.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "elftypes.h"
4 | #include
5 |
6 |
7 | class SrcElement
8 | {
9 | friend class dbg;
10 | public:
11 | //uint32 adr;
12 | uint32 val;
13 | uint8 *pDataName; // 0=no name
14 | uint8 *pFuncName;
15 | uint8 *pSectionName;
16 | uint8 *pFileName;
17 | bool bInit;
18 | char disas[128];
19 | };
20 |
21 | class SrcImage
22 | {
23 | friend class dbg;
24 | public:
25 | uint32 entry;
26 | uint32 iSizeWords;
27 | SrcElement *arr;
28 | };
29 |
30 |
31 | class ElfReader
32 | {
33 | int iElfFileSize;
34 | uint8 *elf_img;
35 |
36 | ElfHeaderType *Elf32_Ehdr;
37 | std::vector section;
38 | std::vector debug_symbols;
39 | std::vector program;
40 |
41 | char *pSectionNames; // .shstrtab
42 | char *pSymbolName; // .strtab
43 | uint32 uiRawImageBytes;
44 | SrcImage src_img;
45 |
46 |
47 | void readElfHeader();
48 | void readSections();
49 | void createRawImage();
50 | void attachSymbolsToRawImage();
51 | void readProgramHeader(); // doesn't used information
52 |
53 | void SwapBytes(Elf32_Half &);
54 | void SwapBytes(Elf32_Word &);
55 | void SwapBytes(uint64_t &);
56 | uint32 read32(uint32 off);
57 |
58 |
59 | public:
60 | ElfReader(const char *file_name);
61 | ~ElfReader();
62 |
63 | bool isOpened() { return iElfFileSize != 0; }
64 | void writeRawImage(const char *file_name, uint32 fixed_size=0);
65 | void writeRomHexArray(const char *file_name, uint64 base_addr,
66 | uint32 bytes_per_line, uint32 fixed_size=0);
67 |
68 | };
69 |
--------------------------------------------------------------------------------
/rocket_soc/fw/elf2raw64/src/stdtypes.h:
--------------------------------------------------------------------------------
1 | #ifndef __STDTYPES_H__
2 | #define __STDTYPES_H__
3 |
4 | typedef int int32;
5 | typedef unsigned int uint32;
6 | typedef unsigned short uint16;
7 | typedef unsigned char uint8;
8 | typedef unsigned long long uint64;
9 | #include
10 |
11 |
12 | #endif//__STDTYPES_H__
13 |
14 |
--------------------------------------------------------------------------------
/rocket_soc/fw/helloworld/makefiles/app.ld:
--------------------------------------------------------------------------------
1 | OUTPUT_ARCH( "riscv" )
2 |
3 | /*----------------------------------------------------------------------*/
4 | /* Sections */
5 | /*----------------------------------------------------------------------*/
6 | SECTIONS
7 | {
8 |
9 | /* text: test code section */
10 | . = 0x10000000;
11 | .text :
12 | {
13 | ../../helloworld/makefiles/obj/main.o (.text.startup)
14 | *(.text)
15 | }
16 |
17 | /* data segment */
18 | .data : { *(.data) }
19 |
20 | .sdata : {
21 | *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*)
22 | *(.sdata .sdata.* .gnu.linkonce.s.*)
23 | }
24 |
25 | /* bss segment */
26 | .sbss : {
27 | *(.sbss .sbss.* .gnu.linkonce.sb.*)
28 | *(.scommon)
29 | }
30 | .bss : { *(.bss) }
31 |
32 | /* thread-local data segment */
33 | .tdata :
34 | {
35 | *(.tdata)
36 | }
37 | .tbss :
38 | {
39 | *(.tbss)
40 | }
41 |
42 | /* End of uninitalized data segement */
43 | _end = .;
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/rocket_soc/fw/helloworld/makefiles/makefile:
--------------------------------------------------------------------------------
1 | include util.mak
2 |
3 | TOP_DIR=../../
4 | OBJ_DIR = $(TOP_DIR)helloworld/makefiles/obj
5 | ELF_DIR = $(TOP_DIR)helloworld/makefiles/bin
6 |
7 |
8 | #-----------------------------------------------------------------------------
9 | .SILENT:
10 | TEA = 2>&1 | tee _$@-comp.err
11 |
12 | all: example
13 | $(ECHO) " All done.\n"
14 |
15 | example:
16 | $(ECHO) " Example application building started:"
17 | $(MKDIR) ./$(OBJ_DIR)
18 | $(MKDIR) ./$(ELF_DIR)
19 | make -f make_example TOP_DIR=$(TOP_DIR) OBJ_DIR=$(OBJ_DIR) ELF_DIR=$(ELF_DIR) $@ $(TEA)
20 |
--------------------------------------------------------------------------------
/rocket_soc/fw/helloworld/makefiles/util.mak:
--------------------------------------------------------------------------------
1 | # mkdir: -p = --parents. No error if dir exists
2 | # -v = --verbose. print a message for each created directory
3 | MKDIR = mkdir -pv
4 | # rm: -r = --recursive. Remove the contents of dirs recursively
5 | # -v = --verbose. Explain what is being done
6 | # -f = --force.Ignore nonexistent files, never prompt
7 | # --no-preserve-root.
8 | RM = rm -rvf --no-preserve-root
9 |
10 | ECHO = echo
11 |
12 | export MKDIR RM ECHO
13 |
--------------------------------------------------------------------------------
/rocket_soc/fw/helloworld/src/helloworld.c:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * @file
3 | * @author Sergey Khabarov
4 | * @brief Firmware example.
5 | ****************************************************************************/
6 |
7 | #include
8 | #include
9 | #include
10 | #include "axi_maps.h"
11 |
12 | extern char _end;
13 |
14 | /**
15 | * @name sbrk
16 | * @brief Increase program data space.
17 | * @details Malloc and related functions depend on this.
18 | */
19 | char *sbrk(int incr) {
20 | return &_end;
21 | }
22 |
23 |
24 | void print_uart(const char *buf, int sz) {
25 | uart_map *uart = (uart_map *)ADDR_NASTI_SLAVE_UART1;
26 | for (int i = 0; i < sz; i++) {
27 | while (uart->status & UART_STATUS_TX_FULL) {}
28 | uart->data = buf[i];
29 | }
30 | }
31 |
32 | void helloWorld() {
33 | char ss[256];
34 | int ss_len;
35 | ss_len = sprintf(ss, "Hellow World - %d!!!!\n", 1);
36 | print_uart(ss, ss_len);
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/rocket_soc/fw/helloworld/src/main.c:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * @file
3 | * @author Sergey Khabarov
4 | * @brief Main entry function for real Firmware.
5 | * @details This file matches to linker symbol '.text.startup' and will be
6 | * assigned to default entry point 0x10000000. See linker script.
7 | * @warning DO NOT ADD NEW METHODS INTO THIS FILE
8 | ****************************************************************************/
9 |
10 | extern void helloWorld();
11 |
12 | int main() {
13 | helloWorld();
14 | return 0;
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/rocket_soc/gnsslib/sync/greycnt.vhd:
--------------------------------------------------------------------------------
1 | library ieee;
2 | use ieee.std_logic_1164.all;
3 | use ieee.std_logic_unsigned.all;
4 | use ieee.std_logic_arith.all;
5 |
6 | entity GrayCounter is
7 | generic (
8 | generic_width : integer := 4
9 | );
10 | port ( --'Gray' code count output.
11 | i_nrst : in std_logic; -- Count reset.
12 | i_clk : in std_logic; -- Input clock
13 | i_ena : in std_logic; -- Count enable.
14 | o_cnt : out std_logic_vector (generic_width-1 downto 0)
15 | );
16 | end entity;
17 |
18 | architecture rtl of GrayCounter is
19 | type regs is record
20 | bin_cnt : std_logic_vector (generic_width-1 downto 0);
21 | grey_cnt : std_logic_vector (generic_width-1 downto 0);
22 | end record;
23 | signal r : regs;
24 | begin
25 | proc0 : process (i_clk) begin
26 | if (rising_edge(i_clk)) then
27 | if i_nrst = '0' then
28 | r.bin_cnt <= conv_std_logic_vector(1, generic_width);
29 | r.grey_cnt <= (others=>'0');
30 | elsif i_ena = '1' then
31 | r.bin_cnt <= r.bin_cnt + 1;
32 | r.grey_cnt <= r.bin_cnt(generic_width-1) &
33 | (r.bin_cnt(generic_width-2 downto 0) xor
34 | r.bin_cnt(generic_width-1 downto 1));
35 | end if;
36 | end if;
37 | end process;
38 |
39 | o_cnt <= r.grey_cnt;
40 |
41 | end architecture;
42 |
--------------------------------------------------------------------------------
/rocket_soc/prj/kc705/config_k7.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief FPGA Kintex7 specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := kintex7;
13 | constant CFG_MEMTECH : integer := kintex7;
14 | constant CFG_PADTECH : integer := kintex7;
15 | constant CFG_JTAGTECH : integer := kintex7;
16 | end;
17 |
--------------------------------------------------------------------------------
/rocket_soc/prj/kc705_gnss/config_k7.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief FPGA Kintex7 specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := kintex7;
13 | constant CFG_MEMTECH : integer := kintex7;
14 | constant CFG_PADTECH : integer := kintex7;
15 | constant CFG_JTAGTECH : integer := kintex7;
16 | end;
17 |
--------------------------------------------------------------------------------
/rocket_soc/prj/ml605/config_v6.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief FPGA Virtex6 specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := virtex6;
13 | constant CFG_MEMTECH : integer := virtex6;
14 | constant CFG_PADTECH : integer := virtex6;
15 | constant CFG_JTAGTECH : integer := virtex6;
16 | end;
17 |
--------------------------------------------------------------------------------
/rocket_soc/prj/ml605_gnss/config_v6.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief FPGA Virtex6 specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := virtex6;
13 | constant CFG_MEMTECH : integer := virtex6;
14 | constant CFG_PADTECH : integer := virtex6;
15 | constant CFG_JTAGTECH : integer := virtex6;
16 | end;
17 |
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/.gitignore:
--------------------------------------------------------------------------------
1 | *.wlf
2 | *.mti
3 | *.do
4 | ambalib/*
5 | !ambalib/_info
6 | commonlib/*
7 | !commonlib/_info
8 | gnsslib/*
9 | !gnsslib/_info
10 | rocketlib/*
11 | !rocketlib/_info
12 | riverlib/*
13 | !riverlib/_info
14 | techmap/*
15 | !techmap/_info
16 | work/*
17 | !work/_info
18 |
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/ambalib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/ambalib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/commonlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/commonlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/config_msim.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief ModelSim specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := inferred;
13 | constant CFG_MEMTECH : integer := inferred;
14 | constant CFG_PADTECH : integer := inferred;
15 | constant CFG_JTAGTECH : integer := inferred;
16 |
17 | end;
18 |
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/riverlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/riverlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/rocketlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/rocketlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/techmap/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/techmap/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim/work/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim/work/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/.gitignore:
--------------------------------------------------------------------------------
1 | *.wlf
2 | *.mti
3 | *.do
4 | ambalib/*
5 | !ambalib/_info
6 | commonlib/*
7 | !commonlib/_info
8 | gnsslib/*
9 | !gnsslib/_info
10 | rocketlib/*
11 | !rocketlib/_info
12 | riverlib/*
13 | !riverlib/_info
14 | techmap/*
15 | !techmap/_info
16 | work/*
17 | !work/_info
18 |
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/ambalib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/ambalib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/commonlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/commonlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/config_msim.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief ModelSim specific constants definition.
6 | ------------------------------------------------------------------------------
7 | library techmap;
8 | use techmap.gencomp.all;
9 |
10 | package config_target is
11 | -- Technology and synthesis options
12 | constant CFG_FABTECH : integer := inferred;
13 | constant CFG_MEMTECH : integer := inferred;
14 | constant CFG_PADTECH : integer := inferred;
15 | constant CFG_JTAGTECH : integer := inferred;
16 |
17 | end;
18 |
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/riverlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/riverlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/rocketlib/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/rocketlib/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/techmap/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/techmap/_info
--------------------------------------------------------------------------------
/rocket_soc/prj/modelsim_gnss/work/_info:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/riscveval/Rocket-Chip/f99c68166d32a66917286853e490a7de661e1202/rocket_soc/prj/modelsim_gnss/work/_info
--------------------------------------------------------------------------------
/rocket_soc/riverlib/core/stacktrbuf.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief Stack trace buffer on hardware level.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library commonlib;
11 | use commonlib.types_common.all;
12 |
13 | entity StackTraceBuffer is
14 | generic (
15 | abits : integer := 5;
16 | dbits : integer := 64
17 | );
18 | port (
19 | i_clk : in std_logic;
20 | i_raddr : in std_logic_vector(abits-1 downto 0);
21 | o_rdata : out std_logic_vector(dbits-1 downto 0);
22 | i_we : in std_logic;
23 | i_waddr : in std_logic_vector(abits-1 downto 0);
24 | i_wdata : in std_logic_vector(dbits-1 downto 0)
25 | );
26 | end;
27 |
28 | architecture arch_StackTraceBuffer of StackTraceBuffer is
29 |
30 | type ram_type is array ((2**abits)-1 downto 0) of std_logic_vector (dbits-1 downto 0);
31 | signal stackbuf : ram_type;
32 | signal raddr : std_logic_vector(abits-1 downto 0);
33 |
34 | begin
35 |
36 | -- registers:
37 | regs : process(i_clk) begin
38 | if rising_edge(i_clk) then
39 | if i_we = '1' then
40 | stackbuf(conv_integer(i_waddr)) <= i_wdata;
41 | end if;
42 | raddr <= i_raddr;
43 | end if;
44 | end process;
45 |
46 | o_rdata <= stackbuf(conv_integer(raddr));
47 |
48 | end;
49 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/bufgmux_fpga.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Clock multiplexer with buffered output for Xilinx FPGA.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library unisim;
11 | use unisim.vcomponents.all;
12 |
13 | entity bufgmux_fpga is
14 | generic (
15 | rf_frontend_ena : boolean := false
16 | );
17 | port (
18 | O : out std_ulogic;
19 | I1 : in std_ulogic;
20 | I2 : in std_ulogic;
21 | S : in std_ulogic
22 | );
23 | end;
24 |
25 |
26 | architecture rtl of bufgmux_fpga is
27 | begin
28 | good : if rf_frontend_ena generate
29 | --! @details BUFGMUX suits much better to switch clock depending DIP[0]
30 | --! signal, but ISE studio doesn't properly synth. such logic.
31 | --! So here we will use ADC signal only.
32 | --mux_buf : BUFGMUX
33 | --port map (
34 | -- O => O,
35 | -- I0 => I1,
36 | -- I1 => I2,
37 | -- S => S
38 | --);
39 | mux_buf : BUFG
40 | port map (
41 | O => O,
42 | I => I1
43 | );
44 | end generate;
45 |
46 | bad : if not rf_frontend_ena generate
47 | mux_buf : BUFG
48 | port map (
49 | O => O,
50 | I => I2
51 | );
52 | end generate;
53 |
54 | end;
55 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/bufgmux_micron180.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Clock multiplexer with buffered output for Mikron 180 nm.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 |
11 | entity bufgmux_micron180 is
12 | port (
13 | O : out std_ulogic;
14 | I1 : in std_ulogic;
15 | I2 : in std_ulogic;
16 | S : in std_ulogic
17 | );
18 | end;
19 |
20 |
21 | architecture rtl of bufgmux_micron180 is
22 | begin
23 |
24 | O <= I1 when S = '0' else I2;
25 | -- TODO: clock buffer
26 |
27 |
28 | end;
29 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/ibuf_inferred.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Input buffer for simulation.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 |
11 | entity ibuf_inferred is
12 | port (
13 | o : out std_logic;
14 | i : in std_logic
15 | );
16 | end;
17 |
18 | architecture rtl of ibuf_inferred is
19 |
20 | begin
21 |
22 | o <= i;
23 |
24 | end;
25 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/ibuf_tech.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Virtual simple input buffer.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 |
13 | entity ibuf_tech is
14 | generic
15 | (
16 | generic_tech : integer := 0
17 | );
18 | port (
19 | o : out std_logic;
20 | i : in std_logic
21 | );
22 | end;
23 |
24 | architecture rtl of ibuf_tech is
25 |
26 | component ibuf_inferred is
27 | port (
28 | o : out std_logic;
29 | i : in std_logic
30 | );
31 | end component;
32 |
33 | component ibuf_micron180 is
34 | port (
35 | o : out std_logic;
36 | i : in std_logic
37 | );
38 | end component;
39 |
40 | begin
41 |
42 | m180 : if generic_tech = micron180 generate
43 | bufm : ibuf_micron180 port map
44 | (
45 | o => o,
46 | i => i
47 | );
48 | end generate;
49 |
50 | inf0 : if generic_tech /= micron180 generate
51 | bufinf : ibuf_inferred port map
52 | (
53 | o => o,
54 | i => i
55 | );
56 | end generate;
57 |
58 |
59 | end;
60 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/ibufg_tech.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Virtual clock buffered output.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 |
11 | library techmap;
12 | use techmap.gencomp.all;
13 |
14 | entity ibufg_tech is
15 | generic
16 | (
17 | tech : integer := 0
18 | );
19 | port (
20 | O : out std_ulogic;
21 | I : in std_ulogic
22 | );
23 | end;
24 |
25 | architecture rtl of ibufg_tech is
26 |
27 | component ibufg_xilinx is
28 | port (
29 | O : out std_ulogic;
30 | I : in std_ulogic
31 | );
32 | end component;
33 | signal w_o : std_logic;
34 | begin
35 |
36 |
37 | inf : if tech = inferred generate
38 | w_o <= I;
39 | end generate;
40 |
41 | xlnx : if tech = virtex6 or tech = kintex7 generate
42 | x0 : ibufg_xilinx port map (
43 | O => w_o,
44 | I => I
45 | );
46 | end generate;
47 |
48 | O <= w_o;
49 |
50 | end;
51 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/ibufg_xilinx.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Xilinx clock buffered output.
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library unisim;
11 | use unisim.vcomponents.all;
12 |
13 | entity ibufg_xilinx is
14 | port (
15 | O : out std_ulogic;
16 | I : in std_ulogic
17 | );
18 | end;
19 |
20 |
21 | architecture rtl of ibufg_xilinx is
22 |
23 | begin
24 |
25 | bufg0 : BUFG port map (
26 | O => O,
27 | I => I
28 | );
29 |
30 | end;
31 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/idsbuf_tech.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Virtual input buffer with the differential signals.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 |
13 | entity idsbuf_tech is
14 | generic (
15 | generic_tech : integer := 0
16 | );
17 | port (
18 | clk_p : in std_logic;
19 | clk_n : in std_logic;
20 | o_clk : out std_logic
21 | );
22 | end;
23 |
24 | architecture rtl of idsbuf_tech is
25 |
26 | component idsbuf_xilinx is
27 | port (
28 | clk_p : in std_logic;
29 | clk_n : in std_logic;
30 | o_clk : out std_logic
31 | );
32 | end component;
33 |
34 |
35 | begin
36 |
37 | infer : if generic_tech = inferred generate
38 | o_clk <= clk_p;
39 | end generate;
40 |
41 | xil0 : if generic_tech = virtex6 or generic_tech = kintex7 generate
42 | x1 : idsbuf_xilinx port map (
43 | clk_p => clk_p,
44 | clk_n => clk_n,
45 | o_clk => o_clk
46 | );
47 | end generate;
48 |
49 |
50 | end;
51 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/idsbuf_xilinx.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Input buffer with the differential signals.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library unisim;
11 | use unisim.vcomponents.all;
12 |
13 | entity idsbuf_xilinx is
14 | port (
15 | clk_p : in std_logic;
16 | clk_n : in std_logic;
17 | o_clk : out std_logic
18 | );
19 | end;
20 |
21 | architecture rtl of idsbuf_xilinx is
22 | begin
23 |
24 | x1 : IBUFDS port map (
25 | I => clk_p,
26 | IB => clk_n,
27 | O => o_clk
28 | );
29 |
30 | end;
31 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/igdsbuf_k7.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Gigabits buffer with the differential signals.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library unisim;
11 | use unisim.vcomponents.all;
12 |
13 | entity igdsbuf_kintex7 is
14 | generic (
15 | generic_tech : integer := 0
16 | );
17 | port (
18 | gclk_p : in std_logic;
19 | gclk_n : in std_logic;
20 | o_clk : out std_logic
21 | );
22 | end;
23 |
24 | architecture rtl of igdsbuf_kintex7 is
25 | begin
26 |
27 | x1 : IBUFDS_GTE2 port map (
28 | I => gclk_p,
29 | IB => gclk_n,
30 | CEB => '0',
31 | O => o_clk,
32 | ODIV2 => open
33 | );
34 |
35 | end;
36 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/igdsbuf_tech.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Virtual Gigabits buffer with the differential signals.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 |
13 | entity igdsbuf_tech is
14 | generic (
15 | generic_tech : integer := 0
16 | );
17 | port (
18 | gclk_p : in std_logic;
19 | gclk_n : in std_logic;
20 | o_clk : out std_logic
21 | );
22 | end;
23 |
24 | architecture rtl of igdsbuf_tech is
25 |
26 | component igdsbuf_kintex7 is
27 | generic (
28 | generic_tech : integer := 0
29 | );
30 | port (
31 | gclk_p : in std_logic;
32 | gclk_n : in std_logic;
33 | o_clk : out std_logic
34 | );
35 | end component;
36 |
37 | component igdsbuf_virtex6 is
38 | generic (
39 | generic_tech : integer := 0
40 | );
41 | port (
42 | gclk_p : in std_logic;
43 | gclk_n : in std_logic;
44 | o_clk : out std_logic
45 | );
46 | end component;
47 |
48 | begin
49 |
50 | infer : if generic_tech = inferred generate
51 | o_clk <= gclk_p;
52 | end generate;
53 |
54 | xv6 : if generic_tech = virtex6 generate
55 | x1 : igdsbuf_virtex6 port map (
56 | gclk_p => gclk_p,
57 | gclk_n => gclk_n,
58 | o_clk => o_clk
59 | );
60 | end generate;
61 |
62 | xk7 : if generic_tech = kintex7 generate
63 | x1 : igdsbuf_kintex7 port map (
64 | gclk_p => gclk_p,
65 | gclk_n => gclk_n,
66 | o_clk => o_clk
67 | );
68 | end generate;
69 |
70 |
71 | end;
72 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/igdsbuf_v6.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Gigabits buffer with the differential signals.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library unisim;
11 | use unisim.vcomponents.all;
12 |
13 | entity igdsbuf_virtex6 is
14 | generic (
15 | generic_tech : integer := 0
16 | );
17 | port (
18 | gclk_p : in std_logic;
19 | gclk_n : in std_logic;
20 | o_clk : out std_logic
21 | );
22 | end;
23 |
24 | architecture rtl of igdsbuf_virtex6 is
25 | begin
26 |
27 | x1 : IBUFDS_GTXE1 port map (
28 | I => gclk_p,
29 | IB => gclk_n,
30 | CEB => '0',
31 | O => o_clk,
32 | ODIV2 => open
33 | );
34 |
35 | end;
36 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/iobuf_inferred.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief IO buffer for inferred tech.
6 | ----------------------------------------------------------------------------
7 | library ieee;
8 | use ieee.std_logic_1164.all;
9 |
10 |
11 | entity iobuf_inferred is
12 | port (
13 | o : out std_logic;
14 | io : inout std_logic;
15 | i : in std_logic;
16 | t : in std_logic
17 | );
18 | end;
19 |
20 | architecture rtl of iobuf_inferred is
21 | signal ivalue : std_logic;
22 | begin
23 |
24 | o <= '0';
25 | io <= 'Z' when t = '1' else to_X01(i);
26 |
27 | end;
28 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/iobuf_virtex6.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief IO buffer for fpga virtex6.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | Library UNISIM;
11 | use UNISIM.vcomponents.all;
12 |
13 |
14 | entity iobuf_virtex6 is
15 | port (
16 | o : out std_logic;
17 | io : inout std_logic;
18 | i : in std_logic;
19 | t : in std_logic
20 | );
21 | end;
22 |
23 | architecture rtl of iobuf_virtex6 is
24 |
25 | begin
26 |
27 |
28 | io_inst : IOBUF generic map
29 | (
30 | DRIVE => 12,
31 | IOSTANDARD => "DEFAULT",
32 | SLEW => "SLOW"
33 | ) port map
34 | (
35 | O => o,
36 | IO => io,
37 | I => i,
38 | T => t
39 | );
40 |
41 |
42 | end;
43 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/obuf_inferred.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Simple output buffer for simulation target.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 |
11 |
12 | entity obuf_inferred is
13 | port (
14 | o : out std_logic;
15 | i : in std_logic
16 | );
17 | end;
18 |
19 | architecture rtl of obuf_inferred is
20 |
21 | begin
22 |
23 | o <= i;
24 |
25 | end;
26 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/bufg/obuf_tech.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Virtual simple output buffer.
6 | ----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 |
13 |
14 | entity obuf_tech is
15 | generic
16 | (
17 | generic_tech : integer := 0
18 | );
19 | port (
20 | o : out std_logic;
21 | i : in std_logic
22 | );
23 | end;
24 |
25 | architecture rtl of obuf_tech is
26 |
27 | component obuf_inferred is
28 | port (
29 | o : out std_logic;
30 | i : in std_logic
31 | );
32 | end component;
33 |
34 | component obuf_micron180 is
35 | port (
36 | o : out std_logic;
37 | i : in std_logic
38 | );
39 | end component;
40 |
41 | begin
42 |
43 | m180 : if generic_tech = micron180 generate
44 | bufm : obuf_micron180 port map
45 | (
46 | o => o,
47 | i => i
48 | );
49 | end generate;
50 |
51 | inf0 : if generic_tech /= micron180 generate
52 | bufinf : obuf_inferred port map
53 | (
54 | o => o,
55 | i => i
56 | );
57 | end generate;
58 |
59 |
60 | end;
61 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/bootrom_tech.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | -- Package: fse_v2
3 | -- File: romprn_tech.vhd
4 | -- Author: Sergey Khabarov - sergeykhbr@gmail.com
5 | -- Description: Technology specific Bootable ROM
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 | use techmap.types_mem.all;
13 | library commonlib;
14 | use commonlib.types_common.all;
15 | --! AMBA system bus specific library
16 | library ambalib;
17 | --! AXI4 configuration constants.
18 | use ambalib.types_amba4.all;
19 |
20 | entity BootRom_tech is
21 | generic (
22 | memtech : integer := 0;
23 | sim_hexfile : string
24 | );
25 | port (
26 | clk : in std_logic;
27 | address : in global_addr_array_type;
28 | data : out std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0)
29 | );
30 | end;
31 |
32 | architecture rtl of BootRom_tech is
33 |
34 | component BootRom_inferred is
35 | generic (
36 | hex_filename : string
37 | );
38 | port (
39 | clk : in std_ulogic;
40 | address : in global_addr_array_type;
41 | data : out std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0)
42 | );
43 | end component;
44 |
45 | begin
46 |
47 | genrom0 : if memtech = inferred or is_fpga(memtech) /= 0 generate
48 | infer0 : BootRom_inferred generic map (sim_hexfile)
49 | port map (clk, address, data);
50 | end generate;
51 |
52 | end;
53 |
54 |
55 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/ram32_inferred.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief 32-bits RAM implementation based on registers
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library commonlib;
11 | use commonlib.types_common.all;
12 |
13 | entity Ram32_inferred is
14 | generic (
15 | generic_abits : integer := 10
16 | );
17 | port (
18 | i_clk : in std_logic;
19 | i_address : in std_logic_vector(generic_abits-1 downto 0);
20 | i_wr_ena : in std_logic;
21 | i_data : in std_logic_vector(31 downto 0);
22 | o_data : out std_logic_vector(31 downto 0)
23 | );
24 | end;
25 |
26 | architecture rtl of Ram32_inferred is
27 |
28 | type ram_type is array ((2**generic_abits)-1 downto 0) of std_logic_vector (31 downto 0);
29 | signal RAM : ram_type;
30 | signal adr : std_logic_vector(generic_abits-1 downto 0);
31 |
32 | begin
33 |
34 | -- registers:
35 | regs : process(i_clk) begin
36 | if rising_edge(i_clk) then
37 | if(i_wr_ena='1') then
38 | RAM(conv_integer(i_address)) <= i_data;
39 | end if;
40 | adr <= i_address;
41 | end if;
42 | end process;
43 |
44 | o_data <= RAM(conv_integer(adr));
45 |
46 | end;
47 |
48 |
49 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/romimage_tech.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief Technology specific ROM Image with the Firmware
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library techmap;
11 | use techmap.gencomp.all;
12 | use techmap.types_mem.all;
13 | library commonlib;
14 | use commonlib.types_common.all;
15 | --! AMBA system bus specific library.
16 | library ambalib;
17 | --! AXI4 configuration constants.
18 | use ambalib.types_amba4.all;
19 |
20 | entity RomImage_tech is
21 | generic (
22 | memtech : integer := 0;
23 | sim_hexfile : string
24 | );
25 | port (
26 | clk : in std_logic;
27 | address : in global_addr_array_type;
28 | data : out std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0)
29 | );
30 | end;
31 |
32 | architecture arch_RomImage_tech of RomImage_tech is
33 |
34 | component RomImage_inferred is
35 | generic (
36 | hex_filename : string
37 | );
38 | port (
39 | clk : in std_ulogic;
40 | address : in global_addr_array_type;
41 | data : out std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0)
42 | );
43 | end component;
44 |
45 | begin
46 |
47 | genrom0 : if memtech = inferred or is_fpga(memtech) /= 0 generate
48 | infer0 : RomImage_inferred generic map (
49 | hex_filename => sim_hexfile
50 | ) port map (clk, address, data);
51 | end generate;
52 |
53 | end;
54 |
55 |
56 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/romprn_micron180.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief Galileo Reference E1 codes.
6 | ------------------------------------------------------------------------------
7 | library ieee;
8 | use ieee.std_logic_1164.all;
9 | library commonlib;
10 | use commonlib.types_common.all;
11 | library tech;
12 | use tech.RAMLIB_80_COMPONENTS.all;
13 |
14 | entity RomPrn_micron180 is
15 | port (
16 | i_clk : in std_logic;
17 | i_address : in std_logic_vector(12 downto 0);
18 | o_data : out std_logic_vector(31 downto 0)
19 | );
20 | end;
21 |
22 | architecture rtl of RomPrn_micron180 is
23 |
24 |
25 | begin
26 |
27 |
28 | m180 : ROMD_8192x32m8d4_R0_M4_ns port map
29 | (Q => o_data,
30 | CK => i_clk,
31 | CSN => '0',
32 | OEN => '0',
33 | A => i_address);
34 |
35 | end;
36 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/romprn_tech.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief Technology specific Galileo PRN ROM codes
6 | ------------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | library commonlib;
11 | use commonlib.types_common.all;
12 | library techmap;
13 | use techmap.gencomp.all;
14 | use techmap.types_mem.all;
15 |
16 | entity RomPrn_tech is
17 | generic (
18 | generic_tech : integer := 0
19 | );
20 | port (
21 | i_clk : in std_logic;
22 | i_address : in std_logic_vector(12 downto 0);
23 | o_data : out std_logic_vector(31 downto 0)
24 | );
25 | end;
26 |
27 | architecture rtl of RomPrn_tech is
28 |
29 | component RomPrn_inferred is
30 | port (
31 | clk : in std_ulogic;
32 | inAdr : in std_logic_vector(12 downto 0);
33 | outData : out std_logic_vector(31 downto 0)
34 | );
35 | end component;
36 |
37 | component RomPrn_micron180 is
38 | port (
39 | i_clk : in std_logic;
40 | i_address : in std_logic_vector(12 downto 0);
41 | o_data : out std_logic_vector(31 downto 0)
42 | );
43 | end component;
44 |
45 |
46 | begin
47 |
48 | genrom0 : if generic_tech = inferred or is_fpga(generic_tech) /= 0 generate
49 | romprn_infer : RomPrn_inferred port map
50 | (
51 | i_clk,
52 | i_address,
53 | o_data
54 | );
55 | end generate;
56 | genrom1 : if generic_tech = micron180 generate
57 | romprn_micr : RomPrn_micron180 port map
58 | (
59 | i_clk,
60 | i_address,
61 | o_data
62 | );
63 | end generate;
64 | end;
65 |
66 |
67 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/mem/sram8_inferred.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov
5 | --! @brief 8-bits memory block with the generic data size parameter.
6 | ------------------------------------------------------------------------------
7 | library ieee;
8 | use ieee.std_logic_1164.all;
9 | use ieee.numeric_std.ALL;
10 | use IEEE.STD_LOGIC_TEXTIO.ALL;
11 | use std.textio.all;
12 | library commonlib;
13 | use commonlib.types_common.all;
14 |
15 | entity sram8_inferred is
16 | generic (
17 | abits : integer := 12;
18 | byte_idx : integer := 0
19 | );
20 | port (
21 | clk : in std_ulogic;
22 | address : in std_logic_vector(abits-1 downto 0);
23 | rdata : out std_logic_vector(7 downto 0);
24 | we : in std_logic;
25 | wdata : in std_logic_vector(7 downto 0)
26 | );
27 | end;
28 |
29 | architecture arch_sram8_inferred of sram8_inferred is
30 |
31 | constant SRAM_LENGTH : integer := 2**abits;
32 | type ram_type is array (0 to SRAM_LENGTH-1) of std_logic_vector(7 downto 0);
33 |
34 | signal ram : ram_type;
35 | signal adr : std_logic_vector(abits-1 downto 0);
36 |
37 | begin
38 |
39 | reg : process (clk, address, wdata) begin
40 | if rising_edge(clk) then
41 | if we = '1' then
42 | ram(conv_integer(address)) <= wdata;
43 | end if;
44 | adr <= address;
45 | end if;
46 | end process;
47 |
48 | rdata <= ram(conv_integer(adr));
49 | end;
50 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/pll/SysPLL_inferred.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @details PLL instance for the behaviour simulation
6 | --!
7 | --! "Output Output Phase Duty Pk-to-Pk Phase"
8 | --! "Clock Freq (MHz) (degrees) Cycle (%) Jitter (ps) Error (ps)"
9 | --!
10 | --! CLK_OUT1____70.000
11 | -----------------------------------------------------------------------------
12 |
13 | library ieee;
14 | use ieee.std_logic_1164.all;
15 | library commonlib;
16 | use commonlib.types_common.all;
17 |
18 | --library unisim;
19 | --use unisim.vcomponents.all;
20 |
21 | entity SysPLL_inferred is
22 | port
23 | (-- Clock in ports
24 | CLK_IN : in std_logic;
25 | -- Clock out ports
26 | CLK_OUT1 : out std_logic;
27 | -- Status and control signals
28 | RESET : in std_logic;
29 | LOCKED : out std_logic
30 | );
31 | end SysPLL_inferred;
32 |
33 | architecture rtl of SysPLL_inferred is
34 |
35 | begin
36 |
37 | CLK_OUT1 <= CLK_IN;
38 | LOCKED <= not RESET;
39 |
40 | end rtl;
41 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/pll/SysPLL_micron180.vhd:
--------------------------------------------------------------------------------
1 | --
2 | ------------------------------------------------------------------------------
3 | -- "Output Output Phase Duty Pk-to-Pk Phase"
4 | -- "Clock Freq (MHz) (degrees) Cycle (%) Jitter (ps) Error (ps)"
5 | ------------------------------------------------------------------------------
6 | -- CLK_OUT1____70.000
7 | --
8 |
9 | library ieee;
10 | use ieee.std_logic_1164.all;
11 | use ieee.std_logic_unsigned.all;
12 | use ieee.std_logic_arith.all;
13 | use ieee.numeric_std.all;
14 |
15 |
16 | entity SysPLL_micron180 is
17 | port
18 | (
19 | CLK_IN : in std_logic;
20 | -- Clock out ports
21 | CLK_OUT1 : out std_logic;
22 | CLK_OUT2 : out std_logic;
23 | -- Status and control signals
24 | RESET : in std_logic;
25 | LOCKED : out std_logic
26 | );
27 | end SysPLL_micron180;
28 |
29 | architecture rtl of SysPLL_micron180 is
30 |
31 | begin
32 |
33 | CLK_OUT1 <= CLK_IN;
34 | LOCKED <= not RESET;
35 |
36 |
37 | end rtl;
38 |
--------------------------------------------------------------------------------
/rocket_soc/techmap/pll/clkp90_v6.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | --! @file
3 | --! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4 | --! @author Sergey Khabarov - sergeykhbr@gmail.com
5 | --! @brief Clock phase offset generator (90 deg) for FPGA Virtex6.
6 | ------------------------------------------------------------------------------
7 |
8 | --! Standard library
9 | library ieee;
10 | use ieee.std_logic_1164.all;
11 | library unisim;
12 | use unisim.vcomponents.all;
13 |
14 | entity clkp90_virtex6 is port (
15 | i_clk : in std_logic;
16 | o_clk : out std_logic;
17 | o_clkp90 : out std_logic
18 | );
19 | end clkp90_virtex6;
20 |
21 | architecture rtl of clkp90_virtex6 is
22 | signal clk_buf : std_logic;
23 | begin
24 |
25 | x0 : BUFG port map (
26 | O => clk_buf,
27 | I => i_clk
28 | );
29 |
30 | x1 : ODDR port map (
31 | Q => o_clkp90,
32 | C => clk_buf,
33 | CE => '1',
34 | D1 => '0',
35 | D2 => '1',
36 | R => '0',
37 | S => '0'
38 | );
39 |
40 | o_clk <= clk_buf;
41 |
42 | end;
43 |
--------------------------------------------------------------------------------
/zephyr/.gitignore:
--------------------------------------------------------------------------------
1 | archive
--------------------------------------------------------------------------------
/zephyr/_howto_build:
--------------------------------------------------------------------------------
1 | 1. Create folder for Zephyr OS
2 | mkdir zephyr_150
3 | cd zephyr_150
4 |
5 | 2. Clone repository (see https://www.zephyrproject.org/downloads)
6 | git clone https://gerrit.zephyrproject.org/r/zephyr
7 | cd zephyr
8 | git checkout tags/v1.5.0
9 |
10 | 3. Set environment variable:
11 | export ZEPHYR_BASE=/zephyr_150/zephyr
12 |
13 | 4. Copy *.diff patch to $(ZEPHYR_BASE) and apply it:
14 | cp ../../riscv_vhdl/zephyr/v1.5.0-branch.diff .
15 | git apply v1.5.0-branch.diff
16 |
17 | 5. Build 'shell' example and generate ROM-image for FPGA or Simulator (GCC must be installed):
18 | cd samples/shell
19 | make ARCH=riscv64 CROSS_COMPILE=/home//gnu-toolchain-rv64d/bin/riscv64-unknown-elf- BOARD=riscv_gnss 2>&1 | tee _err.log
20 | elf2raw64 outdir/zephyr.elf -h -f 262144 -l 8 -o fwimage.hex
21 |
22 | 6. Copy fwimage.hex into /riscv_vhdl/rocket_soc/fw_images
23 |
24 | Your board is now udpated with the new firmware!
25 |
26 |
27 | INFO:
28 | Archives with patched Zephyr OS and others *.diff files are available here:
29 | http://gnss-sensor.com/index.php?LinkID=15
30 |
--------------------------------------------------------------------------------