diff --git a/firmware/cpld/sgpio_debug/Makefile b/firmware/cpld/sgpio_debug/Makefile new file mode 100644 index 00000000..0c07a536 --- /dev/null +++ b/firmware/cpld/sgpio_debug/Makefile @@ -0,0 +1,47 @@ +# xst -intstyle ise -ifn top.xst -ofn top.syr +# ngdbuild -intstyle ise -dd _ngo -uc top.ucf -p xc2c64a-VQ100-7 top.ngc top.ngd +# cpldfit -intstyle ise -p xc2c64a-7-VQ100 -ofmt vhdl -optimize density -loc on -slew slow -init low -inputs 32 -pterms 28 -unused pullup -terminate float -iostd LVCMOS33 top.ngd +# tsim -intstyle ise top top.nga +# taengine -intstyle ise -f top -l top.tim -e {taengine.err} +# hprep6 -s IEEE1149 -i top +# vhdtdtfi -prj sgpio_debug -o top.vhi -module top -template /opt/Xilinx/14.7/ISE_DS/ISE/data/vhdlinst.tft -deleteonerror -lib work top.vhd + +DESIGN=top + +DEVICE=xc2c64a +DEVICE_SPEED=7 +DEVICE_PACKAGE=VQ100 + +OUTFILES_XST=$(DESIGN).ngc $(DESIGN).syr $(DESIGN).ngr $(DESIGN)_xst.xrpt $(DESIGN).lso _xmsgs/xst.xmsgs +OUTFILES_NGDBUILD=$(DESIGN).ngd $(DESIGN).bld $(DESIGN)_ngdbuild.xrpt _xmsgs/ngdbuild.xmsgs _ngo/netlist.lst xlnx_auto_0_xdb/cst.xbcd +OUTFILES_CPLDFIT=$(DESIGN).vm6 $(DESIGN).tspec t6.phd t6.dat t55.phd t55.dat t1.phd t1.dat $(DESIGN).log $(DESIGN).chk $(DESIGN).rpt $(DESIGN).xml $(DESIGN)_build.xml $(DESIGN).pad $(DESIGN)_pad.csv $(DESIGN).pnx $(DESIGN).mfd $(DESIGN).cxt $(DESIGN).gyd _xmsgs/cpldfit.xmsgs +OUTFILES_HPREP6=$(DESIGN).jed tmperr.err _xmsgs/hprep6.xmsgs +OUTFILES_IMPACT_SVF=default.svf _impactbatch.log +OUTFILES_IMPACT_XSVF=default.xsvf _impactbatch.log + +all: default.svf default.xsvf + +$(DESIGN).ngc: $(DESIGN).xst $(DESIGN).prj + mkdir -p xst/projnav.tmp + xst -intstyle ise -ifn $(DESIGN).xst -ofn $(DESIGN).syr + +$(DESIGN).ngd: $(DESIGN).ngc $(DESIGN).ucf + ngdbuild -intstyle ise -dd _ngo -uc $(DESIGN).ucf -p $(DEVICE)-$(DEVICE_PACKAGE)-$(DEVICE_SPEED) $(DESIGN).ngc $(DESIGN).ngd + +$(DESIGN).vm6: $(DESIGN).ngd + cpldfit -intstyle ise -p $(DEVICE)-$(DEVICE_SPEED)-$(DEVICE_PACKAGE) -ofmt vhdl -optimize speed -loc on -slew slow -init low -inputs 32 -pterms 36 -unused pullup -terminate float -iostd LVCMOS33 $(DESIGN).ngd + +$(DESIGN).jed: $(DESIGN).vm6 + hprep6 -s IEEE1149 -i $(DESIGN).vm6 + +default.svf: $(DESIGN).jed batch_svf + impact -batch batch_svf + +default.xsvf: $(DESIGN).jed batch_xsvf + impact -batch batch_xsvf + +.PHONY: clean + +clean: + rm -f $(OUTFILES_XST) $(OUTFILES_NGDBUILD) $(OUTFILES_CPLDFIT) $(OUTFILES_HPREP6) $(OUTFILES_IMPACT_SVF) $(OUTFILES_IMPACT_XSVF) + rm -rf xlnx_auto_0_xdb/ _ngo/ _xmsgs/ xst/ diff --git a/firmware/cpld/sgpio_debug/README.md b/firmware/cpld/sgpio_debug/README.md new file mode 100644 index 00000000..018cfc9d --- /dev/null +++ b/firmware/cpld/sgpio_debug/README.md @@ -0,0 +1,33 @@ +CPLD interface between LPC43xx microcontroller SGPIO peripheral and MAX5864 +RF codec. + +CPLD-based triggered capture +============================ + +To build this VHDL project and produce an SVF file for flashing the CPLD: + +* Xilinx WebPACK 13.4 for Windows or Linux. + +Generate an XSVF +================ + +After generating a programming file: + +* In the ISE Project Navigator, "Processes: top - Behavioral" pane, double-click "Configure Target Device". +* Click "OK" to open iMPACT. +* Ctrl-N to create a "New Project". +* "Yes" to automatically create and save a project file. +* Select "Prepare a Boundary-Scan File", choose "XSVF". +* Select file name "default.xsvf". +* Click "OK" to start adding devices. +* Assign new configuration file: "top.jed". +* Right-click the "xc2c64a top.jed" icon and select "Erase". Accept defaults. +* Right-click the "xc2c64a top.jed" icon and select "Program". +* Right-click the "xc2c64a top.jed" icon and select "Verify". +* Choose menu "Output" -> "XSVF File" -> "Stop Writing to XSVF File". +* Close iMPACT. + +To Program +========== + +$ hackrf_cpldjtag -x default.xsvf diff --git a/firmware/cpld/sgpio_debug/batch_svf b/firmware/cpld/sgpio_debug/batch_svf new file mode 100755 index 00000000..35f57ccc --- /dev/null +++ b/firmware/cpld/sgpio_debug/batch_svf @@ -0,0 +1,7 @@ +setMode -bscan +setCable -port svf -file default.svf +addDevice -p 1 -file top.jed +Erase -p 1 +Program -p 1 -e -v +Verify -p 1 +quit diff --git a/firmware/cpld/sgpio_debug/batch_xsvf b/firmware/cpld/sgpio_debug/batch_xsvf new file mode 100755 index 00000000..70612016 --- /dev/null +++ b/firmware/cpld/sgpio_debug/batch_xsvf @@ -0,0 +1,7 @@ +setMode -bscan +setCable -port xsvf -file default.xsvf +addDevice -p 1 -file top.jed +Erase -p 1 +Program -p 1 -e -v +Verify -p 1 +quit diff --git a/firmware/cpld/sgpio_debug/default.xsvf b/firmware/cpld/sgpio_debug/default.xsvf new file mode 100644 index 00000000..c7362e05 Binary files /dev/null and b/firmware/cpld/sgpio_debug/default.xsvf differ diff --git a/firmware/cpld/sgpio_debug/sgpio_debug.xise b/firmware/cpld/sgpio_debug/sgpio_debug.xise new file mode 100755 index 00000000..e925cd4d --- /dev/null +++ b/firmware/cpld/sgpio_debug/sgpio_debug.xise @@ -0,0 +1,246 @@ + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/firmware/cpld/sgpio_debug/top.jed b/firmware/cpld/sgpio_debug/top.jed new file mode 100644 index 00000000..47c6002e --- /dev/null +++ b/firmware/cpld/sgpio_debug/top.jed @@ -0,0 +1,757 @@ +Programmer Jedec Bit Map +Date Extracted: Mon Jan 20 17:17:07 2020 + +QF25812* +QP100* +QV0* +F0* +X0* +J0 0* +N VERSION P.20131013* +N DEVICE XC2C64A-7-VQ100* + +Note Block 0 * +Note Block 0 ZIA * +L000000 1110110011111111* +L000016 1110101011111111* +L000032 1110101011111111* +L000048 1110101011111111* +L000064 1110110011111111* +L000080 1110101011111111* +L000096 1110101011111111* +L000112 1110011011111111* +L000128 1110101011111111* +L000144 1110101011111111* +L000160 1110011011111111* +L000176 1111111111111111* +L000192 1110110011111111* +L000208 1110101011111111* +L000224 1110110011111111* +L000240 1111111011110011* +L000256 1110101011111111* +L000272 1111111111111111* +L000288 1111111111111111* +L000304 1110110011111111* +L000320 1110110011111111* +L000336 1111111011010111* +L000352 1111111011100111* +L000368 1111111111111111* +L000384 1111111011100111* +L000400 1111111111111111* +L000416 1110110011111111* +L000432 1110110011111111* +L000448 1111111111111111* +L000464 1111111111111111* +L000480 1111111111111111* +L000496 1111111111111111* +L000512 1111111011010111* +L000528 1111111111111111* +L000544 1111111111111111* +L000560 1111111011010111* +L000576 1111111111111111* +L000592 1111111111111111* +L000608 1111111111111111* +L000624 1111111111111111* + +Note Block 0 PLA AND array * +L000640 11111111111111111111111110111111111111111111111111111111111111111111111011111111* +L000720 11111110101111111111111111111111111111111111111111111111111111111111110111111111* +L000800 10111111111111111111111111111111111111111111111111111111111111111111111111111111* +L000880 10111111111111111111111111110111111111111111111111111111111111111111110111111111* +L000960 01111111111111111111111111111011111111111111111111111111111111111111110111111111* +L001040 11111111111111110111111111111111111111111111111111111111111111111111111011111111* +L001120 01111111111111111111111111110111111111111111111111111111111111111111110111111111* +L001200 11111111111101111111111111111111111111111111111111111111111111111111111011111111* +L001280 01111111111111111111111111110111111111011111111111111111111111111111110111111111* +L001360 11111111111111111111111111011111111111111111111111111111111111111111111011111111* +L001440 01101111111111111111111111111111111111111111111111111111111111111111111111111111* +L001520 11111111111111110111111111111011111111111111111111111111111111111111111111111111* +L001600 11111111111111111011111111110111111111111111111111111111111111111111111111111111* +L001680 11111111111111111111111111111111111111111101111111111111111111111111111111111111* +L001760 11111111111101111111111111111111111111101111111111111111111111111111111111111111* +L001840 11111111111110111111111111111111111111011111111111111111111111111111111111111111* +L001920 11111111111111111111111111111111111111111111111111111111111111110111111111111111* +L002000 11111111111111111111111111011111111111111011111111111111111111111111111111111111* +L002080 11111111111111111111111111101111111111110111111111111111111111111111111111111111* +L002160 11111111111111111111111111111111111111111111111101111111111111111111111111111111* +L002240 11111111111111101101111111111111111111111111111111111111111111111111111111111111* +L002320 01111111111111111111111111110111111111010111111111111111111111111111110111111111* +L002400 11111111111111111111111111111111111111111111011111111111111111111111111111111111* +L002480 11111111111111111101111111111111111111111111111111111111111111111111111011111111* +L002560 01111111111111011111111111110111111111010111111111111111111111111111110111111111* +L002640 11111111111111111111111111111101111111111111111111111111111111111111111111111111* +L002720 11110111111111111111111111111111111111111111111111111111111111111111111011111111* +L002800 01111111111111011111011111110111111111010111111111111111111111111111110111111111* +L002880 11111111111111111111111111111111111111111111111111110111111111111111111011111111* +L002960 01111111110111011111011111110111111111010111111111111111111111111111110111111111* +L003040 11111111111111111111111111111111111111111111111111111101111111111111111011111111* +L003120 11111111111111111111111111111111011111111111111111111111111111111111110111111111* +L003200 10011111111111111111111111111111111111111111111111111111111111111111111111111111* +L003280 11111111111111011110111111111111111111111111111111111111111111111111111111111111* +L003360 11111111110111111111111111111111111111111111111111111111111111111111110111111111* +L003440 11110111111111111111101111111111111111111111111111111111111111111111111111111111* +L003520 11111011111111111111011111111111111111111111111111111111111111111111111111111111* +L003600 11111111111111111111011111111111111111111111111111111111111111111111110111111111* +L003680 11111111111011111111111111111111111111111111111111110111111111111111111111111111* +L003760 11111111110111111111111111111111111111111111111111111011111111111111111111111111* +L003840 11111111111111011111111111111111111111111111111111111111111111111111110111111111* +L003920 11111111111111111111111111111111101111111111111111111101111111111111111111111111* +L004000 11111111111111111111111111111111011111111111111111111110111111111111111111111111* +L004080 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004160 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004240 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004320 11111111111111111111111111111111111111110111111111111111111111111111110111111111* +L004400 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004480 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004560 11111111111111111111111111111111111111011111111111111111111111111111110111111111* +L004640 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004720 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004800 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004880 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L004960 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L005040 11111111111111111111111111111111111111111111111111111111111111111111110111111111* + +Note Block 0 PLA OR array * +L005120 0111111111111111* +L005136 0111111111111111* +L005152 1111111111111110* +L005168 1111111111111101* +L005184 1111111111111101* +L005200 1111111111111101* +L005216 1111111111111011* +L005232 1111111111111011* +L005248 1111111111110111* +L005264 1111111111110111* +L005280 1111111111101111* +L005296 1111111111101111* +L005312 1111111111101111* +L005328 1111111111111111* +L005344 1111111111101111* +L005360 1111111111101111* +L005376 1111111111111111* +L005392 1111111111101111* +L005408 1111111111101111* +L005424 1111111111111111* +L005440 1111111111101111* +L005456 1111111111011111* +L005472 1111111111111111* +L005488 1111111111011111* +L005504 1111111110111111* +L005520 1111111111111111* +L005536 1111111110111111* +L005552 1111111101111111* +L005568 1111111101111111* +L005584 1111111011111111* +L005600 1111111011111111* +L005616 1111111111111111* +L005632 1111110111111111* +L005648 1111110111111111* +L005664 1111111111111111* +L005680 1111110111111111* +L005696 1111110111111111* +L005712 1111111111111111* +L005728 1111110111111111* +L005744 1111110111111111* +L005760 1111111111111111* +L005776 1111110111111111* +L005792 1111110111111111* +L005808 1111111111111111* +L005824 1111111111111111* +L005840 1111111111111111* +L005856 1111111111111111* +L005872 1111111111111111* +L005888 1111111111111111* +L005904 1111111111111111* +L005920 1111111111111111* +L005936 1111111111111111* +L005952 1111111111111111* +L005968 1111111111111111* +L005984 1111111111111111* +L006000 1111111111111111* + +Note Block 0 I/O Macrocell Configuration 27 bits * +N Aclk ClkOp Clk:2 ClkFreq R:2 P:2 RegMod:2 INz:2 FB:2 InReg St XorIn:2 RegCom Oe:4 Tm Slw Pu* +L006016 010101111001110101100000011* +L006043 010101111001110111011111101* +L006070 010101111001110111011111101* +L006097 010101111001110111011111101* +L006124 010101111001110111011111101* +L006151 010101111001110111011111101* +L006178 000001111001100110011111101* +L006205 010101111001110111011111101* +L006232 010101111001110111011111101* +L006259 010101111001110111011111101* +L006286 010101111001110111011111101* +L006313 000001111001100110011111101* +L006340 010101111001110111011111101* +L006367 010101111001110111011111101* +L006394 010101111001110110011111101* +L006421 010101111111110110011111101* + +Note Block 1 * +Note Block 1 ZIA * +L006448 1110101011111111* +L006464 1111111011010111* +L006480 1111111011010111* +L006496 1111111111111111* +L006512 1111111011010111* +L006528 1110101011111111* +L006544 1110110011111111* +L006560 1110011011111111* +L006576 1111111011010111* +L006592 1111111011100111* +L006608 1110011011111111* +L006624 1111111111111111* +L006640 1111111111111111* +L006656 1111111111111111* +L006672 1110110011111111* +L006688 1111111111111111* +L006704 1110101011111111* +L006720 1111111111111111* +L006736 1110110011111111* +L006752 1110110011111111* +L006768 1110110011111111* +L006784 1111111111111111* +L006800 1111111111111111* +L006816 1111111111111111* +L006832 1111111111111111* +L006848 1111111111111111* +L006864 1111111011010111* +L006880 1111111111111111* +L006896 1111111111111111* +L006912 1111111111111111* +L006928 1111111111111111* +L006944 1111111111111111* +L006960 1111111111111111* +L006976 1111111111111111* +L006992 1111111111111111* +L007008 1111111111111111* +L007024 1111111111111111* +L007040 1111111111111111* +L007056 1111111111111111* +L007072 1111111111111111* + +Note Block 1 PLA AND array * +L007088 01111111111111111111111111111111111101111111111111110111111111111111111111111111* +L007168 10111111111111111111111111111111111110111111111111110111111111111111111111111111* +L007248 01111111111111111111111111110111111111111111111111110111111111111111111111111111* +L007328 10111111111111111111111111111011111111111111111111110111111111111111111111111111* +L007408 01111111111111111111111111111111111111011111111111110111111111111111111111111111* +L007488 10111111111111111111111111111111111111101111111111110111111111111111111111111111* +L007568 01111111111111111111111111111111111111110111111111110111111111111111111111111111* +L007648 10111111111111111111111111111111111111111011111111110111111111111111111111111111* +L007728 01111111111111011111111111111111111111111111111111110111111111111111111111111111* +L007808 10111111111111101111111111111111111111111111111111110111111111111111111111111111* +L007888 11111111111101110111111111111111111111111111111111111111111111111111111111111111* +L007968 01111111111111111111011111111111111111111111111111110111111111111111111111111111* +L008048 10111111111111111111101111111111111111111111111111110111111111111111111111111111* +L008128 11111111111111111101111111111111111111111111111111111111111111111111111111111111* +L008208 01111111110111111111111111111111111111111111111111110111111111111111111111111111* +L008288 10111111111011111111111111111111111111111111111111110111111111111111111111111111* +L008368 11011111111111111111111111111111111111111111111111111111111111111111111111111111* +L008448 01111111111111111111111111111111011111111111111111110111111111111111111111111111* +L008528 10111111111111111111111111111111101111111111111111110111111111111111111111111111* +L008608 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L008688 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L008768 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L008848 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L008928 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009008 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009088 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009168 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009248 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009328 11110111111111111111111111111111111111111111111111111111111111111111111111111111* +L009408 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009488 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009568 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009648 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009728 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009808 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009888 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L009968 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010048 11111111011111111111111111111111111111111111111111111111111111111111111111111111* +L010128 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010208 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010288 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010368 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010448 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010528 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010608 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010688 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010768 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010848 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L010928 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011008 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011088 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011168 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011248 10111111111111111111111111111111111111111111111111110111111111111111111111111111* +L011328 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011408 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L011488 10111111111111111111111111111111111111111111111111110111111111111111111111111111* + +Note Block 1 PLA OR array * +L011568 1111111111111011* +L011584 1111111111111011* +L011600 1111111111110111* +L011616 1111111111110111* +L011632 1111111111101111* +L011648 1111111111101111* +L011664 1111111111011111* +L011680 1111111111011111* +L011696 1111111101111111* +L011712 1111111101111111* +L011728 1111111111111111* +L011744 1111101111111111* +L011760 1111101111111111* +L011776 1111111111111111* +L011792 1111011111111111* +L011808 1111011111111111* +L011824 1111111111111111* +L011840 1110111111111111* +L011856 1110111111111111* +L011872 1111111111111111* +L011888 1111111111111111* +L011904 1111111111111111* +L011920 1111111111111111* +L011936 1111111111111111* +L011952 1111111111111111* +L011968 1111111111111111* +L011984 1111111111111111* +L012000 1111111111111111* +L012016 1111111111111111* +L012032 1111111111111111* +L012048 1111111111111111* +L012064 1111111111111111* +L012080 1111111111111111* +L012096 1111111111111111* +L012112 1111111111111111* +L012128 1111111111111111* +L012144 1111111111111111* +L012160 1111111111111111* +L012176 1111111111111111* +L012192 1111111111111111* +L012208 1111111111111111* +L012224 1111111111111111* +L012240 1111111111111111* +L012256 1111111111111111* +L012272 1111111111111111* +L012288 1111111111111111* +L012304 1111111111111111* +L012320 1111111111111111* +L012336 1111111111111111* +L012352 1111111111111111* +L012368 1111111111111111* +L012384 1111111111111111* +L012400 1111111111111111* +L012416 1111111111111111* +L012432 1111111111111111* +L012448 1111111111111111* + +Note Block 1 I/O Macrocell Configuration 27 bits * +N Aclk ClkOp Clk:2 ClkFreq R:2 P:2 RegMod:2 INz:2 FB:2 InReg St XorIn:2 RegCom Oe:4 Tm Slw Pu* +L012464 000001111001100111011111101* +L012491 010101111001110111011111101* +L012518 010101111001110111011111101* +L012545 010101111001111100000000011* +L012572 010101111001111101100000011* +L012599 010101111001111101100000011* +L012626 010101111001110111011111101* +L012653 000101111000010000011111001* +L012680 010101111001111101100000011* +L012707 010101111001110101011111001* +L012734 010101111001111101100000011* +L012761 010101111001111101100000011* +L012788 010101111001111101100000011* +L012815 010101111001111101100000011* +L012842 010101111001111100100000011* +L012869 010101111001111100100000011* + +Note Block 2 * +Note Block 2 ZIA * +L012896 1100111011111111* +L012912 1100111011111111* +L012928 1010111011111111* +L012944 1111111111111111* +L012960 1110011011111111* +L012976 1111111011010111* +L012992 1010111011111111* +L013008 0110111011111111* +L013024 1111111111111111* +L013040 1100111011111111* +L013056 1111111111111111* +L013072 1111111011100111* +L013088 1111111011100111* +L013104 1111111111111111* +L013120 1100111011111111* +L013136 1100111011111111* +L013152 1111111111111111* +L013168 1010111011111111* +L013184 1111111111111111* +L013200 1111111111111111* +L013216 1111111111111111* +L013232 1111111111111111* +L013248 1110110011111111* +L013264 1111111111111111* +L013280 1111111111111111* +L013296 1111111111111111* +L013312 1111111111111111* +L013328 1111111111111111* +L013344 1111111111111111* +L013360 1111111111111111* +L013376 1111111111111111* +L013392 1111111111111111* +L013408 1111111111111111* +L013424 1111111111111111* +L013440 1111111111111111* +L013456 1111111111111111* +L013472 1111111111111111* +L013488 1111111111111111* +L013504 1111111111111111* +L013520 1111111111111111* + +Note Block 2 PLA AND array * +L013536 11111111110111111111111010111111111111111111011111111111111111111111111111111111* +L013616 11111111110111011111111011111111111111111111011111111111111111111111111111111111* +L013696 11111111011011111111111010111111111111111111111111111111111111111111111111111111* +L013776 11111111011011011111111011111111111111111111111111111111111111111111111111111111* +L013856 11111111110111111111111111110111111111111111101111111111111111111111111111111111* +L013936 11111111101011111111111111110111111111111111111111111111111111111111111111111111* +L014016 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014096 11111111111011111111111111111111111111111111111111111111111111111111111111111111* +L014176 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014256 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014336 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014416 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014496 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014576 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014656 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014736 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014816 11111111111011111111111111111111111111111111111111111111111111111111111111111111* +L014896 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L014976 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015056 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015136 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015216 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015296 11011111111011111111111111111111111111111111111111111111111111111111111111111111* +L015376 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015456 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015536 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015616 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015696 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015776 01010111111001111101111111111101110111111111111111111111111111111111111111111111* +L015856 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L015936 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016016 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016096 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016176 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016256 11011111111011111111111111111101111111111111111111111111111111111111111111111111* +L016336 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016416 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016496 01011111111011111111111111111101111111111111111111111111111111111111111111111111* +L016576 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016656 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016736 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016816 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016896 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L016976 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017056 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017136 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017216 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017296 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017376 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017456 01011111111011111101111111111101111111111111111111111111111111111111111111111111* +L017536 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017616 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017696 01011111111011111101111111111101110111111111111111111111111111111111111111111111* +L017776 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017856 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L017936 01010111111011111101111111111101110111111111111111111111111111111111111111111111* + +Note Block 2 PLA OR array * +L018016 0111111111111111* +L018032 0111111111111111* +L018048 0111111111111111* +L018064 0111111111111111* +L018080 0111111111111111* +L018096 0111111111111111* +L018112 1111111111111111* +L018128 1111111111111111* +L018144 1111111111111111* +L018160 1111111111111111* +L018176 1111111111111111* +L018192 1111111111111111* +L018208 1111111111111111* +L018224 1111111111111111* +L018240 1111111111111111* +L018256 1111111111111111* +L018272 1111111111111111* +L018288 1111111111111111* +L018304 1111111111111111* +L018320 1111111111111111* +L018336 1111111111111111* +L018352 1111111111111111* +L018368 1111111111111111* +L018384 1111111111111111* +L018400 1111111111111111* +L018416 1111111111111111* +L018432 1111111111111111* +L018448 1111111111111111* +L018464 1111111111111111* +L018480 1111111111111111* +L018496 1111111111111111* +L018512 1111111111111111* +L018528 1111111111111111* +L018544 1111111111111111* +L018560 1111111111111111* +L018576 1111111111111111* +L018592 1111111111111111* +L018608 1111111111111111* +L018624 1111111111111111* +L018640 1111111111111111* +L018656 1111111111111111* +L018672 1111111111111111* +L018688 1111111111111111* +L018704 1111111111111111* +L018720 1111111111111111* +L018736 1111111111111111* +L018752 1111111111111111* +L018768 1111111111111111* +L018784 1111111111111111* +L018800 1111111111111111* +L018816 1111111111111111* +L018832 1111111111111111* +L018848 1111111111111111* +L018864 1111111111111111* +L018880 1111111111111111* +L018896 1111111111111111* + +Note Block 2 I/O Macrocell Configuration 27 bits * +N Aclk ClkOp Clk:2 ClkFreq R:2 P:2 RegMod:2 INz:2 FB:2 InReg St XorIn:2 RegCom Oe:4 Tm Slw Pu* +L018912 000101111001110100000000011* +L018939 000001111000011100011111000* +L018966 000101111100010101001000011* +L018993 000001111001111110011111100* +L019020 000101111100010101001000011* +L019047 000001111001111110011111100* +L019074 000101111100011101001000011* +L019101 000001111000011100011111000* +L019128 000101111100010101001000011* +L019155 000101111100010101001000011* +L019182 000001111000011100011111000* +L019209 000001111000011100011111000* +L019236 000001111001111110011111100* +L019263 000101111100010101001000011* +L019290 000101111100010101001000011* +L019317 000101111100010101001000011* + +Note Block 3 * +Note Block 3 ZIA * +L019344 1111111111111111* +L019360 1111111111111111* +L019376 1111111111111111* +L019392 1111111111111111* +L019408 1111111111111111* +L019424 1111111111111111* +L019440 1111111011100111* +L019456 1111111010110111* +L019472 1111111111111111* +L019488 1111111111111111* +L019504 1111111111111111* +L019520 1111111111111111* +L019536 1111111111111111* +L019552 1111111111111111* +L019568 1111111111111111* +L019584 1111111111111111* +L019600 1111111111111111* +L019616 1111111111111111* +L019632 1111111111111111* +L019648 1111111111111111* +L019664 1111111111111111* +L019680 1111111111111111* +L019696 1111111111111111* +L019712 1111111111111111* +L019728 1111111111111111* +L019744 1111111111111111* +L019760 1111111111111111* +L019776 1111111111111111* +L019792 1111111111111111* +L019808 1111111111111111* +L019824 1111111111111111* +L019840 1111111111111111* +L019856 1111111111111111* +L019872 1111111111111111* +L019888 1111111111111111* +L019904 1111111111111111* +L019920 1111111111111111* +L019936 1111111111111111* +L019952 1111111111111111* +L019968 1111111111111111* + +Note Block 3 PLA AND array * +L019984 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020064 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020144 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020224 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020304 11111111111111011111111111111111111111111111111111111111111111111111111111111111* +L020384 11111111111101111111111111111111111111111111111111111111111111111111111111111111* +L020464 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020544 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020624 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020704 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020784 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020864 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L020944 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021024 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021104 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021184 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021264 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021344 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021424 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021504 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021584 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021664 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021744 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021824 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021904 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L021984 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022064 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022144 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022224 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022304 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022384 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022464 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022544 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022624 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022704 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022784 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022864 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L022944 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023024 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023104 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023184 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023264 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023344 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023424 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023504 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023584 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023664 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023744 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023824 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L023904 11111111111110111111111111111111111111111111111111111111111111111111111111111111* +L023984 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L024064 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L024144 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L024224 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L024304 11111111111111111111111111111111111111111111111111111111111111111111111111111111* +L024384 11111111111111111111111111111111111111111111111111111111111111111111111111111111* + +Note Block 3 PLA OR array * +L024464 1111111111111111* +L024480 1111111111111111* +L024496 1111111111111111* +L024512 1111111111111111* +L024528 1111111111111111* +L024544 1111111111111111* +L024560 1111111111111111* +L024576 1111111111111111* +L024592 1111111111111111* +L024608 1111111111111111* +L024624 1111111111111111* +L024640 1111111111111111* +L024656 1111111111111111* +L024672 1111111111111111* +L024688 1111111111111111* +L024704 1111111111111111* +L024720 1111111111111111* +L024736 1111111111111111* +L024752 1111111111111111* +L024768 1111111111111111* +L024784 1111111111111111* +L024800 1111111111111111* +L024816 1111111111111111* +L024832 1111111111111111* +L024848 1111111111111111* +L024864 1111111111111111* +L024880 1111111111111111* +L024896 1111111111111111* +L024912 1111111111111111* +L024928 1111111111111111* +L024944 1111111111111111* +L024960 1111111111111111* +L024976 1111111111111111* +L024992 1111111111111111* +L025008 1111111111111111* +L025024 1111111111111111* +L025040 1111111111111111* +L025056 1111111111111111* +L025072 1111111111111111* +L025088 1111111111111111* +L025104 1111111111111111* +L025120 1111111111111111* +L025136 1111111111111111* +L025152 1111111111111111* +L025168 1111111111111111* +L025184 1111111111111111* +L025200 1111111111111111* +L025216 1111111111111111* +L025232 1111111111111111* +L025248 1111111111111111* +L025264 1111111111111111* +L025280 1111111111111111* +L025296 1111111111111111* +L025312 1111111111111111* +L025328 1111111111111111* +L025344 1111111111111111* + +Note Block 3 I/O Macrocell Configuration 27 bits * +N Aclk ClkOp Clk:2 ClkFreq R:2 P:2 RegMod:2 INz:2 FB:2 InReg St XorIn:2 RegCom Oe:4 Tm Slw Pu* +L025360 000001111001111110011111100* +L025387 000001111001111110011111100* +L025414 000001111001111110011111100* +L025441 000001111001111110011111100* +L025468 000001111001111110011111100* +L025495 000001111001111110011111100* +L025522 000001111001111110011111100* +L025549 000001111001111110011111100* +L025576 000001111001111110011111100* +L025603 000001111001111110011111100* +L025630 000001111001111110011111100* +L025657 000001111001111110011111100* +L025684 101101011000010000011111101* +L025711 000001111001111101010000011* +L025738 000001111001111110011111100* +L025765 000001111001111110011111100* + +Note Globals * +Note Global Clock Mux * +L025792 001* + +Note Global Set/Reset Mux * +L025795 00* + +Note Global OE Mux * +L025797 11111111* + +Note Global Termination * +L025805 1* + +Note Input Voltage Standard for IOB * +L025806 0* + +Note Output Voltage Standard for IOB * +L025807 0* + +Note I/O Bank 0 Vcci * +L025808 0* + +Note I/O Bank 0 Vcco * +L025809 0* + +Note I/O Bank 1 Vcci * +L025810 0* + +Note I/O Bank 1 Vcco * +L025811 0* + +CED50* +AA1E diff --git a/firmware/cpld/sgpio_debug/top.ucf b/firmware/cpld/sgpio_debug/top.ucf new file mode 100755 index 00000000..885ee3ee --- /dev/null +++ b/firmware/cpld/sgpio_debug/top.ucf @@ -0,0 +1,74 @@ +# +# Copyright 2012 Jared Boone +# +# This file is part of HackRF. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +NET "CODEC_X2_CLK" TNM_NET = CODEC_X2_CLK; +TIMESPEC TS_codec_x2_data = PERIOD "CODEC_X2_CLK" 25 ns; + +TIMEGRP "adc_data" OFFSET = IN 16 ns BEFORE "CODEC_X2_CLK"; + +TIMEGRP "dac_data" OFFSET = OUT 15 ns AFTER "CODEC_X2_CLK"; + +TIMEGRP "to_host" OFFSET = OUT 20 ns AFTER "CODEC_X2_CLK"; +#PACE: Start of Constraints generated by PACE + +#PACE: Start of PACE I/O Pin Assignments +NET "CODEC_CLK" LOC = "P23" ; +NET "CODEC_X2_CLK" LOC = "P27" ; +NET "DA<0>" LOC = "P43" ; +NET "DA<1>" LOC = "P42" ; +NET "DA<2>" LOC = "P41" ; +NET "DA<3>" LOC = "P40" ; +NET "DA<4>" LOC = "P39" ; +NET "DA<5>" LOC = "P37" ; +NET "DA<6>" LOC = "P36" ; +NET "DA<7>" LOC = "P35" ; +NET "DD<0>" LOC = "P34" ; +NET "DD<1>" LOC = "P33" ; +NET "DD<2>" LOC = "P32" ; +NET "DD<3>" LOC = "P30" ; +NET "DD<4>" LOC = "P29" ; +NET "DD<5>" LOC = "P28" ; +NET "DD<6>" LOC = "P24" ; +NET "DD<7>" LOC = "P19" ; +NET "DD<8>" LOC = "P18" ; +NET "DD<9>" LOC = "P17" ; +NET "HOST_CAPTURE" LOC = "P91" ; +NET "HOST_DATA<0>" LOC = "P89" ; +NET "HOST_DATA<1>" LOC = "P79" ; +NET "HOST_DATA<2>" LOC = "P74" ; +NET "HOST_DATA<3>" LOC = "P72" ; +NET "HOST_DATA<4>" LOC = "P67" ; +NET "HOST_DATA<5>" LOC = "P64" ; +NET "HOST_DATA<6>" LOC = "P61" ; +NET "HOST_DATA<7>" LOC = "P77" ; +NET "HOST_DIRECTION" LOC = "P71" ; +NET "HOST_DISABLE" LOC = "P76" ; +NET "HOST_Q_INVERT" LOC = "P70" ; +NET "HOST_SYNC_EN" LOC = "P90" ; +NET "HOST_SYNC" LOC = "P55" | PULLUP ; +NET "HOST_SYNC_CMD" LOC = "P56" ; + +NET "B2AUX1" LOC = "13" ; + +#PACE: Start of PACE Area Constraints + +#PACE: Start of PACE Prohibit Constraints + +#PACE: End of Constraints generated by PACE diff --git a/firmware/cpld/sgpio_debug/top.vhd b/firmware/cpld/sgpio_debug/top.vhd new file mode 100755 index 00000000..48f7dff7 --- /dev/null +++ b/firmware/cpld/sgpio_debug/top.vhd @@ -0,0 +1,180 @@ +-- +-- Copyright 2012 Jared Boone +-- Copyright 2013 Benjamin Vernoux +-- +-- This file is part of HackRF. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2, or (at your option) +-- any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; see the file COPYING. If not, write to +-- the Free Software Foundation, Inc., 51 Franklin Street, +-- Boston, MA 02110-1301, USA. + +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use ieee.std_logic_unsigned.all; + +library UNISIM; +use UNISIM.vcomponents.all; + +entity top is + Port( + HOST_DATA : inout std_logic_vector(7 downto 0); + HOST_CAPTURE : out std_logic; + HOST_SYNC_EN : in std_logic; + HOST_SYNC_CMD : out std_logic; + HOST_SYNC : in std_logic; + HOST_DISABLE : in std_logic; + HOST_DIRECTION : in std_logic; + HOST_Q_INVERT : in std_logic; + + DA : in std_logic_vector(7 downto 0); + DD : out std_logic_vector(9 downto 0); + + CODEC_CLK : in std_logic; + CODEC_X2_CLK : in std_logic; + + B2AUX1 : out std_logic + ); + +end top; + +architecture Behavioral of top is + signal codec_clk_rx_i : std_logic; + signal codec_clk_tx_i : std_logic; + signal adc_data_i : std_logic_vector(7 downto 0); + signal dac_data_o : std_logic_vector(9 downto 0); + + signal host_clk_i : std_logic; + + type transfer_direction is (from_adc, to_dac); + signal transfer_direction_i : transfer_direction; + + signal host_data_enable_i : std_logic; + signal host_data_capture_o : std_logic; + signal host_sync_enable : std_logic := '0'; + signal host_sync_o : std_logic := '0'; + signal host_sync_i : std_logic := '0'; + signal host_sync_latched : std_logic := '0'; + + signal data_from_host_i : std_logic_vector(7 downto 0); + signal data_to_host_o : std_logic_vector(7 downto 0); + + signal compare_counter : std_logic_vector(7 downto 0); + signal glitch_detected_o : std_logic; + + signal q_invert : std_logic; + signal rx_q_invert_mask : std_logic_vector(7 downto 0); + signal tx_q_invert_mask : std_logic_vector(7 downto 0); + +begin + + ------------------------------------------------ + -- Codec interface + + DD(9 downto 0) <= dac_data_o; + + ------------------------------------------------ + -- Clocks + + BUFG_host : BUFG + port map ( + O => host_clk_i, + I => CODEC_X2_CLK + ); + + ------------------------------------------------ + -- SGPIO interface + + HOST_DATA <= data_to_host_o when transfer_direction_i = from_adc + else (others => 'Z'); + + HOST_CAPTURE <= host_data_capture_o; + host_sync_enable <= HOST_SYNC_EN; + host_sync_i <= HOST_SYNC; + HOST_SYNC_CMD <= host_sync_o; + + B2AUX1 <= glitch_detected_o; + + host_data_enable_i <= not HOST_DISABLE; + transfer_direction_i <= to_dac when HOST_DIRECTION = '1' + else from_adc; + + ------------------------------------------------ + + q_invert <= HOST_Q_INVERT; + rx_q_invert_mask <= X"80" when q_invert = '1' else X"7f"; + tx_q_invert_mask <= X"7f" when q_invert = '1' else X"80"; + + process(host_clk_i) + begin + if rising_edge(host_clk_i) then + codec_clk_rx_i <= CODEC_CLK; + adc_data_i <= DA(7 downto 0); + if (transfer_direction_i = from_adc) then + data_to_host_o <= data_to_host_o + 1; + end if; + end if; + end process; + + process(host_clk_i) + begin + if falling_edge(host_clk_i) then + codec_clk_tx_i <= CODEC_CLK; + data_from_host_i <= HOST_DATA; + if transfer_direction_i = to_dac then + if codec_clk_tx_i = '1' then + dac_data_o <= (data_from_host_i xor tx_q_invert_mask) & tx_q_invert_mask(0) & tx_q_invert_mask(0); + else + dac_data_o <= (data_from_host_i xor X"80") & "00"; + end if; + + if data_from_host_i /= compare_counter then + glitch_detected_o <= '1'; + else + glitch_detected_o <= '0'; + end if; + compare_counter <= data_from_host_i + 1; + else + dac_data_o <= (dac_data_o'high => '0', others => '1'); + end if; + end if; + end process; + + process (host_data_enable_i, host_sync_i) + begin + host_sync_o <= host_data_enable_i; + if host_data_enable_i = '1' then + if rising_edge(host_sync_i) then + host_sync_latched <= host_sync_i; + end if; + else + host_sync_latched <= '0'; + end if; + end process; + + process(host_clk_i) + begin + if rising_edge(host_clk_i) then + if transfer_direction_i = to_dac then + if codec_clk_tx_i = '1' then + host_data_capture_o <= host_data_enable_i and (host_sync_latched or not host_sync_enable); + end if; + else + if codec_clk_rx_i = '1' then + host_data_capture_o <= host_data_enable_i and (host_sync_latched or not host_sync_enable); + end if; + end if; + end if; + end process; + +end Behavioral; diff --git a/firmware/cpld/sgpio_debug/top_tb.vhd b/firmware/cpld/sgpio_debug/top_tb.vhd new file mode 100755 index 00000000..6c38531b --- /dev/null +++ b/firmware/cpld/sgpio_debug/top_tb.vhd @@ -0,0 +1,132 @@ +-- +-- Copyright 2012 Jared Boone +-- +-- This file is part of HackRF. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2, or (at your option) +-- any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; see the file COPYING. If not, write to +-- the Free Software Foundation, Inc., 51 Franklin Street, +-- Boston, MA 02110-1301, USA. + +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; + +ENTITY top_tb IS +END top_tb; + +ARCHITECTURE behavior OF top_tb IS + + COMPONENT top + PORT( + HOST_DATA : INOUT std_logic_vector(7 downto 0); + HOST_CAPTURE : OUT std_logic; + HOST_DISABLE : IN std_logic; + HOST_DIRECTION : IN std_logic; + HOST_DECIM_SEL : IN std_logic_vector(2 downto 0); + DA : IN std_logic_vector(7 downto 0); + DD : OUT std_logic_vector(9 downto 0); + CODEC_CLK : IN std_logic; + CODEC_X2_CLK : IN std_logic + ); + END COMPONENT; + + --Inputs + signal DA : std_logic_vector(7 downto 0) := (others => '0'); + signal CODEC_CLK : std_logic := '0'; + signal CODEC_X2_CLK : std_logic := '0'; + signal HOST_DISABLE : std_logic := '1'; + signal HOST_DIRECTION : std_logic := '0'; + signal HOST_DECIM_SEL : std_logic_vector(2 downto 0) := "010"; + + --BiDirs + signal HOST_DATA : std_logic_vector(7 downto 0); + + --Outputs + signal DD : std_logic_vector(9 downto 0); + signal HOST_CAPTURE : std_logic; + +begin + + uut: top PORT MAP ( + HOST_DATA => HOST_DATA, + HOST_CAPTURE => HOST_CAPTURE, + HOST_DISABLE => HOST_DISABLE, + HOST_DIRECTION => HOST_DIRECTION, + HOST_DECIM_SEL => HOST_DECIM_SEL, + DA => DA, + DD => DD, + CODEC_CLK => CODEC_CLK, + CODEC_X2_CLK => CODEC_X2_CLK + ); + + clk_process :process + begin + CODEC_CLK <= '1'; + CODEC_X2_CLK <= '1'; + wait for 12.5 ns; + CODEC_X2_CLK <= '0'; + wait for 12.5 ns; + CODEC_CLK <= '0'; + CODEC_X2_CLK <= '1'; + wait for 12.5 ns; + CODEC_X2_CLK <= '0'; + wait for 12.5 ns; + end process; + + adc_proc: process + begin + wait until rising_edge(CODEC_CLK); + wait for 9 ns; + DA <= "00000000"; + + wait until falling_edge(CODEC_CLK); + wait for 9 ns; + DA <= "00000001"; + + end process; + + sgpio_proc: process + begin + HOST_DATA <= (others => 'Z'); + + HOST_DIRECTION <= '0'; + HOST_DISABLE <= '1'; + + wait for 135 ns; + + HOST_DISABLE <= '0'; + + wait for 1000 ns; + + HOST_DISABLE <= '1'; + + wait for 100 ns; + + HOST_DIRECTION <= '1'; + + wait for 100 ns; + + HOST_DISABLE <= '0'; + + for i in 0 to 10 loop + HOST_DATA <= (others => '0'); + wait until rising_edge(CODEC_CLK) and HOST_CAPTURE = '1'; + + HOST_DATA <= (others => '1'); + wait until rising_edge(CODEC_CLK) and HOST_CAPTURE = '1'; + end loop; + + wait; + end process; + +end; \ No newline at end of file diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index f898ad44..e978ca8f 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -28,7 +28,12 @@ enable_language(C CXX ASM) SET(PATH_HACKRF_FIRMWARE ${CMAKE_CURRENT_LIST_DIR}) -SET(PATH_HACKRF_CPLD_XSVF ${PATH_HACKRF_FIRMWARE}/cpld/sgpio_if/default.xsvf) +if(NOT DEFINED SGPIO_DEBUG) + SET(PATH_HACKRF_CPLD_XSVF ${PATH_HACKRF_FIRMWARE}/cpld/sgpio_if/default.xsvf) +else() + SET(PATH_HACKRF_CPLD_XSVF ${PATH_HACKRF_FIRMWARE}/cpld/sgpio_debug/default.xsvf) +endif() +SET(VAR_USED ${SGPIO_DEBUG}) SET(PATH_HACKRF ${PATH_HACKRF_FIRMWARE}/..) SET(PATH_HACKRF_FIRMWARE_COMMON ${PATH_HACKRF_FIRMWARE}/common) SET(LIBOPENCM3 ${PATH_HACKRF_FIRMWARE}/libopencm3) diff --git a/tools/sgpio_debug/create_tx_counter.py b/tools/sgpio_debug/create_tx_counter.py new file mode 100644 index 00000000..a288036b --- /dev/null +++ b/tools/sgpio_debug/create_tx_counter.py @@ -0,0 +1,2 @@ +with open('tx_counter.bin', 'wb') as f: + f.write(bytes(range(256))*1000) diff --git a/tools/sgpio_debug/sgpio_debug_rx.grc b/tools/sgpio_debug/sgpio_debug_rx.grc new file mode 100644 index 00000000..20d8b113 --- /dev/null +++ b/tools/sgpio_debug/sgpio_debug_rx.grc @@ -0,0 +1,351 @@ +options: + parameters: + author: mike + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: sgpio_debug_rx + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: Not titled yet + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: delay + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0' + step: '1' + stop: '256' + value: '0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [272, 12.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: int(20e6) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: analog_sig_source_x_0 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '2' + comment: '' + freq: samp_rate/256 + maxoutbuf: '0' + minoutbuf: '0' + offset: '-1' + phase: '0' + samp_rate: samp_rate + type: float + waveform: analog.GR_SAW_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [32, 260.0] + rotation: 0 + state: true +- name: blocks_complex_to_float_0 + id: blocks_complex_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [256, 144.0] + rotation: 0 + state: enabled +- name: blocks_delay_0 + id: blocks_delay + parameters: + affinity: '' + alias: '' + comment: '' + delay: delay + maxoutbuf: '0' + minoutbuf: '0' + num_ports: '1' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 300.0] + rotation: 0 + state: true +- name: blocks_interleave_0 + id: blocks_interleave + parameters: + affinity: '' + alias: '' + blocksize: '1' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_streams: '2' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [448, 144.0] + rotation: 0 + state: true +- name: blocks_sub_xx_0 + id: blocks_sub_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [624, 208.0] + rotation: 0 + state: enabled +- name: note_0 + id: note + parameters: + alias: '' + comment: 'Adjust delay until the plot is ~0. + + + There should be no intermittent spikes.' + note: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [392, 12.0] + rotation: 0 + state: true +- name: qtgui_time_sink_x_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: '' + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '""' + nconnections: '1' + size: '1024' + srate: samp_rate + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '2.56e-6' + tr_level: '0.1' + tr_mode: qtgui.TRIG_MODE_AUTO + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [768, 204.0] + rotation: 0 + state: true +- name: soapy_source_0 + id: soapy_source + parameters: + affinity: '' + alias: '' + amp_gain0: '0' + ant0: RX + ant1: RX2 + args: '' + balance0: '0' + balance1: '0' + bw0: '0' + bw1: '0' + center_freq0: 100.0e6 + center_freq1: '0' + clock_rate: '0' + clock_source: '' + comment: '' + correction0: '0' + correction1: '0' + dc_offset0: '0' + dc_offset1: '0' + dc_offset_auto_mode0: 'False' + dc_offset_auto_mode1: 'False' + dev: driver=rtlsdr + devname: hackrf + gain_auto_mode0: 'False' + gain_auto_mode1: 'False' + ifgr_gain: '59' + lna_gain0: '10' + lna_gain1: '10' + manual_gain0: 'True' + manual_gain1: 'True' + maxoutbuf: '0' + minoutbuf: '0' + mix_gain0: '10' + mix_gain1: '10' + nchan: '1' + nco_freq0: '0' + nco_freq1: '0' + overall_gain0: '10' + overall_gain1: '10' + pga_gain0: '24' + pga_gain1: '24' + rfgr_gain: '9' + samp_rate: samp_rate + sdrplay_agc_setpoint: '-30' + sdrplay_biastee: 'True' + sdrplay_dabnotch: 'False' + sdrplay_if_mode: Zero-IF + sdrplay_rfnotch: 'False' + tia_gain0: '0' + tia_gain1: '0' + tuner_gain0: '10' + tuner_gain1: '10' + type: fc32 + vga_gain0: '10' + vga_gain1: '10' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [24, 108.0] + rotation: 0 + state: true + +connections: +- [analog_sig_source_x_0, '0', blocks_delay_0, '0'] +- [blocks_complex_to_float_0, '0', blocks_interleave_0, '0'] +- [blocks_complex_to_float_0, '1', blocks_interleave_0, '1'] +- [blocks_delay_0, '0', blocks_sub_xx_0, '1'] +- [blocks_interleave_0, '0', blocks_sub_xx_0, '0'] +- [blocks_sub_xx_0, '0', qtgui_time_sink_x_0, '0'] +- [soapy_source_0, '0', blocks_complex_to_float_0, '0'] + +metadata: + file_format: 1 diff --git a/tools/sgpio_debug/sgpio_debug_tx.sh b/tools/sgpio_debug/sgpio_debug_tx.sh new file mode 100755 index 00000000..e204ccf1 --- /dev/null +++ b/tools/sgpio_debug/sgpio_debug_tx.sh @@ -0,0 +1,3 @@ +#!/bin/sh +python3 create_tx_counter.py +hackrf_transfer -R -t tx_counter.bin