├── fpga_logic
├── README.md
├── sim
│ └── vunit
│ │ ├── dummy.v
│ │ ├── stim_file.txt
│ │ ├── wave.do
│ │ ├── run.py
│ │ └── spi_controller_tb.v1
├── src
│ ├── cores
│ │ ├── extref
│ │ │ ├── extref.lpc
│ │ │ ├── generate_core.tcl
│ │ │ └── generate_ngd.tcl
│ │ └── pcie
│ │ │ ├── pcie.lpc
│ │ │ ├── generate_core.tcl
│ │ │ └── generate_ngd.tcl
│ ├── extref.vhd
│ ├── pdpram.vhd
│ ├── pll.vhd
│ ├── pll_200.vhd
│ ├── pulse_filt.vhd
│ ├── lfsr_scrambler.vhd
│ ├── top_pkg.vhd
│ ├── analyzer.lpf
│ ├── pci_wrapper_pkg.vhd
│ ├── rev_analyzer.vhd
│ ├── analyzer_pkg.vhd
│ ├── spi_slave.vhd
│ ├── pci_core_wrapper.vhd
│ └── controller.vhd
└── script
│ ├── make_sim.tcl
│ └── make.tcl
├── doc
├── pic
│ ├── pcb_cl.jpg
│ ├── pcb_mnt.jpg
│ ├── prepare.png
│ ├── tool_1.png
│ ├── connector.png
│ ├── pcb_paste.jpg
│ ├── prepare_2.png
│ ├── ecp_eval_board_bot.png
│ ├── ecp_eval_board_top.png
│ ├── fpga_block_diagram.png
│ ├── impedance_diff_100.png
│ ├── impedance_single_50.png
│ └── analyzer_block_diagram.png
└── register_description.txt
├── 3D_Freecad
├── vson.FCStd
└── vson.FCStd1
├── hardware
├── main
│ └── pcie_analyzer
│ │ ├── pcie_analyzer-rescue.dcm
│ │ ├── fp-lib-table
│ │ ├── pcie_analyzer-backups
│ │ ├── pcie_analyzer-2022-01-24_170952.zip
│ │ └── pcie_analyzer-2022-01-31_180009.zip
│ │ ├── sym-lib-table
│ │ ├── pcie_analyzer-rescue.lib
│ │ ├── pcie_analyzer.kicad_prl
│ │ ├── pcie_analyzer.pro
│ │ ├── pcie_analyzer-cache.lib
│ │ └── pcie_analyzer.kicad_pro
├── common
│ └── libs
│ │ ├── 3dshapes
│ │ └── vson.stl
│ │ ├── lib
│ │ └── pcie_analyzer.dcm
│ │ └── pretty
│ │ ├── AXIAL_CABLE_SL8800_08.kicad_mod
│ │ ├── AXIAL_CABLE_SL8800_08_L.kicad_mod
│ │ ├── FB_0402.kicad_mod
│ │ ├── R_0402.kicad_mod
│ │ ├── C_0603.kicad_mod
│ │ ├── R_0603.kicad_mod
│ │ ├── C_0402.kicad_mod
│ │ ├── SMA_Amphenol_132291_Vertical.kicad_mod
│ │ ├── VQFN-16.kicad_mod
│ │ ├── SAMTEC_TSW-120-05-G-D.kicad_mod
│ │ ├── SAMTEC_SFMC-120-01-L-D.kicad_mod
│ │ └── HMC914LP4E.kicad_mod
└── README.md
├── py_script
├── parse_analyzer.py
├── spi_test.py
├── analyzer.py
└── parse2.py
├── .gitignore
├── README.md
└── html
└── test.htm
/fpga_logic/README.md:
--------------------------------------------------------------------------------
1 |
2 | 
--------------------------------------------------------------------------------
/doc/pic/pcb_cl.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/pcb_cl.jpg
--------------------------------------------------------------------------------
/doc/pic/pcb_mnt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/pcb_mnt.jpg
--------------------------------------------------------------------------------
/doc/pic/prepare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/prepare.png
--------------------------------------------------------------------------------
/doc/pic/tool_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/tool_1.png
--------------------------------------------------------------------------------
/3D_Freecad/vson.FCStd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/3D_Freecad/vson.FCStd
--------------------------------------------------------------------------------
/3D_Freecad/vson.FCStd1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/3D_Freecad/vson.FCStd1
--------------------------------------------------------------------------------
/doc/pic/connector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/connector.png
--------------------------------------------------------------------------------
/doc/pic/pcb_paste.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/pcb_paste.jpg
--------------------------------------------------------------------------------
/doc/pic/prepare_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/prepare_2.png
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer-rescue.dcm:
--------------------------------------------------------------------------------
1 | EESchema-DOCLIB Version 2.0
2 | #
3 | #End Doc Library
4 |
--------------------------------------------------------------------------------
/doc/pic/ecp_eval_board_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/ecp_eval_board_bot.png
--------------------------------------------------------------------------------
/doc/pic/ecp_eval_board_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/ecp_eval_board_top.png
--------------------------------------------------------------------------------
/doc/pic/fpga_block_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/fpga_block_diagram.png
--------------------------------------------------------------------------------
/doc/pic/impedance_diff_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/impedance_diff_100.png
--------------------------------------------------------------------------------
/doc/pic/impedance_single_50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/impedance_single_50.png
--------------------------------------------------------------------------------
/doc/pic/analyzer_block_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/doc/pic/analyzer_block_diagram.png
--------------------------------------------------------------------------------
/hardware/common/libs/3dshapes/vson.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/hardware/common/libs/3dshapes/vson.stl
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/fp-lib-table:
--------------------------------------------------------------------------------
1 | (fp_lib_table
2 | (lib (name ecp5_pcie_analyzer)(type KiCad)(uri ${KIPRJMOD}/../../common/libs/pretty)(options "")(descr ""))
3 | )
4 |
--------------------------------------------------------------------------------
/fpga_logic/sim/vunit/dummy.v:
--------------------------------------------------------------------------------
1 | module dummy (/*AUTOARG*/);
2 | /*AUTOINPUT*/
3 | /*AUTOOUTPUT*/
4 | /*AUTOWIRE*/
5 | /*AUTOREG*/
6 | endmodule
--------------------------------------------------------------------------------
/hardware/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Impedance calculation JLCPCB
3 |
4 | 
5 | 
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer-backups/pcie_analyzer-2022-01-24_170952.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/hardware/main/pcie_analyzer/pcie_analyzer-backups/pcie_analyzer-2022-01-24_170952.zip
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer-backups/pcie_analyzer-2022-01-31_180009.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PavlenkoG/ECP5_PCIE_Analyzer/HEAD/hardware/main/pcie_analyzer/pcie_analyzer-backups/pcie_analyzer-2022-01-31_180009.zip
--------------------------------------------------------------------------------
/py_script/parse_analyzer.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import csv
4 | import operator
5 |
6 | reader = csv.reader(open("out.csv"), delimiter=",")
7 |
8 | sortedlist = sorted(reader, key=lambda row: int(row[1]), reverse=False)
9 |
10 | f = open("out_sorted.csv", 'w', newline='')
11 | writer = csv.writer(f)
12 | writer.writerows(sortedlist)
13 |
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/sym-lib-table:
--------------------------------------------------------------------------------
1 | (sym_lib_table
2 | (lib (name pcie_analyzer)(type Legacy)(uri C:/Users/grpa/Documents/WORK/ECP5_PCIE_Analyzer/hardware/common/libs/lib/pcie_analyzer.lib)(options "")(descr ""))
3 | (lib (name test)(type Legacy)(uri C:/temp/libs/PCIE_adapter.lib/PCIE_adapter.lib)(options "")(descr ""))
4 | (lib (name hw)(type Legacy)(uri C:/temp/Loiki5000/kt_pz70pxie__hw/Common/Libs/PZ70PXIe.lib/PZ70PXIe.lib)(options "")(descr ""))
5 | (lib (name pcie_analyzer-rescue)(type Legacy)(uri ${KIPRJMOD}/pcie_analyzer-rescue.lib)(options "")(descr ""))
6 | )
7 |
--------------------------------------------------------------------------------
/hardware/common/libs/lib/pcie_analyzer.dcm:
--------------------------------------------------------------------------------
1 | EESchema-DOCLIB Version 2.0
2 | #
3 | $CMP +3.3VCC
4 | K POWER, PWR
5 | $ENDCMP
6 | #
7 | $CMP C
8 | D Unpolarized capacitor
9 | K capacitor cap
10 | $ENDCMP
11 | #
12 | $CMP Ferrite_Bead
13 | D Ferrite bead
14 | $ENDCMP
15 | #
16 | $CMP GND
17 | K POWER, PWR
18 | $ENDCMP
19 | #
20 | $CMP HMC914
21 | D 12.5 Gbps LIMITING AMPLIFIER w/ LOSS OF SIGNAL FEATURE
22 | $ENDCMP
23 | #
24 | $CMP ONET1191P
25 | D 11.3-Gbps Limiting Amplifier
26 | $ENDCMP
27 | #
28 | $CMP R
29 | D Resistor
30 | K r res resistor
31 | $ENDCMP
32 | #
33 | #End Doc Library
34 |
--------------------------------------------------------------------------------
/doc/register_description.txt:
--------------------------------------------------------------------------------
1 | config_reg
2 | 7 - reset
3 | 1 - stop_trigger
4 | 0 - start_trig
5 | status_reg_0
6 | 7
7 | 6
8 | 5
9 | 4 - rxstatus1_1
10 | 3 - rxstatus1_0
11 | 2 - rxstatus0_1
12 | 1 - rxstatus0_0
13 | 0 - trig_run
14 | status_reg_1
15 | 7
16 | 6
17 | 5 - los_1
18 | 4 - los_0
19 | 3 - rx_cdr_lol_s_1
20 | 2 - rx_cdr_lol_s_0
21 | 1 - lsm_status_1
22 | 0 - lsm_status_0
23 | config_tlp
24 | 0 - filter tlp
25 | config_dllp
26 | 0 - filter dllp
27 | config_ordset
28 | 0 - filter ordset
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/
2 | # Format documentation: http://kicad-pcb.org/help/file-formats/
3 |
4 | # Temporary files
5 | *.000
6 | *.bak
7 | *.bck
8 | *.kicad_pcb-bak
9 | *.sch-bak
10 | *~
11 | *.bmp
12 | _autosave-*
13 | *.tmp
14 | *-save.pro
15 | *-save.kicad_pcb
16 | fp-info-cache
17 |
18 | # Netlist files (exported from Eeschema)
19 | *.net
20 |
21 | # Autorouter files (exported from Pcbnew)
22 | *.dsn
23 | *.ses
24 |
25 | # Exported BOM files
26 | *.xml
27 | *.csv
28 |
29 | # fpga files
30 | fpga_logic/impl/
31 | fpga_logic/sim_core/
32 | fpga_logic/sim/vunit/vunit_out
33 | temp/
34 | hardware/gerbers/
--------------------------------------------------------------------------------
/fpga_logic/src/cores/extref/extref.lpc:
--------------------------------------------------------------------------------
1 | [Device]
2 | Family=ecp5um
3 | OperatingCondition=IND
4 | Package=CABGA381
5 | PartName=LFE5UM-85F-7BG381I
6 | PartType=LFE5UM-85F
7 | SpeedGrade=7
8 | Status=P
9 | [IP]
10 | CoreName=EXTREF
11 | CoreRevision=1.1
12 | CoreStatus=Demo
13 | CoreType=LPM
14 | Date=10/29/2018
15 | ModuleName=extref
16 | ParameterFileVersion=1.0
17 | SourceFormat=vhdl
18 | Time=14:01:05
19 | VendorName=Lattice Semiconductor Corporation
20 | [Parameters]
21 | Destination=Synplicity
22 | EDIF=1
23 | EXTREFDCBIAS=Disabled
24 | EXTREFTERMRES=50 ohms
25 | Expression=BusA(0 to 7)
26 | IO=0
27 | Order=Big Endian [MSB:LSB]
28 | VHDL=1
29 | Verilog=0
30 | [SYSTEMPNR]
31 | EXTREF=DCU1
32 |
--------------------------------------------------------------------------------
/py_script/spi_test.py:
--------------------------------------------------------------------------------
1 | from spidev import SpiDev
2 |
3 | '''
4 | def bits(f):
5 | bytes = (ord(b) for b in f.read())
6 | for b in bytes:
7 | for i in xrange(8):
8 | yield(b>>i) & 1
9 |
10 | def read_packets(mem_num, address):
11 | msg = [0x03]
12 | msg.append(mem_num)
13 | first_b = address.to_bytes(2,'big')
14 | msg.append(int(first_b[0]))
15 | msg.append(int(first_b[1]))
16 | print(msg)
17 | # answer = spi.readbytes(33)
18 | print(msg[0].peek(0))
19 |
20 | def create_list(answer):
21 | flag = answer[33]
22 | for i in range(8):
23 | if i & (1 << (flag - 1)):
24 |
25 | '''
26 |
27 |
28 | spi = SpiDev()
29 | msg = [0x03, 0x01, 0x00, 0x00]
30 |
31 | spi.open(0, 0)
32 | spi.max_speed_hz = 10000000
33 | spi.mode = 1
34 |
35 | spi.writebytes(msg)
36 | raw_input("press")
37 | answer = spi.readbytes(33)
38 | print(answer)
39 |
40 | spi.close()
41 |
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer-rescue.lib:
--------------------------------------------------------------------------------
1 | EESchema-LIBRARY Version 2.4
2 | #encoding utf-8
3 | #
4 | # AXIAL_CABLE_SL8800_08-pcie_analyzer
5 | #
6 | DEF AXIAL_CABLE_SL8800_08-pcie_analyzer ST 0 40 Y Y 1 F N
7 | F0 "ST" 300 150 50 H V C CNN
8 | F1 "AXIAL_CABLE_SL8800_08-pcie_analyzer" 300 -1600 50 H V C CNN
9 | F2 "PCIE_adapter:AXIAL_CABLE_SL8800_08" 400 -1600 50 H I C CNN
10 | F3 "" 200 -200 50 H I C CNN
11 | DRAW
12 | S 200 -1050 650 -1250 0 1 0 N
13 | S 200 -750 650 -950 0 1 0 N
14 | S 200 -450 650 -650 0 1 0 N
15 | S 200 -150 650 -350 0 1 0 N
16 | S 200 50 650 -1500 0 1 0 N
17 | X 1 1 0 -200 200 R 50 50 1 1 I
18 | X 2 2 0 -300 200 R 50 50 1 1 I
19 | X 3 3 0 -500 200 R 50 50 1 1 I
20 | X 4 4 0 -600 200 R 50 50 1 1 I
21 | X 5 5 0 -800 200 R 50 50 1 1 I
22 | X 6 6 0 -900 200 R 50 50 1 1 I
23 | X 7 7 0 -1100 200 R 50 50 1 1 I
24 | X 8 8 0 -1200 200 R 50 50 1 1 I
25 | X M M 0 -1400 200 R 50 50 1 1 I
26 | X M M 0 0 200 R 50 50 1 1 I
27 | ENDDRAW
28 | ENDDEF
29 | #
30 | #End Library
31 |
--------------------------------------------------------------------------------
/fpga_logic/src/extref.vhd:
--------------------------------------------------------------------------------
1 |
2 | --
3 | -- Verific VHDL Description of module EXTREFB
4 | --
5 |
6 | -- EXTREFB is a black-box. Cannot print a valid VHDL entity description for it
7 |
8 | --
9 | -- Verific VHDL Description of module extref
10 | --
11 |
12 | library ieee ;
13 | use ieee.std_logic_1164.all ;
14 |
15 | library ecp5um ;
16 | use ecp5um.components.all ;
17 |
18 | entity extref is
19 | port (refclkp: in std_logic;
20 | refclkn: in std_logic;
21 | refclko: out std_logic
22 | );
23 |
24 | end entity extref;
25 |
26 | architecture v1 of extref is
27 | signal n2,n1,gnd,pwr : std_logic;
28 | attribute LOC : string;
29 | attribute LOC of EXTREF1_inst : label is "EXTREF1";
30 | begin
31 | EXTREF1_inst: component EXTREFB generic map (REFCK_PWDNB=>"0b1",REFCK_RTERM=>"0b1",
32 | REFCK_DCBIAS_EN=>"0b1")
33 | port map (REFCLKP=>refclkp,REFCLKN=>refclkn,REFCLKO=>refclko);
34 | n2 <= '1' ;
35 | n1 <= '0' ;
36 | gnd <= '0' ;
37 | pwr <= '1' ;
38 |
39 | end architecture v1;
40 |
41 |
--------------------------------------------------------------------------------
/fpga_logic/sim/vunit/stim_file.txt:
--------------------------------------------------------------------------------
1 | ; START TEST
2 | m_cf 00000010 70000000; DMA-Table
3 | m_cf 00000014 70010000; DMA Controller
4 | m_cf 00000018 80000000; MSI-X-Table
5 | m_cf 0000001C 80100000; MSI-X-PBA
6 | m_cf 00000060 80000000; MSI-X enable
7 | m__8 70000000 08 00 02 18 00 00 00 00;
8 | m__8 70000008 10 00 04 18 80 00 00 00;
9 | m__8 70000010 18 00 05 18 00 01 00 00;
10 | m__8 70000018 20 00 02 18 18 00 18 00;
11 | m__8 70000020 28 00 04 18 98 00 18 00;
12 | m__8 70000028 30 00 05 18 18 01 18 00;
13 | m__8 70000030 38 00 02 18 30 00 30 00;
14 | m__8 70000038 40 00 04 18 B0 00 30 00;
15 | m__8 70000040 48 00 05 18 30 01 30 00;
16 | m__8 70000048 50 00 02 18 48 00 48 00;
17 | m__8 70000050 58 00 04 18 C8 00 48 00;
18 | m__8 70000058 60 00 05 18 48 01 48 00;
19 | m__8 70000060 68 00 02 18 60 00 60 00;
20 | m__8 70000068 70 00 04 18 E0 00 60 00;
21 | m__8 70000070 78 00 05 18 60 01 60 60;
22 | m__8 70000078 80 00 02 08 78 00 78 00;
23 | m__8 70000080 88 00 04 08 F8 00 78 00;
24 | m__8 70000088 90 00 05 08 78 01 78 00;
25 | m__8 70000088 00 00;
26 | m__8 70010000 01;
27 | wait 00000000 00000800;
28 | exit;
--------------------------------------------------------------------------------
/fpga_logic/sim/vunit/wave.do:
--------------------------------------------------------------------------------
1 | onerror {resume}
2 | quietly WaveActivateNextPane {} 0
3 | add wave -noupdate /spi_controller_tb/clk_100
4 | add wave -noupdate /spi_controller_tb/rst
5 | add wave -noupdate /spi_controller_tb/SCLK
6 | add wave -noupdate /spi_controller_tb/mosi
7 | add wave -noupdate /spi_controller_tb/miso
8 | add wave -noupdate /spi_controller_tb/cs_n
9 | add wave -noupdate -radix hexadecimal /spi_controller_tb/controller_inst/d
10 | add wave -noupdate -radix hexadecimal /spi_controller_tb/controller_inst/q
11 | add wave -noupdate -radix hexadecimal /spi_controller_tb/controller_inst/r
12 | TreeUpdate [SetDefaultTree]
13 | WaveRestoreCursors {{Cursor 1} {0 ps} 0}
14 | quietly wave cursor active 0
15 | configure wave -namecolwidth 150
16 | configure wave -valuecolwidth 100
17 | configure wave -justifyvalue left
18 | configure wave -signalnamewidth 0
19 | configure wave -snapdistance 10
20 | configure wave -datasetprefix 0
21 | configure wave -rowmargin 4
22 | configure wave -childrowmargin 2
23 | configure wave -gridoffset 0
24 | configure wave -gridperiod 1
25 | configure wave -griddelta 40
26 | configure wave -timeline 0
27 | configure wave -timelineunits ns
28 | update
29 | run 10 us
30 | WaveRestoreZoom {0 ps} {6 us}
31 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/AXIAL_CABLE_SL8800_08.kicad_mod:
--------------------------------------------------------------------------------
1 | (module AXIAL_CABLE_SL8800_08 (layer F.Cu) (tedit 611DFC86)
2 | (fp_text reference REF** (at 0 -2.3) (layer F.SilkS)
3 | (effects (font (size 0.75 0.75) (thickness 0.15)))
4 | )
5 | (fp_text value AXIAL_CABLE_SL8800_08 (at 0 -5.5) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (pad 1 smd rect (at 0 0 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
9 | (pad 2 smd rect (at 0 0.79 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
10 | (pad 4 smd rect (at 0 4.45 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
11 | (pad 3 smd rect (at 0 3.66 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
12 | (pad 5 smd rect (at 0 7.32 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
13 | (pad 6 smd rect (at 0 8.11 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
14 | (pad 7 smd rect (at 0 10.98 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
15 | (pad 8 smd rect (at 0 11.77 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
16 | (pad M1 smd rect (at 0 -0.92 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
17 | (pad M2 smd rect (at 0 12.68 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
18 | (model ${KIPRJMOD}/../../common/libs/3dshapes/twin_axial_cable_sl8800_08.step
19 | (offset (xyz 0 -11.75 0.5))
20 | (scale (xyz 1 1 1))
21 | (rotate (xyz 0 0 -90))
22 | )
23 | )
24 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/AXIAL_CABLE_SL8800_08_L.kicad_mod:
--------------------------------------------------------------------------------
1 | (module AXIAL_CABLE_SL8800_08_L (layer F.Cu) (tedit 611DFC8F)
2 | (fp_text reference REF** (at 0.1 -2.4) (layer F.SilkS)
3 | (effects (font (size 0.75 0.75) (thickness 0.15)))
4 | )
5 | (fp_text value AXIAL_CABLE_SL8800_08_L (at -0.2 15.2) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (pad M2 smd rect (at 0 12.68 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
9 | (pad 2 smd rect (at 0 0.79 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
10 | (pad 1 smd rect (at 0 0 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
11 | (pad M1 smd rect (at 0 -0.92 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
12 | (pad 8 smd rect (at 0 11.77 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
13 | (pad 7 smd rect (at 0 10.98 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
14 | (pad 6 smd rect (at 0 8.11 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
15 | (pad 5 smd rect (at 0 7.32 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
16 | (pad 3 smd rect (at 0 3.66 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
17 | (pad 4 smd rect (at 0 4.45 270) (size 0.5 5) (layers F.Cu F.Paste F.Mask))
18 | (model ${KIPRJMOD}/../../common/libs/3dshapes/twin_axial_cable_sl8800_08.step
19 | (offset (xyz 0 0 0.5))
20 | (scale (xyz 1 1 1))
21 | (rotate (xyz 0 0 90))
22 | )
23 | )
24 |
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer.kicad_prl:
--------------------------------------------------------------------------------
1 | {
2 | "board": {
3 | "active_layer": 0,
4 | "active_layer_preset": "",
5 | "auto_track_width": true,
6 | "hidden_nets": [],
7 | "high_contrast_mode": 0,
8 | "net_color_mode": 1,
9 | "opacity": {
10 | "pads": 1.0,
11 | "tracks": 1.0,
12 | "vias": 1.0,
13 | "zones": 0.6
14 | },
15 | "ratsnest_display_mode": 0,
16 | "selection_filter": {
17 | "dimensions": true,
18 | "footprints": true,
19 | "graphics": true,
20 | "keepouts": true,
21 | "lockedItems": true,
22 | "otherItems": true,
23 | "pads": true,
24 | "text": true,
25 | "tracks": true,
26 | "vias": true,
27 | "zones": true
28 | },
29 | "visible_items": [
30 | 0,
31 | 1,
32 | 2,
33 | 3,
34 | 4,
35 | 5,
36 | 6,
37 | 7,
38 | 8,
39 | 9,
40 | 10,
41 | 11,
42 | 12,
43 | 13,
44 | 14,
45 | 15,
46 | 16,
47 | 17,
48 | 18,
49 | 19,
50 | 20,
51 | 21,
52 | 22,
53 | 23,
54 | 24,
55 | 25,
56 | 26,
57 | 27,
58 | 28,
59 | 29,
60 | 30,
61 | 32,
62 | 33,
63 | 34,
64 | 35,
65 | 36
66 | ],
67 | "visible_layers": "0001000_00000001",
68 | "zone_display_mode": 0
69 | },
70 | "meta": {
71 | "filename": "pcie_analyzer.kicad_prl",
72 | "version": 3
73 | },
74 | "project": {
75 | "files": []
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/fpga_logic/src/cores/extref/generate_core.tcl:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/wish
2 |
3 | proc GetPlatform {} {
4 | global tcl_platform
5 |
6 | set cpu $tcl_platform(machine)
7 |
8 | switch $cpu {
9 | intel -
10 | i*86* {
11 | set cpu ix86
12 | }
13 | x86_64 {
14 | if {$tcl_platform(wordSize) == 4} {
15 | set cpu ix86
16 | }
17 | }
18 | }
19 |
20 | switch $tcl_platform(platform) {
21 | windows {
22 | if {$cpu == "amd64"} {
23 | # Do not check wordSize, win32-x64 is an IL32P64 platform.
24 | set cpu x86_64
25 | }
26 | if {$cpu == "x86_64"} {
27 | return "nt64"
28 | } else {
29 | return "nt"
30 | }
31 | }
32 | unix {
33 | if {$tcl_platform(os) == "Linux"} {
34 | if {$cpu == "x86_64"} {
35 | return "lin64"
36 | } else {
37 | return "lin"
38 | }
39 | } else {
40 | return "sol"
41 | }
42 | }
43 | }
44 | return "nt"
45 | }
46 |
47 | set platformpath [GetPlatform]
48 | set Para(spx_dir) [file dirname [info script]]
49 | set Para(install_dir) $env(TOOLRTF)
50 | set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]"
51 |
52 | set asbgen "$Para(FPGAPath)/asbgen"
53 | set modulename "extref"
54 | set lang "vhdl"
55 | set lpcfile "$Para(spx_dir)/$modulename.lpc"
56 | set arch "sa5p00m"
57 | set Para(result) [catch {exec "$asbgen" -n "$modulename" -lang "$lang" -arch "$arch" -fe "$lpcfile"} msg]
58 | #puts $msg
59 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/FB_0402.kicad_mod:
--------------------------------------------------------------------------------
1 | (module FB_0402 (layer F.Cu) (tedit 61150219)
2 | (attr smd)
3 | (fp_text reference REF** (at 0 -1.15) (layer F.SilkS)
4 | (effects (font (size 0.75 0.75) (thickness 0.15)))
5 | )
6 | (fp_text value FB_0402 (at 0 0) (layer F.Fab) hide
7 | (effects (font (size 0.75 0.75) (thickness 0.15)))
8 | )
9 | (fp_line (start -1.016 -0.508) (end -1.016 0.508) (layer F.CrtYd) (width 0.15))
10 | (fp_line (start -1.016 0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
11 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
12 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.CrtYd) (width 0.15))
13 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.Fab) (width 0.15))
14 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.Fab) (width 0.15))
15 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.Fab) (width 0.15))
16 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.Fab) (width 0.15))
17 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.SilkS) (width 0.15))
18 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.SilkS) (width 0.15))
19 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.SilkS) (width 0.15))
20 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.SilkS) (width 0.15))
21 | (fp_text user %R (at 0 0) (layer F.Fab)
22 | (effects (font (size 0.5 0.5) (thickness 0.125)))
23 | )
24 | (pad 1 smd rect (at -0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
25 | (pad 2 smd rect (at 0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
26 | (model ${KIPRJMOD}/../../common/libs/3dshapes/FB0402.wrl
27 | (at (xyz 0 0 0))
28 | (scale (xyz 1 1 1))
29 | (rotate (xyz 0 0 0))
30 | )
31 | )
32 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/R_0402.kicad_mod:
--------------------------------------------------------------------------------
1 | (module R_0402 (layer F.Cu) (tedit 610F9336)
2 | (attr smd)
3 | (fp_text reference REF** (at 0 -1.15) (layer F.SilkS)
4 | (effects (font (size 0.75 0.75) (thickness 0.15)))
5 | )
6 | (fp_text value R_0402R (at 0 2) (layer F.Fab) hide
7 | (effects (font (size 0.75 0.75) (thickness 0.15)))
8 | )
9 | (fp_line (start -1.016 -0.508) (end -1.016 0.508) (layer F.CrtYd) (width 0.15))
10 | (fp_line (start -1.016 0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
11 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
12 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.CrtYd) (width 0.15))
13 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.Fab) (width 0.15))
14 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.Fab) (width 0.15))
15 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.Fab) (width 0.15))
16 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.Fab) (width 0.15))
17 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.SilkS) (width 0.15))
18 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.SilkS) (width 0.15))
19 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.SilkS) (width 0.15))
20 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.SilkS) (width 0.15))
21 | (fp_text user %R (at 0 0) (layer F.Fab)
22 | (effects (font (size 0.5 0.5) (thickness 0.125)))
23 | )
24 | (pad 1 smd rect (at -0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
25 | (pad 2 smd rect (at 0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
26 | (model ${KIPRJMOD}/../../common/libs/3dshapes/R_0402.wrl
27 | (at (xyz 0 0 0))
28 | (scale (xyz 1 1 1))
29 | (rotate (xyz 0 0 0))
30 | )
31 | )
32 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/C_0603.kicad_mod:
--------------------------------------------------------------------------------
1 | (module C_0603 (layer F.Cu) (tedit 610F932D)
2 | (tags "Capacitor 0603")
3 | (attr smd)
4 | (fp_text reference REF** (at 0 -1.55) (layer F.SilkS)
5 | (effects (font (size 0.75 0.75) (thickness 0.15)))
6 | )
7 | (fp_text value C_0603 (at 0 1.6) (layer F.Fab) hide
8 | (effects (font (size 0.75 0.75) (thickness 0.15)))
9 | )
10 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.Fab) (width 0.15))
11 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.Fab) (width 0.15))
12 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.Fab) (width 0.15))
13 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.Fab) (width 0.15))
14 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.SilkS) (width 0.15))
15 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.SilkS) (width 0.15))
16 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.SilkS) (width 0.15))
17 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.SilkS) (width 0.15))
18 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.CrtYd) (width 0.15))
19 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.CrtYd) (width 0.15))
20 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.CrtYd) (width 0.15))
21 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.CrtYd) (width 0.15))
22 | (fp_text user %R (at 0 0) (layer F.Fab)
23 | (effects (font (size 0.5 0.5) (thickness 0.125)))
24 | )
25 | (pad 1 smd rect (at -0.71 0) (size 0.81 0.97) (layers F.Cu F.Paste F.Mask))
26 | (pad 2 smd rect (at 0.71 0) (size 0.81 0.97) (layers F.Cu F.Paste F.Mask))
27 | (model ${KIPRJMOD}/../../common/libs/3dshapes/C_0603.wrl
28 | (at (xyz 0 0 0))
29 | (scale (xyz 1 1 1))
30 | (rotate (xyz 0 0 0))
31 | )
32 | )
33 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/R_0603.kicad_mod:
--------------------------------------------------------------------------------
1 | (module R_0603 (layer F.Cu) (tedit 610F933F)
2 | (tags "Resistor 0603")
3 | (attr smd)
4 | (fp_text reference REF** (at 0 -1.55) (layer F.SilkS)
5 | (effects (font (size 0.75 0.75) (thickness 0.15)))
6 | )
7 | (fp_text value R_0603 (at 0 1.6) (layer F.Fab) hide
8 | (effects (font (size 0.75 0.75) (thickness 0.15)))
9 | )
10 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.Fab) (width 0.15))
11 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.Fab) (width 0.15))
12 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.Fab) (width 0.15))
13 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.Fab) (width 0.15))
14 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.SilkS) (width 0.15))
15 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.SilkS) (width 0.15))
16 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.SilkS) (width 0.15))
17 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.SilkS) (width 0.15))
18 | (fp_line (start 1.45 -0.825) (end 1.45 0.825) (layer F.CrtYd) (width 0.15))
19 | (fp_line (start -1.45 -0.825) (end -1.45 0.825) (layer F.CrtYd) (width 0.15))
20 | (fp_line (start -1.45 0.825) (end 1.45 0.825) (layer F.CrtYd) (width 0.15))
21 | (fp_line (start -1.45 -0.825) (end 1.45 -0.825) (layer F.CrtYd) (width 0.15))
22 | (fp_text user %R (at 0 0) (layer F.Fab)
23 | (effects (font (size 0.5 0.5) (thickness 0.125)))
24 | )
25 | (pad 1 smd rect (at -0.71 0) (size 0.81 0.97) (layers F.Cu F.Paste F.Mask))
26 | (pad 2 smd rect (at 0.71 0) (size 0.81 0.97) (layers F.Cu F.Paste F.Mask))
27 | (model ${KIPRJMOD}/../../common/libs/3dshapes/R_0603.wrl
28 | (at (xyz 0 0 0))
29 | (scale (xyz 1 1 1))
30 | (rotate (xyz 0 0 0))
31 | )
32 | )
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ECP5_PCIE_Analyzer
2 | The main idea of this project is the evaluation of the possibility of using the PCS-Block of ECP5UMG FPGA for PCI-Express protocol analysis.
3 | The PCS Block can deserialize physical PCI-Express signals and decode 8b10b.
4 | Deserialized data can be used to analyze protocol traffic, detecting errors and so on.
5 | The first implementation involves an adapter print to connect PCI-Express lanes to PCS-Block in FPGA and an evaluation board with ECP5UM(G).
6 | The adapter print should be connected to the eval. board through VERSA Expansion headers and SMA-Cables.
7 |
8 | https://www.latticesemi.com/products/developmentboardsandkits/ecp5evaluationboard
9 | # VERSA Expansion Headers
10 | 
11 | # Eval Board top view
12 | 
13 |
14 | 
15 |
16 | # Eval Board bottom view
17 | 
18 |
19 | # PCB
20 |
21 | Preparing for applying solder paste
22 | 
23 |
24 | Mounting of SMT Stencil
25 | 
26 |
27 | Applying solder paste
28 | 
29 |
30 | PCB
31 | 
32 |
33 | PCB with solder paste
34 | 
35 |
36 | Mounted PCB
37 | 
38 |
39 | # Python script usage
40 |
41 | ## record data (on raspberry pi)
42 |
43 | ```
44 | pi@raspberrypi:~/github/ECP5_PCIE_Analyzer/py_script $ python3 analyzer.py
45 | ['analyzer.py']
46 | file removed
47 | Time: 11.82167429399999 s
48 | ```
49 |
50 | ## analyze data
51 |
52 | copy data to local
53 | ```
54 | scp -r pi@192.168.178.29:~/github/ECP5_PCIE_Analyzer/py_script/*.csv .
55 | ```
56 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/C_0402.kicad_mod:
--------------------------------------------------------------------------------
1 | (module C_0402 (layer F.Cu) (tedit 610F9322)
2 | (attr smd)
3 | (fp_text reference REF** (at 0 1.1) (layer F.SilkS)
4 | (effects (font (size 0.75 0.75) (thickness 0.15)))
5 | )
6 | (fp_text value C_0402R (at 0 2) (layer F.Fab) hide
7 | (effects (font (size 0.75 0.75) (thickness 0.15)))
8 | )
9 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.Fab) (width 0.15))
10 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.Fab) (width 0.15))
11 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.Fab) (width 0.15))
12 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.Fab) (width 0.15))
13 | (fp_line (start -1.016 -0.508) (end -1.016 0.508) (layer F.CrtYd) (width 0.15))
14 | (fp_line (start -1.016 0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
15 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.CrtYd) (width 0.15))
16 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.CrtYd) (width 0.15))
17 | (fp_line (start -1.016 -0.508) (end 1.016 -0.508) (layer F.SilkS) (width 0.15))
18 | (fp_line (start 1.016 -0.508) (end 1.016 0.508) (layer F.SilkS) (width 0.15))
19 | (fp_line (start 1.016 0.508) (end -1.016 0.508) (layer F.SilkS) (width 0.15))
20 | (fp_line (start -1.016 0.508) (end -1.016 -0.508) (layer F.SilkS) (width 0.15))
21 | (fp_text user %R (at 0 0) (layer F.Fab) hide
22 | (effects (font (size 0.5 0.5) (thickness 0.125)))
23 | )
24 | (fp_text user %R (at 0 0) (layer F.Fab)
25 | (effects (font (size 0.5 0.5) (thickness 0.125)))
26 | )
27 | (pad 1 smd rect (at -0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
28 | (pad 2 smd rect (at 0.508 0) (size 0.56 0.56) (layers F.Cu F.Paste F.Mask))
29 | (model ${KIPRJMOD}/../../common/libs/3dshapes/C_0402.wrl
30 | (at (xyz 0 0 0))
31 | (scale (xyz 1 1 1))
32 | (rotate (xyz 0 0 0))
33 | )
34 | )
35 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/SMA_Amphenol_132291_Vertical.kicad_mod:
--------------------------------------------------------------------------------
1 | (module SMA_Amphenol_132291_Vertical (layer F.Cu) (tedit 611B79BF)
2 | (descr https://www.amphenolrf.com/downloads/dl/file/id/3222/product/2918/132291_customer_drawing.pdf)
3 | (tags "SMA THT Female Jack Vertical Bulkhead")
4 | (fp_text reference REF** (at 0 -4.75) (layer F.SilkS)
5 | (effects (font (size 1 1) (thickness 0.15)))
6 | )
7 | (fp_text value SMA_Amphenol_132291_Vertical (at 0 5) (layer F.Fab)
8 | (effects (font (size 1 1) (thickness 0.15)))
9 | )
10 | (fp_circle (center 0 0) (end 3.175 0) (layer F.Fab) (width 0.1))
11 | (fp_line (start 4.17 4.17) (end -4.17 4.17) (layer F.CrtYd) (width 0.05))
12 | (fp_line (start 4.17 4.17) (end 4.17 -4.17) (layer F.CrtYd) (width 0.05))
13 | (fp_line (start -4.17 -4.17) (end -4.17 4.17) (layer F.CrtYd) (width 0.05))
14 | (fp_line (start -4.17 -4.17) (end 4.17 -4.17) (layer F.CrtYd) (width 0.05))
15 | (fp_line (start -3.5 -3.5) (end 3.5 -3.5) (layer F.Fab) (width 0.1))
16 | (fp_line (start -3.5 -3.5) (end -3.5 3.5) (layer F.Fab) (width 0.1))
17 | (fp_line (start -3.5 3.5) (end 3.5 3.5) (layer F.Fab) (width 0.1))
18 | (fp_line (start 3.5 -3.5) (end 3.5 3.5) (layer F.Fab) (width 0.1))
19 | (fp_line (start -3.61 -1.66) (end -3.61 1.66) (layer F.SilkS) (width 0.12))
20 | (fp_line (start 3.61 -1.66) (end 3.61 1.66) (layer F.SilkS) (width 0.12))
21 | (fp_line (start -1.66 3.61) (end 1.66 3.61) (layer F.SilkS) (width 0.12))
22 | (fp_line (start -1.66 -3.61) (end 1.66 -3.61) (layer F.SilkS) (width 0.12))
23 | (fp_text user %R (at 0 0) (layer F.Fab)
24 | (effects (font (size 1 1) (thickness 0.15)))
25 | )
26 | (pad 1 thru_hole circle (at 0 0) (size 2.05 2.05) (drill 1.5) (layers *.Cu *.Mask))
27 | (pad 5 thru_hole circle (at 2.54 2.54) (size 2.25 2.25) (drill 1.7) (layers *.Cu *.Mask))
28 | (pad 3 thru_hole circle (at 2.54 -2.54) (size 2.25 2.25) (drill 1.7) (layers *.Cu *.Mask))
29 | (pad 2 thru_hole circle (at -2.54 -2.54) (size 2.25 2.25) (drill 1.7) (layers *.Cu *.Mask))
30 | (pad 4 thru_hole circle (at -2.54 2.54) (size 2.25 2.25) (drill 1.7) (layers *.Cu *.Mask))
31 | (model ${KIPRJMOD}/../../common/libs/3dshapes/SMA-J-P-H-ST-TH1.stp
32 | (at (xyz 0 0 0))
33 | (scale (xyz 1 1 1))
34 | (rotate (xyz -90 0 0))
35 | )
36 | )
37 |
--------------------------------------------------------------------------------
/fpga_logic/src/cores/pcie/pcie.lpc:
--------------------------------------------------------------------------------
1 | [Device]
2 | Family=sa5p00m
3 | OperatingCondition=IND
4 | Package=CABGA381
5 | PartName=LFE5UM-85F-8BG381I
6 | PartType=LFE5UM-85F
7 | SpeedGrade=8
8 | Status=P
9 | [IP]
10 | CoreName=PCI Express Endpoint Core
11 | CoreRevision=6.7
12 | CoreStatus=Demo
13 | CoreType=IPCFG
14 | Date=02/04/2021
15 | ModuleName=pcie
16 | ParameterFileVersion=1.0
17 | SourceFormat=vhdl
18 | Time=13:05:57
19 | VendorName=Lattice Semiconductor Corporation
20 | [Parameters]
21 | AER=0
22 | AER_CAP_VER=1
23 | BAR0=FFFF0000
24 | BAR1=FFFFFF00
25 | BAR2=FFFE0000
26 | BAR3=FFFFFF80
27 | BAR4=00000000
28 | BAR5=00000000
29 | BAR_REG_PORTS=0
30 | BIST=00
31 | BusWidth=1
32 | CAP_VERSION=2
33 | CARDBUS_CIS_POINTER=00000000
34 | CH_MODE=Rx and Tx
35 | CLASS_CODE=FF0000
36 | CORE_SYNP=1
37 | Channel=CH0
38 | Config=X1
39 | DATA_SCALE=0
40 | DCUA=DCU0
41 | DEV_CAP_REG=0000000
42 | DEV_CAP_REG2=11
43 | DEV_ID=0001
44 | DEV_SER_NUM=0000000000000000
45 | DSN_CAP_VER=1
46 | DataWidth=8
47 | ECRC=0
48 | EN_ALL_TLPS=0
49 | EN_BAR0=1
50 | EN_BAR1=1
51 | EN_BAR2=1
52 | EN_BAR3=1
53 | EN_BAR4=0
54 | EN_BAR5=0
55 | EN_DYN_ID=0
56 | EN_ER_BAR=0
57 | ERO_HW=1
58 | ER_BAR=00000000
59 | GEN2=Gen 2
60 | GSR=1
61 | HEADER_TYPE=00
62 | LANE_WIDTH=X1 Native
63 | LEGACY_EP=PCI Express Endpoint
64 | LINK_CAP_REG=00
65 | LINK_STA_REG_12=1
66 | LPEVCC=0
67 | MASTER_LB=0
68 | MAX_LINK_WIDTH=1
69 | MAX_PAYLOAD_SIZE=128
70 | MSI_FACE=1
71 | NEXT_CAP_POINT=60
72 | NOT_CFG_REG=0
73 | NO_DSN=0
74 | NPD_FC_0=32
75 | NPD_FREQ=8
76 | NPH_FC_0=32
77 | NPH_FREQ=8
78 | NUM_CHS=1
79 | NUM_MSG_RQST=8
80 | NUM_VC=1
81 | PD_FC_0=0
82 | PD_FREQ=255
83 | PD_INFINITE=1
84 | PH_FC_0=0
85 | PH_FREQ=8
86 | PH_INFINITE=1
87 | PROTOCOL=PCIE
88 | PWR_CONSUME_D0=00
89 | PWR_CONSUME_D1=00
90 | PWR_CONSUME_D2=00
91 | PWR_CONSUME_D3=00
92 | PWR_DISSIPATE_D0=00
93 | PWR_DISSIPATE_D1=00
94 | PWR_DISSIPATE_D2=00
95 | PWR_DISSIPATE_D3=00
96 | PWR_MG_CAP_REG=0003
97 | QUAD_LOC=UR
98 | QUAD_LOC_ECP3=PCSA
99 | REFCLK_RATE=100.0000
100 | REV_ID=00
101 | SBP=1
102 | SUBSYSTEM_ID=0000
103 | SUBSYSTEM_VENDOR_ID=0000
104 | StsWidth=3
105 | TXPLLMULT=25X
106 | TX_MAX_RATE=2.5
107 | UPDATE_TIMER=4095
108 | USR_EXT_CAP_ADDR=17C
109 | VCT=none
110 | VENDOR_ID=0BAE
111 | WISHBONE=0
112 | pcie_pcs.txt=pcs_module
113 | pcs_pipe_8b_x1.txt=pcs_module
114 | pcs_pipe_8b_x4.txt=pcs_module
115 | pcs_pipe_bb.v=black_box_verilog
116 | [SYSTEMPNR]
117 | LN0=DCU0_CH0
118 |
--------------------------------------------------------------------------------
/fpga_logic/src/pdpram.vhd:
--------------------------------------------------------------------------------
1 | library ieee;
2 | use ieee.std_logic_1164.all;
3 | use ieee.std_logic_unsigned.all;
4 |
5 | entity pdpram is
6 | generic (
7 | addr_width : natural := 16;
8 | data_width : natural := 36);
9 | port (
10 | write_en : in std_logic;
11 | waddr : in std_logic_vector (addr_width - 1 downto 0);
12 | wclk : in std_logic;
13 | raddr : in std_logic_vector (addr_width - 1 downto 0);
14 | rclk : in std_logic;
15 | din : in std_logic_vector (data_width - 1 downto 0);
16 | dout : out std_logic_vector (data_width - 1 downto 0));
17 | end pdpram;
18 |
19 | architecture rtl of pdpram is
20 | type mem_type is array (0 to (2 ** addr_width) - 1) of std_logic_vector(35 downto 0);
21 |
22 | signal mem : mem_type;/* := (
23 | ('1' & X"00" & '0' & X"CD" & '0' & X"EF" & '0' & X"FF"), -- 1
24 | ('0' & X"D0" & '0' & X"D1" & '0' & X"D2" & '0' & X"D3"), -- 2
25 | ('1' & X"D4" & '0' & X"D5" & '0' & X"D6" & '0' & X"D7"), -- 3
26 | ('0' & X"D8" & '0' & X"D9" & '0' & X"DA" & '0' & X"DB"), -- 4
27 | ('0' & X"DC" & '0' & X"DD" & '0' & X"DE" & '0' & X"DF"), -- 5
28 | ('0' & X"10" & '0' & X"11" & '0' & X"12" & '0' & X"13"), -- 6
29 | ('0' & X"14" & '0' & X"15" & '0' & X"16" & '0' & X"17"), -- 7
30 | ('0' & X"18" & '0' & X"19" & '0' & X"1A" & '0' & X"1B"), -- 8
31 | ('1' & X"AB" & '0' & X"CD" & '0' & X"EF" & '0' & X"FF"), -- 1
32 | ('0' & X"20" & '0' & X"21" & '0' & X"22" & '0' & X"23"), -- 2
33 | ('0' & X"24" & '0' & X"25" & '0' & X"26" & '0' & X"27"), -- 3
34 | ('0' & X"28" & '0' & X"29" & '0' & X"2A" & '0' & X"2B"), -- 4
35 | ('0' & X"2C" & '0' & X"2D" & '0' & X"2E" & '0' & X"2F"), -- 5
36 | ('0' & X"30" & '0' & X"31" & '0' & X"32" & '0' & X"33"), -- 6
37 | ('0' & X"34" & '0' & X"35" & '0' & X"36" & '0' & X"37"), -- 7
38 | ('0' & X"38" & '0' & X"39" & '0' & X"3A" & '0' & X"3B"), -- 8
39 | others => (others =>'0')
40 | );
41 | */
42 |
43 | attribute syn_ramstyle : string;
44 | attribute syn_ramstyle of mem: signal is "no_rw_check";
45 | begin
46 | process (wclk) -- Write memory.
47 | begin
48 | if (wclk'event and wclk = '1') then
49 | if (write_en = '1') then
50 | mem(conv_integer(waddr)) <= din; -- Using write address bus.
51 | end if;
52 | end if;
53 | end process;
54 |
55 | process (rclk) -- Read memory.
56 | begin
57 | if (rclk'event and rclk = '1') then
58 | dout <= mem(conv_integer(raddr)); -- Using read address bus.
59 | end if;
60 | end process;
61 | end rtl;
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/VQFN-16.kicad_mod:
--------------------------------------------------------------------------------
1 | (module VQFN-16 (layer F.Cu) (tedit 611BAC4D)
2 | (fp_text reference REF** (at 0 -2.525) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value VQFN-16 (at 0 10.16) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_line (start -1.5 -1.5) (end -1.5 -1) (layer F.SilkS) (width 0.12))
9 | (fp_line (start -1.5 -1.5) (end -1 -1.5) (layer F.SilkS) (width 0.12))
10 | (fp_line (start -1.5 1.5) (end -1 1.5) (layer F.SilkS) (width 0.12))
11 | (fp_line (start 1.5 1.5) (end 1.5 1) (layer F.SilkS) (width 0.12))
12 | (fp_line (start 1.5 -1.5) (end 1 -1.5) (layer F.SilkS) (width 0.12))
13 | (fp_line (start -1.5 1.5) (end -1.5 1) (layer F.SilkS) (width 0.12))
14 | (fp_line (start 1.5 1.5) (end 1 1.5) (layer F.SilkS) (width 0.12))
15 | (fp_line (start 1.5 -1.5) (end 1.5 -1) (layer F.SilkS) (width 0.12))
16 | (fp_line (start -1.5 -1) (end -1 -1.5) (layer F.SilkS) (width 0.12))
17 | (fp_line (start -1 -1.5) (end -1.45 -1.2) (layer F.SilkS) (width 0.12))
18 | (fp_line (start -1.45 -1.2) (end -1.25 -1.425) (layer F.SilkS) (width 0.12))
19 | (fp_line (start -1.25 -1.425) (end -1.425 -1.35) (layer F.SilkS) (width 0.12))
20 | (fp_line (start -1.425 -1.35) (end -1.425 -1.45) (layer F.SilkS) (width 0.12))
21 | (fp_line (start -1.5 -1.5) (end 1.5 -1.5) (layer F.CrtYd) (width 0.12))
22 | (fp_line (start 1.5 -1.5) (end 1.5 1.5) (layer F.CrtYd) (width 0.12))
23 | (fp_line (start 1.5 1.5) (end -1.5 1.5) (layer F.CrtYd) (width 0.12))
24 | (fp_line (start -1.5 1.5) (end -1.5 -1.5) (layer F.CrtYd) (width 0.12))
25 | (pad 1 smd rect (at -1.4 -0.75) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
26 | (pad 2 smd rect (at -1.4 -0.25) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
27 | (pad 3 smd rect (at -1.4 0.25) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
28 | (pad 4 smd rect (at -1.4 0.75) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
29 | (pad 5 smd rect (at -0.75 1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
30 | (pad 6 smd rect (at -0.25 1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
31 | (pad 7 smd rect (at 0.25 1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
32 | (pad 8 smd rect (at 0.75 1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
33 | (pad 9 smd rect (at 1.4 0.75) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
34 | (pad 10 smd rect (at 1.4 0.25) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
35 | (pad 11 smd rect (at 1.4 -0.25) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
36 | (pad 12 smd rect (at 1.4 -0.75) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
37 | (pad 13 smd rect (at 0.75 -1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
38 | (pad 14 smd rect (at 0.25 -1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
39 | (pad 15 smd rect (at -0.25 -1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
40 | (pad 16 smd rect (at -0.75 -1.4 90) (size 0.6 0.24) (layers F.Cu F.Paste F.Mask))
41 | (pad EP smd roundrect (at 0 0 90) (size 1.68 1.68) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.06))
42 | (model ${KIPRJMOD}/../../common/libs/3dshapes/vson.step
43 | (at (xyz 0 0 0))
44 | (scale (xyz 1 1 1))
45 | (rotate (xyz 0 0 0))
46 | )
47 | )
48 |
--------------------------------------------------------------------------------
/fpga_logic/src/pll.vhd:
--------------------------------------------------------------------------------
1 | -- VHDL netlist generated by SCUBA Diamond (64-bit) 3.11.3.469
2 | -- Module Version: 5.7
3 | --C:\lscc\diamond\3.11_x64\ispfpga\bin\nt64\scuba.exe -w -n pll -lang vhdl -synth synplify -bus_exp 7 -bb -arch sa5p00g -type pll -fin 25.00 -fclkop 100.00 -fclkop_tol 0.0 -phase_cntl STATIC -lock -fb_mode 1 -fdc C:/Users/grpa/Documents/WORK/ECP5_PCIE_Analyzer/fpga_logic/impl/ip_cores/pll/pll.fdc
4 |
5 | -- Wed Jan 19 09:46:06 2022
6 |
7 | library IEEE;
8 | use IEEE.std_logic_1164.all;
9 | library ecp5um;
10 | use ecp5um.components.all;
11 |
12 | entity pll is
13 | port (
14 | CLKI: in std_logic;
15 | CLKOP: out std_logic;
16 | LOCK: out std_logic);
17 | end pll;
18 |
19 | architecture Structure of pll is
20 |
21 | -- internal signal declarations
22 | signal REFCLK: std_logic;
23 | signal CLKOP_t: std_logic;
24 | signal scuba_vhi: std_logic;
25 | signal scuba_vlo: std_logic;
26 |
27 | attribute FREQUENCY_PIN_CLKOP : string;
28 | attribute FREQUENCY_PIN_CLKI : string;
29 | attribute ICP_CURRENT : string;
30 | attribute LPF_RESISTOR : string;
31 | attribute FREQUENCY_PIN_CLKOP of PLLInst_0 : label is "100.000000";
32 | attribute FREQUENCY_PIN_CLKI of PLLInst_0 : label is "25.000000";
33 | attribute ICP_CURRENT of PLLInst_0 : label is "5";
34 | attribute LPF_RESISTOR of PLLInst_0 : label is "16";
35 | attribute syn_keep : boolean;
36 | attribute NGD_DRC_MASK : integer;
37 | attribute NGD_DRC_MASK of Structure : architecture is 1;
38 |
39 | begin
40 | -- component instantiation statements
41 | scuba_vhi_inst: VHI
42 | port map (Z=>scuba_vhi);
43 |
44 | scuba_vlo_inst: VLO
45 | port map (Z=>scuba_vlo);
46 |
47 | PLLInst_0: EHXPLLL
48 | generic map (PLLRST_ENA=> "DISABLED", INTFB_WAKE=> "DISABLED",
49 | STDBY_ENABLE=> "DISABLED", DPHASE_SOURCE=> "DISABLED",
50 | CLKOS3_FPHASE=> 0, CLKOS3_CPHASE=> 0, CLKOS2_FPHASE=> 0,
51 | CLKOS2_CPHASE=> 0, CLKOS_FPHASE=> 0, CLKOS_CPHASE=> 0,
52 | CLKOP_FPHASE=> 0, CLKOP_CPHASE=> 5, PLL_LOCK_MODE=> 0,
53 | CLKOS_TRIM_DELAY=> 0, CLKOS_TRIM_POL=> "FALLING",
54 | CLKOP_TRIM_DELAY=> 0, CLKOP_TRIM_POL=> "FALLING",
55 | OUTDIVIDER_MUXD=> "DIVD", CLKOS3_ENABLE=> "DISABLED",
56 | OUTDIVIDER_MUXC=> "DIVC", CLKOS2_ENABLE=> "DISABLED",
57 | OUTDIVIDER_MUXB=> "DIVB", CLKOS_ENABLE=> "DISABLED",
58 | OUTDIVIDER_MUXA=> "DIVA", CLKOP_ENABLE=> "ENABLED", CLKOS3_DIV=> 1,
59 | CLKOS2_DIV=> 1, CLKOS_DIV=> 1, CLKOP_DIV=> 6, CLKFB_DIV=> 4,
60 | CLKI_DIV=> 1, FEEDBK_PATH=> "CLKOP")
61 | port map (CLKI=>CLKI, CLKFB=>CLKOP_t, PHASESEL1=>scuba_vlo,
62 | PHASESEL0=>scuba_vlo, PHASEDIR=>scuba_vlo,
63 | PHASESTEP=>scuba_vlo, PHASELOADREG=>scuba_vlo,
64 | STDBY=>scuba_vlo, PLLWAKESYNC=>scuba_vlo, RST=>scuba_vlo,
65 | ENCLKOP=>scuba_vlo, ENCLKOS=>scuba_vlo, ENCLKOS2=>scuba_vlo,
66 | ENCLKOS3=>scuba_vlo, CLKOP=>CLKOP_t, CLKOS=>open,
67 | CLKOS2=>open, CLKOS3=>open, LOCK=>LOCK, INTLOCK=>open,
68 | REFCLK=>REFCLK, CLKINTFB=>open);
69 |
70 | CLKOP <= CLKOP_t;
71 | end Structure;
72 |
--------------------------------------------------------------------------------
/fpga_logic/src/pll_200.vhd:
--------------------------------------------------------------------------------
1 | -- VHDL netlist generated by SCUBA Diamond (64-bit) 3.11.3.469
2 | -- Module Version: 5.7
3 | --C:\lscc\diamond\3.11_x64\ispfpga\bin\nt64\scuba.exe -w -n pll_200 -lang vhdl -synth synplify -bus_exp 7 -bb -arch sa5p00g -type pll -fin 200 -fclkop 125.00 -fclkop_tol 0.0 -phase_cntl STATIC -lock -fb_mode 1 -fdc C:/Users/grpa/Documents/WORK/ECP5_PCIE_Analyzer/fpga_logic/impl/ip_cores/pll_200/pll_200.fdc
4 |
5 | -- Fri Jan 21 12:46:58 2022
6 |
7 | library IEEE;
8 | use IEEE.std_logic_1164.all;
9 | library ecp5um;
10 | use ecp5um.components.all;
11 |
12 | entity pll_200 is
13 | port (
14 | CLKI: in std_logic;
15 | CLKOP: out std_logic;
16 | LOCK: out std_logic);
17 | end pll_200;
18 |
19 | architecture Structure of pll_200 is
20 |
21 | -- internal signal declarations
22 | signal REFCLK: std_logic;
23 | signal CLKOP_t: std_logic;
24 | signal scuba_vhi: std_logic;
25 | signal scuba_vlo: std_logic;
26 |
27 | attribute FREQUENCY_PIN_CLKOP : string;
28 | attribute FREQUENCY_PIN_CLKI : string;
29 | attribute ICP_CURRENT : string;
30 | attribute LPF_RESISTOR : string;
31 | attribute FREQUENCY_PIN_CLKOP of PLLInst_0 : label is "125.000000";
32 | attribute FREQUENCY_PIN_CLKI of PLLInst_0 : label is "200.000000";
33 | attribute ICP_CURRENT of PLLInst_0 : label is "5";
34 | attribute LPF_RESISTOR of PLLInst_0 : label is "16";
35 | attribute syn_keep : boolean;
36 | attribute NGD_DRC_MASK : integer;
37 | attribute NGD_DRC_MASK of Structure : architecture is 1;
38 |
39 | begin
40 | -- component instantiation statements
41 | scuba_vhi_inst: VHI
42 | port map (Z=>scuba_vhi);
43 |
44 | scuba_vlo_inst: VLO
45 | port map (Z=>scuba_vlo);
46 |
47 | PLLInst_0: EHXPLLL
48 | generic map (PLLRST_ENA=> "DISABLED", INTFB_WAKE=> "DISABLED",
49 | STDBY_ENABLE=> "DISABLED", DPHASE_SOURCE=> "DISABLED",
50 | CLKOS3_FPHASE=> 0, CLKOS3_CPHASE=> 0, CLKOS2_FPHASE=> 0,
51 | CLKOS2_CPHASE=> 0, CLKOS_FPHASE=> 0, CLKOS_CPHASE=> 0,
52 | CLKOP_FPHASE=> 0, CLKOP_CPHASE=> 4, PLL_LOCK_MODE=> 0,
53 | CLKOS_TRIM_DELAY=> 0, CLKOS_TRIM_POL=> "FALLING",
54 | CLKOP_TRIM_DELAY=> 0, CLKOP_TRIM_POL=> "FALLING",
55 | OUTDIVIDER_MUXD=> "DIVD", CLKOS3_ENABLE=> "DISABLED",
56 | OUTDIVIDER_MUXC=> "DIVC", CLKOS2_ENABLE=> "DISABLED",
57 | OUTDIVIDER_MUXB=> "DIVB", CLKOS_ENABLE=> "DISABLED",
58 | OUTDIVIDER_MUXA=> "DIVA", CLKOP_ENABLE=> "ENABLED", CLKOS3_DIV=> 1,
59 | CLKOS2_DIV=> 1, CLKOS_DIV=> 1, CLKOP_DIV=> 5, CLKFB_DIV=> 5,
60 | CLKI_DIV=> 8, FEEDBK_PATH=> "CLKOP")
61 | port map (CLKI=>CLKI, CLKFB=>CLKOP_t, PHASESEL1=>scuba_vlo,
62 | PHASESEL0=>scuba_vlo, PHASEDIR=>scuba_vlo,
63 | PHASESTEP=>scuba_vlo, PHASELOADREG=>scuba_vlo,
64 | STDBY=>scuba_vlo, PLLWAKESYNC=>scuba_vlo, RST=>scuba_vlo,
65 | ENCLKOP=>scuba_vlo, ENCLKOS=>scuba_vlo, ENCLKOS2=>scuba_vlo,
66 | ENCLKOS3=>scuba_vlo, CLKOP=>CLKOP_t, CLKOS=>open,
67 | CLKOS2=>open, CLKOS3=>open, LOCK=>LOCK, INTLOCK=>open,
68 | REFCLK=>REFCLK, CLKINTFB=>open);
69 |
70 | CLKOP <= CLKOP_t;
71 | end Structure;
72 |
--------------------------------------------------------------------------------
/fpga_logic/script/make_sim.tcl:
--------------------------------------------------------------------------------
1 |
2 | cd ..
3 | set ProjectPath [pwd]
4 | set SrcPath $ProjectPath/SRC
5 |
6 | puts "Clear project"
7 |
8 | file delete -force sim_core
9 |
10 | file mkdir sim_core
11 | cd $ProjectPath/sim_core
12 |
13 | puts "Creating new backplane project"
14 |
15 | prj_project new -name "pcie_core" -impl "pcie_core" -dev LFE5UM-85F-8BG381I -synthesis "synplify"
16 | prj_project save
17 |
18 | puts "Copying core files"
19 |
20 | file mkdir ip_cores/pcie
21 | file mkdir ip_cores/extref
22 | file copy -force $ProjectPath/src/cores/pcie/pcie.lpc $ProjectPath/sim_core/ip_cores/pcie/pcie.lpc
23 | file copy -force $ProjectPath/src/cores/pcie/generate_core.tcl $ProjectPath/sim_core/ip_cores/pcie/generate_core.tcl
24 | file copy -force $ProjectPath/src/cores/pcie/generate_ngd.tcl $ProjectPath/sim_core/ip_cores/pcie/generate_ngd.tcl
25 | file copy -force $ProjectPath/src/cores/extref/extref.lpc $ProjectPath/sim_core/ip_cores/extref/extref.lpc
26 | file copy -force $ProjectPath/src/cores/extref/generate_core.tcl $ProjectPath/sim_core/ip_cores/extref/generate_core.tcl
27 | file copy -force $ProjectPath/src/cores/extref/generate_ngd.tcl $ProjectPath/sim_core/ip_cores/extref/generate_ngd.tcl
28 |
29 | set currentPath [pwd];set tmp_autopath $auto_path
30 |
31 | file copy -force $ProjectPath/src/cores/ip_cores.sbx $ProjectPath/sim_core/ip_cores/ip_cores.sbx
32 |
33 | prj_src add "ip_cores/ip_cores.sbx"
34 | sbp_design open -dsgn ip_cores/ip_cores.sbx
35 |
36 | puts "Creating PICExpress core"
37 |
38 | cd "$ProjectPath/sim_core/ip_cores/pcie"
39 | source "$ProjectPath/sim_core/ip_cores/pcie/generate_core.tcl"
40 | set auto_path $tmp_autopath;cd $currentPath
41 | set currentPath [pwd];set tmp_autopath $auto_path
42 | cd "$ProjectPath/sim_core/ip_cores/pcie"
43 | source "$ProjectPath/sim_core/ip_cores/pcie/generate_ngd.tcl"
44 |
45 | cd $currentPath
46 |
47 | sbp_builder export_add -comp {ip_cores/pcie}
48 |
49 | puts "Placing DCUCHANNEL"
50 | sbp_resource place -rsc {ip_cores/pcie/DCUCHANNEL} -id 5
51 |
52 | puts "Creating Extref core"
53 |
54 | cd "$ProjectPath/sim_core/ip_cores/extref"
55 | source "$ProjectPath/sim_core/ip_cores/extref/generate_core.tcl"
56 | set auto_path $tmp_autopath;cd $currentPath
57 | set currentPath [pwd];set tmp_autopath $auto_path
58 | cd "$ProjectPath/sim_core/ip_cores/extref"
59 | source "$ProjectPath/sim_core/ip_cores/extref/generate_ngd.tcl"
60 |
61 | sbp_builder export_add -comp {ip_cores/extref}
62 | puts "Placing EXTREF"
63 |
64 | sbp_resource place -rsc {ip_cores/extref/EXTREF} -id 3
65 |
66 | puts "Generating PCIExpress core"
67 |
68 | sbp_design gen
69 |
70 | sbp_design save
71 |
72 | sbp_design close
73 |
74 | prj_src add "$ProjectPath/src/pci_core_wrapper.vhd"
75 | prj_src add "$ProjectPath/src/pci_wrapper_pkg.vhd"
76 | prj_src add "$ProjectPath/src/pcie_rx_engine.vhd"
77 | prj_src add "$ProjectPath/src/pcie_tx_engine.vhd"
78 | prj_src add "$ProjectPath/src/pci_read_request_fifo.vhd"
79 | prj_src add "$ProjectPath/src/top_pkg.vhd"
80 | prj_src add "$ProjectPath/src/top.vhd"
81 |
82 |
83 | prj_src add "$ProjectPath/SRC/constrains.lpf"
84 | prj_src enable "$ProjectPath/SRC/constrains.lpf"
85 | prj_src remove "$ProjectPath/sim_core/bpl100.lpf"
86 | file delete -force $ProjectPath/sim_core/bpl100.lpf
87 |
88 | prj_strgy set_value -strategy Strategy1 syn_vhdl2008=True
89 | prj_project save
--------------------------------------------------------------------------------
/fpga_logic/src/pulse_filt.vhd:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------------------
2 | -- Module: pulse_filt
3 | -- File: pulse_filt.vhd
4 | -----------------------------------------------------------------------------
5 | -- COPYRIGHT BY G BACHMANN ELECTRONIC GMBH 2014
6 | -----------------------------------------------------------------------------
7 |
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | use ieee.numeric_std.all;
11 |
12 |
13 | --! @author WANA
14 | --! @brief Configurable filter
15 | --! @details This entity defines a configurable filter. The filter is build with an up / down counter.
16 | --! When the input x is high the counter is incremented until it reaches the value filter_len_sel. Then the output y goes to high.
17 | --! When the input x is low the counter is decremented until it reaches the value 0. Then the output y goes to low.
18 |
19 | entity pulse_filt is
20 | generic (
21 | constant FILT_LEN : integer := 8 --! length of the filter constant
22 | );
23 | port (
24 | clk : in std_logic; --! clock input
25 | rst : in std_logic; --! reset (active high)
26 | -- Filter len select
27 | filt_len_sel : std_logic_vector(FILT_LEN-1 downto 0); --! filter value
28 | x : in std_logic; --! signal to filter
29 | y : out std_logic --! filtered signal
30 | );
31 | end;
32 |
33 | architecture rtl of pulse_filt is
34 |
35 | type reg_t is record
36 | filter_count : unsigned(FILT_LEN-1 downto 0);
37 | y : std_logic;
38 | end record reg_t;
39 |
40 | -- Initial values after reset
41 | constant REG_T_INIT : reg_t := (
42 | filter_count => (others => '0'),
43 | y => '0'
44 | );
45 |
46 |
47 |
48 | signal r, rin : reg_t;
49 |
50 | begin
51 |
52 | -- Combinatorial process
53 | comb : process (r,x, filt_len_sel) is
54 | variable v : reg_t;
55 | begin
56 | v := r;
57 | -- Workaround for filt_len = 0
58 | if unsigned(filt_len_sel) = 0 then
59 | v.y := x;
60 | v.filter_count := (others=>'0'); -- Reset filter counter
61 | else
62 | -- Pulse counter with saturation
63 | if x='1' then
64 | if r.filter_count < unsigned(filt_len_sel) then
65 | v.filter_count:= r.filter_count + 1;
66 | end if;
67 | else
68 | if r.filter_count > 0 then
69 | v.filter_count := r.filter_count - 1;
70 | end if;
71 | end if;
72 |
73 | -- set/reset logic for filter output
74 | if r.filter_count = unsigned(filt_len_sel) then
75 | v.y := '1';
76 | elsif r.filter_count = 0 then
77 | v.y := '0';
78 | end if;
79 | end if;
80 |
81 | -- Output assignments
82 | y <= v.y;
83 |
84 | rin <= v;
85 | end process comb;
86 |
87 | -- Register process
88 | regs : process (clk) is
89 | begin
90 | -- Synchronous reset
91 | if rising_edge(clk) then
92 | if rst = '1' then
93 | r <= REG_T_INIT;
94 | else
95 | r <= rin;
96 | end if;
97 | end if;
98 | end process regs;
99 | end;
100 |
--------------------------------------------------------------------------------
/fpga_logic/script/make.tcl:
--------------------------------------------------------------------------------
1 | cd ..
2 | set ProjectPath [pwd]
3 | set SrcPath $ProjectPath/SRC
4 |
5 | puts "Clear project"
6 |
7 | file delete -force impl
8 |
9 | file mkdir impl
10 | cd $ProjectPath/impl
11 |
12 | puts "Creating new backplane project"
13 |
14 | prj_project new -name "analyzer" -impl "analyzer" -dev LFE5UM5G-85F-8BG381C -synthesis "synplify"
15 | prj_project save
16 |
17 | #puts "Copying core files"
18 | #
19 | #file mkdir ip_cores/pcie
20 | #file mkdir ip_cores/extref
21 | #file copy -force $ProjectPath/src/cores/pcie/pcie.lpc $ProjectPath/impl/ip_cores/pcie/pcie.lpc
22 | #file copy -force $ProjectPath/src/cores/pcie/generate_core.tcl $ProjectPath/impl/ip_cores/pcie/generate_core.tcl
23 | #file copy -force $ProjectPath/src/cores/pcie/generate_ngd.tcl $ProjectPath/impl/ip_cores/pcie/generate_ngd.tcl
24 | #file copy -force $ProjectPath/src/cores/extref/extref.lpc $ProjectPath/impl/ip_cores/extref/extref.lpc
25 | #file copy -force $ProjectPath/src/cores/extref/generate_core.tcl $ProjectPath/impl/ip_cores/extref/generate_core.tcl
26 | #file copy -force $ProjectPath/src/cores/extref/generate_ngd.tcl $ProjectPath/impl/ip_cores/extref/generate_ngd.tcl
27 |
28 | #set currentPath [pwd];set tmp_autopath $auto_path
29 | #
30 | #file copy -force $ProjectPath/src/cores/ip_cores.sbx $ProjectPath/impl/ip_cores/ip_cores.sbx
31 | #
32 | #prj_src add "ip_cores/ip_cores.sbx"
33 | #sbp_design open -dsgn ip_cores/ip_cores.sbx
34 | #
35 | #puts "Creating PICExpress core"
36 | #
37 | #cd "$ProjectPath/impl/ip_cores/pcie"
38 | #source "$ProjectPath/impl/ip_cores/pcie/generate_core.tcl"
39 | #set auto_path $tmp_autopath;cd $currentPath
40 | #set currentPath [pwd];set tmp_autopath $auto_path
41 | #cd "$ProjectPath/impl/ip_cores/pcie"
42 | #source "$ProjectPath/impl/ip_cores/pcie/generate_ngd.tcl"
43 |
44 | #cd $currentPath
45 | #
46 | #sbp_builder export_add -comp {ip_cores/pcie}
47 | #
48 | #puts "Placing DCUCHANNEL"
49 | #sbp_resource place -rsc {ip_cores/pcie/DCUCHANNEL} -id 5
50 | #
51 | #puts "Creating Extref core"
52 | #
53 | #cd "$ProjectPath/impl/ip_cores/extref"
54 | #source "$ProjectPath/impl/ip_cores/extref/generate_core.tcl"
55 | #set auto_path $tmp_autopath;cd $currentPath
56 | #set currentPath [pwd];set tmp_autopath $auto_path
57 | #cd "$ProjectPath/impl/ip_cores/extref"
58 | #source "$ProjectPath/impl/ip_cores/extref/generate_ngd.tcl"
59 | #
60 | #sbp_builder export_add -comp {ip_cores/extref}
61 | #puts "Placing EXTREF"
62 | #
63 | #sbp_resource place -rsc {ip_cores/extref/EXTREF} -id 3
64 | #
65 | #puts "Generating PCIExpress core"
66 | #
67 | #sbp_design gen
68 | #
69 | #sbp_design save
70 | #
71 | #sbp_design close
72 |
73 | prj_src add "$ProjectPath/src/analyzer_pkg.vhd"
74 | prj_src add "$ProjectPath/src/analyzer.vhd"
75 | prj_src add "$ProjectPath/src/packet_ram.vhd"
76 | prj_src add "$ProjectPath/src/lfsr_scrambler.vhd"
77 | prj_src add "$ProjectPath/src/controller.vhd"
78 | prj_src add "$ProjectPath/src/top_pkg.vhd"
79 | prj_src add "$ProjectPath/src/top.vhd"
80 | prj_src add "$ProjectPath/src/spi_slave.vhd"
81 | prj_src add "$ProjectPath/src/pulse_filt.vhd"
82 | prj_src add "$ProjectPath/src/rev_analyzer.vhd"
83 | prj_src add "$ProjectPath/src/extref.vhd"
84 | prj_src add "$ProjectPath/src/pcs_pci_rx.vhd"
85 | prj_src add "$ProjectPath/src/pcs_pci_tx.vhd"
86 | prj_src add "$ProjectPath/src/pll.vhd"
87 | prj_src add "$ProjectPath/src/pll_200.vhd"
88 |
89 |
90 | prj_src add "$ProjectPath/SRC/analyzer.lpf"
91 | prj_src enable "$ProjectPath/SRC/analyzer.lpf"
92 |
93 | prj_strgy set_value -strategy Strategy1 syn_vhdl2008=True
94 | prj_project save
--------------------------------------------------------------------------------
/fpga_logic/src/cores/pcie/generate_core.tcl:
--------------------------------------------------------------------------------
1 |
2 | #!/usr/local/bin/wish
3 |
4 | set cpu $tcl_platform(machine)
5 |
6 | switch $cpu {
7 | intel -
8 | i*86* {
9 | set cpu ix86
10 | }
11 | x86_64 {
12 | if {$tcl_platform(wordSize) == 4} {
13 | set cpu ix86
14 | }
15 | }
16 | }
17 |
18 | switch $tcl_platform(platform) {
19 | windows {
20 | set Para(os_platform) windows
21 | if {$cpu == "amd64"} {
22 | # Do not check wordSize, win32-x64 is an IL32P64 platform.
23 | set cpu x86_64
24 | }
25 | }
26 | unix {
27 | if {$tcl_platform(os) == "Linux"} {
28 | set Para(os_platform) linux
29 | } else {
30 | set Para(os_platform) unix
31 | }
32 | }
33 | }
34 |
35 | if {$cpu == "x86_64"} {
36 | set NTPATH nt64
37 | set LINPATH lin64
38 | } else {
39 | set NTPATH nt
40 | set LINPATH lin
41 | }
42 |
43 | if {$Para(os_platform) == "linux" } {
44 | set os $LINPATH
45 | set idxfile [file join $env(HOME) ipsetting_l.lst]
46 | } else {
47 | set os $NTPATH
48 | set idxfile [file join c:/lsc_env ipsetting.lst]
49 | }
50 |
51 | set Para(cmd) ""
52 | if ![catch {set temp $argc} result] {
53 | if {$argc > 0} {
54 | for {set i 0} {$i < $argc} {incr i 2} {
55 | set temp [lindex $argv $i]
56 | set temp [string range $temp 1 end]
57 | lappend argv_list $temp
58 | lappend value_list [lindex $argv [expr $i+1]]
59 | }
60 | foreach argument $argv_list value $value_list {
61 | switch $argument {
62 | "cmd" {set Para(cmd) $value;}
63 | }
64 | }
65 | }
66 | }
67 |
68 | set Para(ProjectPath) [file dirname [info script]]
69 | package forget core_template
70 | package forget LatticeIPCore
71 | package forget IP_Control
72 | package forget Core_Generate
73 | package forget IP_Generate
74 | package forget IP_Templates
75 | set auto_path "$auto_path"
76 | set Para(install_dir) $env(TOOLRTF)
77 | set Para(CoreIndex) "pci_express_endpoint_v6.7"
78 | set Para(CoreRoot) ""
79 | set fid [open $idxfile r]
80 | while {[gets $fid line ]>=0} {
81 | if [regexp {([^=]*)=(.*)} $line match parameter value] {
82 | if [regexp {([ |\t]*;)} $parameter match] {continue}
83 | set parameter [string trim $parameter]
84 | set value [string trim $value]
85 | if {$parameter==$Para(CoreIndex)} {
86 | if [regexp {(.*)[ |\t]*;} $value match temp] {
87 | set Para(CoreRoot) $temp
88 | } else {
89 | set Para(CoreRoot) $value
90 | }
91 | }
92 | }
93 | }
94 | if {[string length $Para(CoreRoot)]==0} {
95 | puts stderr "Error: IP $Para(CoreIndex) is not found!"
96 | exit
97 | }
98 |
99 | set Para(ModuleName) "pcie"
100 | set Para(lib) "[file join $Para(CoreRoot) $Para(CoreIndex) lib]"
101 | set Para(CoreName) "PCI Express Endpoint Core"
102 | set Para(arch) "sa5p00m"
103 | set Para(family) "ecp5um"
104 | set Para(Family) "ecp5um"
105 | set Para(design) "vhdl"
106 | set Para(Bin) "[file join $Para(install_dir) bin $os]"
107 | set Para(SpeedGrade) "7"
108 | set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $os]"
109 |
110 | lappend auto_path "[file join $Para(CoreRoot) $Para(CoreIndex) gui]"
111 |
112 | lappend auto_path "[file join $Para(CoreRoot) $Para(CoreIndex) script]"
113 | package require Core_Generate
114 |
115 | lappend auto_path "$Para(install_dir)/tcltk/lib/ipwidgets/ispipbuilder/../runproc"
116 | package require runcmd
117 |
118 |
119 | set Para(result) [GenerateCore]
120 |
--------------------------------------------------------------------------------
/fpga_logic/src/lfsr_scrambler.vhd:
--------------------------------------------------------------------------------
1 | -------------------------------------------------------------------------------
2 | -- Copyright (C) 2009 OutputLogic.com
3 | -- This source file may be used and distributed without restriction
4 | -- provided that this copyright statement is not removed from the file
5 | -- and that any derivative work contains the original copyright notice
6 | -- and the associated disclaimer.
7 | --
8 | -- THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
9 | -- OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10 | -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 | -------------------------------------------------------------------------------
12 | -- scrambler module for data(7:0)
13 | -- lfsr(15:0)=1+x^3+x^4+x^5+x^16;
14 | -------------------------------------------------------------------------------
15 | library ieee;
16 | use ieee.std_logic_1164.all;
17 | use work.analyzer_pkg.all;
18 |
19 | entity lfsr_scrambler is
20 | port (
21 | clk : in std_logic;
22 | rst : in std_logic;
23 | data_in : in std_logic_vector (7 downto 0);
24 | rx_k : in std_logic;
25 | data_out : out std_logic_vector (7 downto 0);
26 | rx_k_out : out std_logic
27 | );
28 | end lfsr_scrambler;
29 |
30 | architecture imp_scrambler of lfsr_scrambler is
31 | signal data_c : std_logic_vector (7 downto 0);
32 | signal lfsr_q : std_logic_vector (15 downto 0);
33 | signal lfsr_c : std_logic_vector (15 downto 0);
34 | signal scram_en : std_logic;
35 | signal scram_rst : std_logic;
36 | begin
37 | lfsr_c(0) <= lfsr_q(8);
38 | lfsr_c(1) <= lfsr_q(9);
39 | lfsr_c(2) <= lfsr_q(10);
40 | lfsr_c(3) <= lfsr_q(8) xor lfsr_q(11);
41 | lfsr_c(4) <= lfsr_q(8) xor lfsr_q(9) xor lfsr_q(12);
42 | lfsr_c(5) <= lfsr_q(8) xor lfsr_q(9) xor lfsr_q(10) xor lfsr_q(13);
43 | lfsr_c(6) <= lfsr_q(9) xor lfsr_q(10) xor lfsr_q(11) xor lfsr_q(14);
44 | lfsr_c(7) <= lfsr_q(10) xor lfsr_q(11) xor lfsr_q(12) xor lfsr_q(15);
45 | lfsr_c(8) <= lfsr_q(0) xor lfsr_q(11) xor lfsr_q(12) xor lfsr_q(13);
46 | lfsr_c(9) <= lfsr_q(1) xor lfsr_q(12) xor lfsr_q(13) xor lfsr_q(14);
47 | lfsr_c(10) <= lfsr_q(2) xor lfsr_q(13) xor lfsr_q(14) xor lfsr_q(15);
48 | lfsr_c(11) <= lfsr_q(3) xor lfsr_q(14) xor lfsr_q(15);
49 | lfsr_c(12) <= lfsr_q(4) xor lfsr_q(15);
50 | lfsr_c(13) <= lfsr_q(5);
51 | lfsr_c(14) <= lfsr_q(6);
52 | lfsr_c(15) <= lfsr_q(7);
53 |
54 | data_c(0) <= data_in(0) xor lfsr_q(15);
55 | data_c(1) <= data_in(1) xor lfsr_q(14);
56 | data_c(2) <= data_in(2) xor lfsr_q(13);
57 | data_c(3) <= data_in(3) xor lfsr_q(12);
58 | data_c(4) <= data_in(4) xor lfsr_q(11);
59 | data_c(5) <= data_in(5) xor lfsr_q(10);
60 | data_c(6) <= data_in(6) xor lfsr_q(9);
61 | data_c(7) <= data_in(7) xor lfsr_q(8);
62 |
63 | scram_rst <= '1' when rx_k = '1' and data_in = K_COM_SYM_28_5 else '0';
64 | scram_en <= '0' when rx_k = '1' and data_in = K_COM_SYM_28_5 else
65 | '0' when rx_k = '1' and data_in = K_PAD_SKP_28_0 else
66 | '1';
67 |
68 | process (clk,rst) begin
69 | if (rst = '1') then
70 | lfsr_q <= b"1111111111111111";
71 | data_out <= b"00000000";
72 | elsif (clk'EVENT and clk = '1') then
73 | rx_k_out <= rx_k;
74 | if (scram_rst = '1') then
75 | lfsr_q <= b"1111111111111111";
76 | elsif (scram_en = '1') then
77 | lfsr_q <= lfsr_c;
78 | end if;
79 |
80 | if (scram_en = '1' and rx_k = '0') then
81 | data_out <= data_c;
82 | else
83 | data_out <= data_in;
84 | end if;
85 | end if;
86 | end process;
87 | end architecture imp_scrambler;
88 |
--------------------------------------------------------------------------------
/fpga_logic/src/cores/extref/generate_ngd.tcl:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/wish
2 |
3 | proc GetPlatform {} {
4 | global tcl_platform
5 |
6 | set cpu $tcl_platform(machine)
7 |
8 | switch $cpu {
9 | intel -
10 | i*86* {
11 | set cpu ix86
12 | }
13 | x86_64 {
14 | if {$tcl_platform(wordSize) == 4} {
15 | set cpu ix86
16 | }
17 | }
18 | }
19 |
20 | switch $tcl_platform(platform) {
21 | windows {
22 | if {$cpu == "amd64"} {
23 | # Do not check wordSize, win32-x64 is an IL32P64 platform.
24 | set cpu x86_64
25 | }
26 | if {$cpu == "x86_64"} {
27 | return "nt64"
28 | } else {
29 | return "nt"
30 | }
31 | }
32 | unix {
33 | if {$tcl_platform(os) == "Linux"} {
34 | if {$cpu == "x86_64"} {
35 | return "lin64"
36 | } else {
37 | return "lin"
38 | }
39 | } else {
40 | return "sol"
41 | }
42 | }
43 | }
44 | return "nt"
45 | }
46 |
47 | set platformpath [GetPlatform]
48 | set Para(sbp_path) [file dirname [info script]]
49 | set Para(install_dir) $env(TOOLRTF)
50 | set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]"
51 | set Para(bin_dir) "[file join $Para(install_dir) bin $platformpath]"
52 |
53 | set Para(ModuleName) "extref"
54 | set Para(Module) "EXTREF"
55 | set Para(libname) ecp5um
56 | set Para(arch_name) sa5p00m
57 | set Para(PartType) "LFE5UM-85F"
58 |
59 | set Para(tech_syn) ecp5um
60 | set Para(tech_cae) ecp5um
61 | set Para(Package) "CABGA381"
62 | set Para(SpeedGrade) "7"
63 | set Para(FMax) "100"
64 | set fdcfile "$Para(sbp_path)/$Para(ModuleName).fdc"
65 |
66 | #create response file(*.cmd) for Synpwrap
67 | proc CreateCmdFile {} {
68 | global Para
69 |
70 | file mkdir "$Para(sbp_path)/syn_results"
71 | if [catch {open $Para(ModuleName).cmd w} rspFile] {
72 | puts "Cannot create response file $Para(ModuleName).cmd."
73 | exit -1
74 | } else {
75 | puts $rspFile "PROJECT: $Para(ModuleName)
76 | working_path: \"$Para(sbp_path)/syn_results\"
77 | module: $Para(ModuleName)
78 | verilog_file_list: \"$Para(sbp_path)/$Para(ModuleName).vhd\"
79 | vlog_std_v2001: true
80 | constraint_file_name: \"$Para(sbp_path)/$Para(ModuleName).fdc\"
81 | suffix_name: edn
82 | output_file_name: $Para(ModuleName)
83 | write_prf: true
84 | disable_io_insertion: true
85 | force_gsr: false
86 | frequency: $Para(FMax)
87 | fanout_limit: 50
88 | retiming: false
89 | pipe: false
90 | part: $Para(PartType)
91 | speed_grade: $Para(SpeedGrade)
92 | "
93 | close $rspFile
94 | }
95 | }
96 |
97 | #synpwrap
98 | CreateCmdFile
99 | set synpwrap "$Para(bin_dir)/synpwrap"
100 | if {[file exists $fdcfile] == 0} {
101 | set Para(result) [catch {eval exec $synpwrap -rem -e $Para(ModuleName) -target $Para(tech_syn)} msg]
102 | } else {
103 | set Para(result) [catch {eval exec $synpwrap -rem -e $Para(ModuleName) -target $Para(tech_syn) -fdc $fdcfile} msg]
104 | }
105 | #puts $msg
106 |
107 | #edif2ngd
108 | set edif2ngd "$Para(FPGAPath)/edif2ngd"
109 | set Para(result) [catch {eval exec $edif2ngd -l $Para(libname) -d $Para(PartType) -nopropwarn \"syn_results/$Para(ModuleName).edn\" $Para(ModuleName).ngo} msg]
110 | #puts $msg
111 |
112 | #ngdbuild
113 | set ngdbuild "$Para(FPGAPath)/ngdbuild"
114 | set Para(result) [catch {eval exec $ngdbuild -addiobuf -dt -a $Para(arch_name) $Para(ModuleName).ngo $Para(ModuleName).ngd} msg]
115 | #puts $msg
116 |
--------------------------------------------------------------------------------
/fpga_logic/src/top_pkg.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- Entity: BP_pkg
3 | -- Date:2016-12-09
4 | -- Author: GRPA
5 | --
6 | -- Description:
7 | --------------------------------------------------------------------------------
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | use ieee.numeric_std.all;
11 | use std.textio.all;
12 |
13 | package top_pkg is
14 |
15 | constant MODUL_NUM_CONST : integer := 32; --! deprecated, not used in new design
16 |
17 | -- debug settings
18 | constant PCIE_RX_DEBUG_ENA : BOOLEAN := FALSE; -- reveal analyzer inserter
19 |
20 | -- SIO commands
21 | constant SET_DATA_4 : std_logic_vector (7 downto 0) := X"24";
22 | constant INIT_ISR : std_logic_vector (7 downto 0) := X"30";
23 |
24 | -- function to calculate FirstDW and LastDW fields
25 | function dw_assign (addr : std_logic_vector(1 downto 0); len : std_logic_vector (6 downto 0)) return std_logic_vector;
26 | -- function to calculate LENGTH field for TLP Header
27 | function len_calc (addr : std_logic_vector (1 downto 0); len : std_logic_vector (6 downto 0)) return std_logic_vector;
28 |
29 | end package;
30 |
31 |
32 | package body top_pkg is
33 |
34 | --------------------------------------------------------------------------------
35 | -- assign dw field
36 | --------------------------------------------------------------------------------
37 | function dw_assign (addr : std_logic_vector(1 downto 0); len : std_logic_vector (6 downto 0)) return std_logic_vector is
38 | variable dw : std_logic_vector (7 downto 0);
39 | variable len_temp : std_logic_vector (6 downto 0);
40 | variable l : std_logic_vector (6 downto 0);
41 | begin
42 | dw := "00000000";
43 | if (unsigned(len)) < 5 then
44 | l := std_logic_vector(unsigned(len) - 1);
45 | else
46 | l := "0000011";
47 | end if;
48 | -- assign first DW
49 | -- is solved with Karnaugh map
50 | dw(0) := (not addr(0)) and (not addr(1));
51 | dw(1) := (addr(0) and (not addr(1))) or (l(0) and (not addr(1))) or (l(1) and (not addr(1)));
52 | dw(2) := ((not addr(0)) and addr(1)) or (l(1) and (not addr(1))) or (l(0) and addr(0) and (not addr(1)));
53 | dw(3) := (l(1) or addr(1)) and (l(0) or addr(0) or addr(1)) and (l(0) or l(1) or addr(0));
54 | -- assign last DW
55 | len_temp := std_logic_vector(unsigned(len) - dw(0) - dw(1) - dw(2) - dw(3));
56 | if (unsigned(len_temp)) > 0 then
57 | case len_temp(1 downto 0) is
58 | when "00" => dw(7 downto 4) := "1111";
59 | when "01" => dw(7 downto 4) := "0001";
60 | when "10" => dw(7 downto 4) := "0011";
61 | when "11" => dw(7 downto 4) := "0111";
62 | when others =>
63 | end case;
64 | end if;
65 | return dw;
66 | end dw_assign;
67 |
68 | --------------------------------------------------------------------------------
69 | -- length field in TLP packet calculate
70 | --------------------------------------------------------------------------------
71 | function len_calc (addr : std_logic_vector (1 downto 0); len : std_logic_vector (6 downto 0)) return std_logic_vector is
72 | variable len_t : std_logic_vector (9 downto 0);
73 | begin
74 | if (unsigned(len)) >= 4 then
75 | -- lenght = (len + addr + 3)/4
76 | len_t := std_logic_vector(unsigned(addr) + ("000"&(unsigned(len)) + 3));
77 | else
78 | len_t := "0000000100";
79 | if (unsigned(len)) = 2 and (unsigned(addr)) = 3 then len_t := "0000001000"; end if;
80 | if (unsigned(len)) = 3 and (unsigned(addr)) > 1 then len_t := "0000001000"; end if;
81 | end if;
82 | return "00" & len_t (9 downto 2);
83 | end len_calc;
84 |
85 | end package body;
86 |
--------------------------------------------------------------------------------
/html/test.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
45 |
46 |
47 |
48 | Cell that spans two columns
49 | To make a cell span more than one column, use the colspan attribute.
50 |
51 |
52 |
53 | | Packet |
54 | R ← |
55 | TLP |
56 |
57 |
58 |
59 | RequesterID |
60 | Tag |
61 | CompleterID |
62 | Status |
63 | BCM |
64 | Byte Cnt |
65 | Lwr Addr |
66 | Data |
67 | LCRC |
68 | Time Delta |
69 | Time |
70 |
71 |
72 | | 142 |
73 | 184 |
74 | 010:01010 |
75 | 1 |
76 | 000:00:0 |
77 | 0 |
78 | 000:00:0 |
79 | SC |
80 | 0 |
81 | 4 |
82 | 0x0C |
83 |
84 | 10 dword
85 | 0xfb000040, 0x00000400, 0x00, 0x54, 0xff, 0x70, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x84, 0x90, 0xc7, 0x6e, 0xfd
86 |
87 |
88 | |
89 | 0xE2C9329D |
90 | 576.000 ns |
91 | 1000 ns |
92 |
93 |
94 |
95 |
96 | | Packet |
97 | R → |
98 | TLP |
99 | Cpl |
100 | CplD |
101 | Length |
102 | RequesterID |
103 | Tag |
104 | CompleterID |
105 | Status |
106 | BCM |
107 | Byte Cnt |
108 | Lwr Addr |
109 | Data |
110 | LCRC |
111 | Time Delta |
112 | Time |
113 |
114 |
115 | | 144 |
116 | 184 |
117 | 010:01010 |
118 | 1 |
119 | 000:00:0 |
120 | 0 |
121 | 000:00:0 |
122 | SC |
123 | 0 |
124 | 4 |
125 | 0x0C |
126 | DATA |
127 | 0xE2C9329D |
128 | 576.000 ns |
129 | 1000 ns |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/fpga_logic/src/cores/pcie/generate_ngd.tcl:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/wish
2 |
3 | set cpu $tcl_platform(machine)
4 |
5 | switch $cpu {
6 | intel -
7 | i*86* {
8 | set cpu ix86
9 | }
10 | x86_64 {
11 | if {$tcl_platform(wordSize) == 4} {
12 | set cpu ix86
13 | }
14 | }
15 | }
16 |
17 | switch $tcl_platform(platform) {
18 | windows {
19 | set Para(os_platform) windows
20 | if {$cpu == "amd64"} {
21 | # Do not check wordSize, win32-x64 is an IL32P64 platform.
22 | set cpu x86_64
23 | }
24 | }
25 | unix {
26 | if {$tcl_platform(os) == "Linux"} {
27 | set Para(os_platform) linux
28 | } else {
29 | set Para(os_platform) unix
30 | }
31 | }
32 | }
33 |
34 | if {$cpu == "x86_64"} {
35 | set NTPATH nt64
36 | set LINPATH lin64
37 | } else {
38 | set NTPATH nt
39 | set LINPATH lin
40 | }
41 |
42 | if {$Para(os_platform) == "linux" } {
43 | set os $LINPATH
44 | } else {
45 | set os $NTPATH
46 | }
47 | set Para(ProjectPath) [file dirname [info script]]
48 | set Para(install_dir) $env(TOOLRTF)
49 | set Para(design) "verilog"
50 | set Para(Bin) "[file join $Para(install_dir) bin $os]"
51 | set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $os]"
52 | lappend auto_path "$Para(install_dir)/tcltk/lib/ipwidgets/ispipbuilder/../runproc"
53 | package require runcmd
54 |
55 | set Para(ModuleName) "pcie"
56 | set Para(Family) "sa5p00m"
57 | set Para(tech) ecp5um
58 | set Para(caelib) ecp5um
59 | set Para(PartType) "LFE5UM-85F"
60 | set Para(PartName) "LFE5UM-85F-7BG381I"
61 | set Para(SpeedGrade) "7"
62 | set retdir [pwd]
63 | cd $Para(ProjectPath)
64 | set synpwrap_cmd "$Para(Bin)/synpwrap"
65 | if {[file exist syn_results]} {
66 | } else {
67 | file mkdir syn_results
68 | }
69 |
70 | if [catch {open $Para(ModuleName).cmd w} rspFile] {
71 | puts stderr "Cannot create response file $Para(ModuleName).cmd: $rspFile"
72 | return -1
73 | } else {
74 | puts $rspFile "PROJECT: $Para(ModuleName)"
75 | puts $rspFile "working_path: \"syn_results\""
76 | puts $rspFile "module: $Para(ModuleName)"
77 | puts $rspFile "vhdl_file_list: \"$Para(install_dir)/cae_library/synthesis/vhdl/$Para(caelib).vhd\""
78 | puts $rspFile "vhdl_file_list: \"../$Para(ModuleName).vhd\""
79 | puts $rspFile "verilog_file_list: \"$Para(install_dir)/cae_library/synthesis/verilog/pmi_def.v\""
80 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_pcs_softlogic.v\""
81 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_pcs.v\""
82 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_sync1s.v\""
83 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_ctc.v\""
84 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_pipe.v\""
85 | puts $rspFile "verilog_file_list: \"../pcie_eval/models/$Para(tech)/$Para(ModuleName)_phy.v\""
86 | puts $rspFile "resource_sharing: false"
87 | puts $rspFile "write_verilog: false"
88 | puts $rspFile "write_vhdl: true"
89 | puts $rspFile "suffix_name: edi"
90 | puts $rspFile "output_file_name: $Para(ModuleName)"
91 | puts $rspFile "write_prf: false"
92 | puts $rspFile "vlog_std_v2001: true"
93 | puts $rspFile "disable_io_insertion: true"
94 | puts $rspFile "force_gsr: false"
95 | puts $rspFile "speed_grade: $Para(SpeedGrade)"
96 | puts $rspFile "frequency: 125.000"
97 | puts $rspFile "fanout_limit: 100"
98 | puts $rspFile "retiming: false"
99 | puts $rspFile "pipe: false"
100 | puts $rspFile "fixgatedclocks: 0"
101 | puts $rspFile "fixgeneratedclocks: 0"
102 | close $rspFile
103 | }
104 |
105 | if [runCmd "\"$synpwrap_cmd\" -rem -e $Para(ModuleName) -target ecp5um"] {
106 | return
107 | } else {
108 | vwait done
109 | if [checkResult $done] {
110 | return
111 | }
112 | }
113 |
114 | if [runCmd "\"$Para(FPGAPath)/edif2ngd\" -l $Para(family) -d $Para(PartType) -nopropwarn \"syn_results/$Para(ModuleName).edi\" \"$Para(ModuleName).ngo\""] {
115 | return
116 | } else {
117 | vwait done
118 | if [checkResult $done] {
119 | return
120 | }
121 | }
122 |
123 | if [runCmd "\"$Para(FPGAPath)/ngdbuild\" -dt -a $Para(family) -d $Para(PartType) -p \"$Para(install_dir)/ispfpga/$Para(Family)/data\" -p \"syn_results\" \"$Para(ModuleName).ngo\" \"$Para(ModuleName).ngd\""] {
124 | return
125 | } else {
126 | vwait done
127 | if [checkResult $done] {
128 | return
129 | }
130 | }
131 |
132 | file delete -force "syn_results"
133 | cd $retdir
134 |
135 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/SAMTEC_TSW-120-05-G-D.kicad_mod:
--------------------------------------------------------------------------------
1 | (module SAMTEC_TSW-120-05-G-D (layer F.Cu) (tedit 611B792E)
2 | (fp_text reference REF** (at 0.905 -5.695) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value SAMTEC_TSW-120-05-G-D (at 11.065 3.135) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_line (start -1.27 1.27) (end -1.27 -3.81) (layer F.Fab) (width 0.1))
9 | (fp_line (start -1.27 -3.81) (end 49.53 -3.81) (layer F.Fab) (width 0.1))
10 | (fp_line (start 49.53 -3.81) (end 49.53 1.27) (layer F.Fab) (width 0.1))
11 | (fp_line (start 49.53 1.27) (end -1.27 1.27) (layer F.Fab) (width 0.1))
12 | (fp_line (start -1.27 1.27) (end -1.27 -3.81) (layer F.SilkS) (width 0.2))
13 | (fp_line (start 49.53 -3.81) (end 49.53 1.27) (layer F.SilkS) (width 0.2))
14 | (fp_line (start 49.53 -3.81) (end -1.27 -3.81) (layer F.SilkS) (width 0.2))
15 | (fp_line (start 49.53 1.27) (end -1.27 1.27) (layer F.SilkS) (width 0.2))
16 | (fp_line (start -1.52 1.52) (end -1.52 -4.06) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start -1.52 -4.06) (end 49.78 -4.06) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start 49.78 -4.06) (end 49.78 1.52) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start 49.78 1.52) (end -1.52 1.52) (layer F.CrtYd) (width 0.05))
20 | (fp_circle (center -1.92 0) (end -1.82 0) (layer F.SilkS) (width 0.2))
21 | (fp_circle (center -1.92 0) (end -1.82 0) (layer F.Fab) (width 0.2))
22 | (pad 1 thru_hole rect (at 0 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
23 | (pad 2 thru_hole circle (at 0 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
24 | (pad 3 thru_hole circle (at 2.54 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
25 | (pad 4 thru_hole circle (at 2.54 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
26 | (pad 5 thru_hole circle (at 5.08 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
27 | (pad 6 thru_hole circle (at 5.08 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
28 | (pad 7 thru_hole circle (at 7.62 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
29 | (pad 8 thru_hole circle (at 7.62 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
30 | (pad 9 thru_hole circle (at 10.16 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
31 | (pad 10 thru_hole circle (at 10.16 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
32 | (pad 11 thru_hole circle (at 12.7 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
33 | (pad 12 thru_hole circle (at 12.7 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
34 | (pad 13 thru_hole circle (at 15.24 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
35 | (pad 14 thru_hole circle (at 15.24 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
36 | (pad 15 thru_hole circle (at 17.78 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
37 | (pad 16 thru_hole circle (at 17.78 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
38 | (pad 17 thru_hole circle (at 20.32 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
39 | (pad 18 thru_hole circle (at 20.32 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
40 | (pad 19 thru_hole circle (at 22.86 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
41 | (pad 20 thru_hole circle (at 22.86 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
42 | (pad 21 thru_hole circle (at 25.4 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
43 | (pad 22 thru_hole circle (at 25.4 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
44 | (pad 23 thru_hole circle (at 27.94 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
45 | (pad 24 thru_hole circle (at 27.94 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
46 | (pad 25 thru_hole circle (at 30.48 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
47 | (pad 26 thru_hole circle (at 30.48 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
48 | (pad 27 thru_hole circle (at 33.02 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
49 | (pad 28 thru_hole circle (at 33.02 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
50 | (pad 29 thru_hole circle (at 35.56 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
51 | (pad 30 thru_hole circle (at 35.56 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
52 | (pad 31 thru_hole circle (at 38.1 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
53 | (pad 32 thru_hole circle (at 38.1 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
54 | (pad 33 thru_hole circle (at 40.64 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
55 | (pad 34 thru_hole circle (at 40.64 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
56 | (pad 35 thru_hole circle (at 43.18 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
57 | (pad 36 thru_hole circle (at 43.18 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
58 | (pad 37 thru_hole circle (at 45.72 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
59 | (pad 38 thru_hole circle (at 45.72 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
60 | (pad 39 thru_hole circle (at 48.26 0) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
61 | (pad 40 thru_hole circle (at 48.26 -2.54) (size 1.37 1.37) (drill 1.02) (layers *.Cu *.Mask))
62 | (model ${KIPRJMOD}/../../common/libs/3dshapes/TSW-120-05-G-D.stp
63 | (offset (xyz 24.13 1.27 0))
64 | (scale (xyz 1 1 1))
65 | (rotate (xyz -90 0 0))
66 | )
67 | )
68 |
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/SAMTEC_SFMC-120-01-L-D.kicad_mod:
--------------------------------------------------------------------------------
1 |
2 | (module SAMTEC_SFMC-120-01-L-D (layer F.Cu) (tedit 6119F446)
3 | (descr "")
4 | (fp_text reference REF** (at 1.345 -4.045 0) (layer F.SilkS)
5 | (effects (font (size 1.0 1.0) (thickness 0.15)))
6 | )
7 | (fp_text value SAMTEC_SFMC-120-01-L-D (at 12.14 2.755 0) (layer F.Fab)
8 | (effects (font (size 1.0 1.0) (thickness 0.15)))
9 | )
10 | (fp_line (start -0.83 0.89) (end -0.83 -2.16) (layer F.Fab) (width 0.1))
11 | (fp_line (start -0.83 -2.16) (end 24.96 -2.16) (layer F.Fab) (width 0.1))
12 | (fp_line (start 24.96 -2.16) (end 24.96 0.89) (layer F.Fab) (width 0.1))
13 | (fp_line (start 24.96 0.89) (end -0.83 0.89) (layer F.Fab) (width 0.1))
14 | (fp_line (start -0.83 0.89) (end -0.83 -2.16) (layer F.Fab) (width 0.1))
15 | (fp_line (start -0.83 -2.16) (end 24.96 -2.16) (layer F.Fab) (width 0.1))
16 | (fp_line (start 24.96 -2.16) (end 24.96 0.89) (layer F.Fab) (width 0.1))
17 | (fp_line (start -0.83 0.89) (end -0.83 -2.16) (layer F.SilkS) (width 0.2))
18 | (fp_line (start 24.96 -2.16) (end 24.96 0.89) (layer F.SilkS) (width 0.2))
19 | (fp_line (start 24.96 -2.16) (end -0.83 -2.16) (layer F.SilkS) (width 0.2))
20 | (fp_line (start 24.96 0.89) (end -0.83 0.89) (layer F.SilkS) (width 0.2))
21 | (fp_line (start -1.08 1.14) (end -1.08 -2.41) (layer F.CrtYd) (width 0.05))
22 | (fp_line (start -1.08 -2.41) (end 25.21 -2.41) (layer F.CrtYd) (width 0.05))
23 | (fp_line (start 25.21 -2.41) (end 25.21 1.14) (layer F.CrtYd) (width 0.05))
24 | (fp_line (start 25.21 1.14) (end -1.08 1.14) (layer F.CrtYd) (width 0.05))
25 | (fp_circle (center -1.48 0.0) (end -1.38 0.0) (layer F.SilkS) (width 0.2))
26 | (fp_circle (center -1.48 0.0) (end -1.38 0.0) (layer F.Fab) (width 0.2))
27 | (pad 01 thru_hole rect (at 0.0 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
28 | (pad 02 thru_hole circle (at 0.0 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
29 | (pad 03 thru_hole circle (at 1.27 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
30 | (pad 04 thru_hole circle (at 1.27 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
31 | (pad 05 thru_hole circle (at 2.54 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
32 | (pad 06 thru_hole circle (at 2.54 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
33 | (pad 07 thru_hole circle (at 3.81 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
34 | (pad 08 thru_hole circle (at 3.81 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
35 | (pad 09 thru_hole circle (at 5.08 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
36 | (pad 10 thru_hole circle (at 5.08 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
37 | (pad 11 thru_hole circle (at 6.35 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
38 | (pad 12 thru_hole circle (at 6.35 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
39 | (pad 13 thru_hole circle (at 7.62 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
40 | (pad 14 thru_hole circle (at 7.62 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
41 | (pad 15 thru_hole circle (at 8.89 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
42 | (pad 16 thru_hole circle (at 8.89 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
43 | (pad 17 thru_hole circle (at 10.16 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
44 | (pad 18 thru_hole circle (at 10.16 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
45 | (pad 19 thru_hole circle (at 11.43 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
46 | (pad 20 thru_hole circle (at 11.43 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
47 | (pad 21 thru_hole circle (at 12.7 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
48 | (pad 22 thru_hole circle (at 12.7 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
49 | (pad 23 thru_hole circle (at 13.97 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
50 | (pad 24 thru_hole circle (at 13.97 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
51 | (pad 25 thru_hole circle (at 15.24 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
52 | (pad 26 thru_hole circle (at 15.24 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
53 | (pad 27 thru_hole circle (at 16.51 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
54 | (pad 28 thru_hole circle (at 16.51 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
55 | (pad 29 thru_hole circle (at 17.78 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
56 | (pad 30 thru_hole circle (at 17.78 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
57 | (pad 31 thru_hole circle (at 19.05 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
58 | (pad 32 thru_hole circle (at 19.05 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
59 | (pad 33 thru_hole circle (at 20.32 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
60 | (pad 34 thru_hole circle (at 20.32 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
61 | (pad 35 thru_hole circle (at 21.59 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
62 | (pad 36 thru_hole circle (at 21.59 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
63 | (pad 37 thru_hole circle (at 22.86 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
64 | (pad 38 thru_hole circle (at 22.86 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
65 | (pad 39 thru_hole circle (at 24.13 0.0) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
66 | (pad 40 thru_hole circle (at 24.13 -1.27) (size 1.06 1.06) (drill 0.71) (layers *.Cu *.Mask))
67 | )
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer.pro:
--------------------------------------------------------------------------------
1 | update=19/08/2021 10:36:03
2 | version=1
3 | last_client=kicad
4 | [general]
5 | version=1
6 | RootSch=
7 | BoardNm=
8 | [cvpcb]
9 | version=1
10 | NetIExt=net
11 | [eeschema]
12 | version=1
13 | LibDir=
14 | [eeschema/libraries]
15 | [schematic_editor]
16 | version=1
17 | PageLayoutDescrFile=
18 | PlotDirectoryName=
19 | SubpartIdSeparator=0
20 | SubpartFirstId=65
21 | NetFmtName=Pcbnew
22 | SpiceAjustPassiveValues=0
23 | LabSize=50
24 | ERC_TestSimilarLabels=1
25 | [pcbnew]
26 | version=1
27 | PageLayoutDescrFile=
28 | LastNetListRead=pcie_analyzer.net
29 | CopperLayerCount=4
30 | BoardThickness=1.6
31 | AllowMicroVias=0
32 | AllowBlindVias=0
33 | RequireCourtyardDefinitions=0
34 | ProhibitOverlappingCourtyards=1
35 | MinTrackWidth=0.09999999999999999
36 | MinViaDiameter=0.4
37 | MinViaDrill=0.2
38 | MinMicroViaDiameter=0.2
39 | MinMicroViaDrill=0.09999999999999999
40 | MinHoleToHole=0.2
41 | TrackWidth1=0.2
42 | TrackWidth2=0.205232
43 | ViaDiameter1=0.4
44 | ViaDrill1=0.2
45 | ViaDiameter2=0.45
46 | ViaDrill2=0.2
47 | dPairWidth1=0.2
48 | dPairGap1=0.25
49 | dPairViaGap1=0.25
50 | dPairWidth2=0.205232
51 | dPairGap2=0.2032
52 | dPairViaGap2=0.2032
53 | SilkLineWidth=0.12
54 | SilkTextSizeV=1
55 | SilkTextSizeH=1
56 | SilkTextSizeThickness=0.15
57 | SilkTextItalic=0
58 | SilkTextUpright=1
59 | CopperLineWidth=0.2
60 | CopperTextSizeV=1.5
61 | CopperTextSizeH=1.5
62 | CopperTextThickness=0.3
63 | CopperTextItalic=0
64 | CopperTextUpright=1
65 | EdgeCutLineWidth=0.05
66 | CourtyardLineWidth=0.05
67 | OthersLineWidth=0.15
68 | OthersTextSizeV=1
69 | OthersTextSizeH=1
70 | OthersTextSizeThickness=0.15
71 | OthersTextItalic=0
72 | OthersTextUpright=1
73 | SolderMaskClearance=0
74 | SolderMaskMinWidth=0
75 | SolderPasteClearance=-0.01
76 | SolderPasteRatio=-0
77 | [pcbnew/Layer.F.Cu]
78 | Name=F.Cu
79 | Type=0
80 | Enabled=1
81 | [pcbnew/Layer.In1.Cu]
82 | Name=In1.Cu
83 | Type=0
84 | Enabled=1
85 | [pcbnew/Layer.In2.Cu]
86 | Name=In2.Cu
87 | Type=0
88 | Enabled=1
89 | [pcbnew/Layer.In3.Cu]
90 | Name=In3.Cu
91 | Type=0
92 | Enabled=0
93 | [pcbnew/Layer.In4.Cu]
94 | Name=In4.Cu
95 | Type=0
96 | Enabled=0
97 | [pcbnew/Layer.In5.Cu]
98 | Name=In5.Cu
99 | Type=0
100 | Enabled=0
101 | [pcbnew/Layer.In6.Cu]
102 | Name=In6.Cu
103 | Type=0
104 | Enabled=0
105 | [pcbnew/Layer.In7.Cu]
106 | Name=In7.Cu
107 | Type=0
108 | Enabled=0
109 | [pcbnew/Layer.In8.Cu]
110 | Name=In8.Cu
111 | Type=0
112 | Enabled=0
113 | [pcbnew/Layer.In9.Cu]
114 | Name=In9.Cu
115 | Type=0
116 | Enabled=0
117 | [pcbnew/Layer.In10.Cu]
118 | Name=In10.Cu
119 | Type=0
120 | Enabled=0
121 | [pcbnew/Layer.In11.Cu]
122 | Name=In11.Cu
123 | Type=0
124 | Enabled=0
125 | [pcbnew/Layer.In12.Cu]
126 | Name=In12.Cu
127 | Type=0
128 | Enabled=0
129 | [pcbnew/Layer.In13.Cu]
130 | Name=In13.Cu
131 | Type=0
132 | Enabled=0
133 | [pcbnew/Layer.In14.Cu]
134 | Name=In14.Cu
135 | Type=0
136 | Enabled=0
137 | [pcbnew/Layer.In15.Cu]
138 | Name=In15.Cu
139 | Type=0
140 | Enabled=0
141 | [pcbnew/Layer.In16.Cu]
142 | Name=In16.Cu
143 | Type=0
144 | Enabled=0
145 | [pcbnew/Layer.In17.Cu]
146 | Name=In17.Cu
147 | Type=0
148 | Enabled=0
149 | [pcbnew/Layer.In18.Cu]
150 | Name=In18.Cu
151 | Type=0
152 | Enabled=0
153 | [pcbnew/Layer.In19.Cu]
154 | Name=In19.Cu
155 | Type=0
156 | Enabled=0
157 | [pcbnew/Layer.In20.Cu]
158 | Name=In20.Cu
159 | Type=0
160 | Enabled=0
161 | [pcbnew/Layer.In21.Cu]
162 | Name=In21.Cu
163 | Type=0
164 | Enabled=0
165 | [pcbnew/Layer.In22.Cu]
166 | Name=In22.Cu
167 | Type=0
168 | Enabled=0
169 | [pcbnew/Layer.In23.Cu]
170 | Name=In23.Cu
171 | Type=0
172 | Enabled=0
173 | [pcbnew/Layer.In24.Cu]
174 | Name=In24.Cu
175 | Type=0
176 | Enabled=0
177 | [pcbnew/Layer.In25.Cu]
178 | Name=In25.Cu
179 | Type=0
180 | Enabled=0
181 | [pcbnew/Layer.In26.Cu]
182 | Name=In26.Cu
183 | Type=0
184 | Enabled=0
185 | [pcbnew/Layer.In27.Cu]
186 | Name=In27.Cu
187 | Type=0
188 | Enabled=0
189 | [pcbnew/Layer.In28.Cu]
190 | Name=In28.Cu
191 | Type=0
192 | Enabled=0
193 | [pcbnew/Layer.In29.Cu]
194 | Name=In29.Cu
195 | Type=0
196 | Enabled=0
197 | [pcbnew/Layer.In30.Cu]
198 | Name=In30.Cu
199 | Type=0
200 | Enabled=0
201 | [pcbnew/Layer.B.Cu]
202 | Name=B.Cu
203 | Type=0
204 | Enabled=1
205 | [pcbnew/Layer.B.Adhes]
206 | Enabled=1
207 | [pcbnew/Layer.F.Adhes]
208 | Enabled=1
209 | [pcbnew/Layer.B.Paste]
210 | Enabled=1
211 | [pcbnew/Layer.F.Paste]
212 | Enabled=1
213 | [pcbnew/Layer.B.SilkS]
214 | Enabled=1
215 | [pcbnew/Layer.F.SilkS]
216 | Enabled=1
217 | [pcbnew/Layer.B.Mask]
218 | Enabled=1
219 | [pcbnew/Layer.F.Mask]
220 | Enabled=1
221 | [pcbnew/Layer.Dwgs.User]
222 | Enabled=1
223 | [pcbnew/Layer.Cmts.User]
224 | Enabled=1
225 | [pcbnew/Layer.Eco1.User]
226 | Enabled=1
227 | [pcbnew/Layer.Eco2.User]
228 | Enabled=1
229 | [pcbnew/Layer.Edge.Cuts]
230 | Enabled=1
231 | [pcbnew/Layer.Margin]
232 | Enabled=1
233 | [pcbnew/Layer.B.CrtYd]
234 | Enabled=1
235 | [pcbnew/Layer.F.CrtYd]
236 | Enabled=1
237 | [pcbnew/Layer.B.Fab]
238 | Enabled=1
239 | [pcbnew/Layer.F.Fab]
240 | Enabled=1
241 | [pcbnew/Layer.Rescue]
242 | Enabled=0
243 | [pcbnew/Netclasses]
244 | [pcbnew/Netclasses/Default]
245 | Name=Default
246 | Clearance=0.2032
247 | TrackWidth=0.2
248 | ViaDiameter=0.4
249 | ViaDrill=0.2
250 | uViaDiameter=0.3
251 | uViaDrill=0.1
252 | dPairWidth=0.2
253 | dPairGap=0.25
254 | dPairViaGap=0.25
255 | [pcbnew/Netclasses/1]
256 | Name=Diff
257 | Clearance=0.2032
258 | TrackWidth=0.205232
259 | ViaDiameter=0.6
260 | ViaDrill=0.2
261 | uViaDiameter=0.3
262 | uViaDrill=0.1
263 | dPairWidth=0.2
264 | dPairGap=0.25
265 | dPairViaGap=0.25
266 | [pcbnew/Netclasses/2]
267 | Name=Single endet 50
268 | Clearance=0.3
269 | TrackWidth=0.29337
270 | ViaDiameter=0.6
271 | ViaDrill=0.2
272 | uViaDiameter=0.3
273 | uViaDrill=0.1
274 | dPairWidth=0.2
275 | dPairGap=0.25
276 | dPairViaGap=0.25
277 |
--------------------------------------------------------------------------------
/fpga_logic/sim/vunit/run.py:
--------------------------------------------------------------------------------
1 |
2 | """
3 | """
4 | import os
5 |
6 | from pathlib import Path
7 | from vunit import VUnit, VUnitCLI
8 | from vunit.sim_if import activehdl
9 |
10 | VU = VUnit.from_argv()
11 | VU.add_osvvm()
12 | VU.add_verification_components()
13 |
14 |
15 | SRC_PATH = Path(__file__).parents[2]
16 |
17 | print (os.environ['VUNIT_SIMULATOR'])
18 | if (os.environ['VUNIT_SIMULATOR'] == "activehdl"):
19 | print("Simulate with ActiveHDL")
20 | VU.add_external_library("ecp5u","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\vhdl\\ecp5u")
21 | VU.add_external_library("ecp5um","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\vhdl\\ecp5u")
22 | VU.add_external_library("machxo3l","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\vhdl\\machxo3l")
23 | VU.add_external_library("ovi_ecp5u","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\verilog\\ovi_ecp5u")
24 | VU.add_external_library("pmi_work","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\verilog\\pmi_work")
25 | VU.add_external_library("aldec","C:\\Aldec\\Active-HDL-11.1\\vlib\\aldec")
26 | VU.add_external_library("pcsd_aldec_work","C:\\Aldec\\Active-HDL-11.1\\vlib\\lattice\\verilog\\pcsd_aldec_work")
27 |
28 | #add pcie core
29 | VU.add_library("sim_core")
30 | VU.library("sim_core").add_source_file(SRC_PATH / "sim_core" / "ip_cores " / "pcie" / "pcie.vhd")
31 |
32 | #add extref
33 | #VU.library("sim_core").add_source_files(SRC_PATH / "sim_core" / "ip_cores" / "extref" / "*.vhd")
34 |
35 | #add project library
36 | VU.library("sim_core").add_source_files(SRC_PATH / "SRC" / "*.vhd")
37 |
38 |
39 | #add simulation
40 | VU.library("sim_core").add_source_files(SRC_PATH / "sim" / "VUnit" / "*.vhd")
41 |
42 |
43 | VU.add_library("pcie_core")
44 | '''
45 | VU.library("pcie_core").add_source_file(SRC_PATH / "sim_core" / "ip_cores " / "pcie" / "pcie_eval" / "pcie" /"src"/"top"/"pcie_beh.v")
46 | '''
47 | VU.library("pcie_core").add_source_file(SRC_PATH / "sim" / "vunit" / "dummy.v")
48 |
49 | VU.set_compile_option("activehdl.vcom_flags", ['-2008'])
50 |
51 |
52 | VU.set_compile_option("activehdl.vlog_flags", ['-v2k5', '-dbg', '+define+RSL_SIM_MODE', '+define+SIM_MODE', '+define+USERNAME_EVAL_TOP=pcie_eval_top',
53 | '+define+DEBUG=0', '+define+SIMULATE', '+define+VHDL_SIM','+define+mixed_hdl',
54 | '+incdir+../../sim_core/ip_cores/pcie/pcie_eval/pcie/testbench/top',
55 | '+incdir+../../sim_core/ip_cores/pcie/pcie_eval/pcie/testbench/tests',
56 | '+incdir+../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um',
57 | '+incdir+../../sim_core/ip_cores/pcie/pcie_eval/pcie/src/params',
58 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/src/params/pci_exp_params.v',
59 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/testbench/top/eval_pcie.v',
60 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/testbench/top/eval_tbtx.v',
61 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/testbench/top/eval_tbrx.v',
62 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_ctc.v',
63 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_sync1s.v',
64 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_pipe.v',
65 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_extref.v',
66 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_pcs_softlogic.v',
67 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_pcs.v',
68 | '../../sim_core/ip_cores/pcie/pcie_eval/models/ecp5um/pcie_phy.v',
69 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/src/top/pcie_core.v',
70 | '../../sim_core/ip_cores/pcie/pcie_eval/pcie/src/top/pcie_beh.v' ])
71 | VU.set_sim_option("activehdl.vsim_flags",["+access +w_nets", "+access +r","-ieee_nowarn","-t 1ps",
72 | "-L pcie_core","-L pmi_work","-L ovi_ecp5u",
73 | "-L pcsd_aldec_work","-L ecp5um", "-L sim_core"])#, "; do -do ../../v_MEM.do"])
74 |
75 | if (os.environ['VUNIT_SIMULATOR'] == "modelsim"):
76 | # Sim only spi
77 | print("Simulate with Modelsim")
78 |
79 | VU.add_library("sim_core")
80 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "controller.vhd")
81 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "analyzer_pkg.vhd")
82 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "analyzer.vhd")
83 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "pdpram.vhd")
84 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "packet_ram.vhd")
85 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "spi_slave.vhd")
86 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "pci_wrapper_pkg.vhd")
87 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "pcie_tx_engine.vhd")
88 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "pcie_rx_engine.vhd")
89 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "top_pkg.vhd")
90 | VU.library("sim_core").add_source_file(SRC_PATH / "src" / "rev_analyzer.vhd")
91 | #VU.library("sim_core").add_source_file(SRC_PATH / "src" / "top.vhd")
92 | VU.library("sim_core").add_source_file(SRC_PATH / "sim" / "vunit" / "analyzer_tb_pkg.vhd")
93 | VU.library("sim_core").add_source_file(SRC_PATH / "sim" / "vunit" / "spi_controller_tb.vhd")
94 |
95 | VU.set_sim_option("modelsim.vsim_flags",["+nowarnDECAY"])
96 | VU.set_sim_option("modelsim.init_file.gui","wave.do")
97 |
98 | VU.main()
99 |
--------------------------------------------------------------------------------
/fpga_logic/src/analyzer.lpf:
--------------------------------------------------------------------------------
1 | RVL_ALIAS "clk_25_in" "clk_25_in";
2 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
3 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
4 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
5 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
6 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
7 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
8 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
9 | RVL_ALIAS "reveal_ist_71" "pcs1_generate/pcs_inst_1/rx_pclk_c";
10 | RVL_ALIAS "clk_100" "clk_100_mhz_pll/clkop";
11 | RVL_ALIAS "clk_100" "clk_100_mhz_pll/clkop";
12 | RVL_ALIAS "clk_100" "clk_100_mhz_pll/clkop";
13 | RVL_ALIAS "clk_100" "clk_100_mhz_pll/clkop";
14 | RVL_ALIAS "clk_100" "clk_100_mhz_pll/clkop";
15 | RVL_ALIAS "clk_100" "rev_analyzer_inst/clk";
16 | RVL_ALIAS "rx_pclk_1" "pcs1_generate/analyzer_down_inst/clk";
17 | RVL_ALIAS "clk_100" "clk_100";
18 | RVL_ALIAS "clk_100" "clk_100";
19 | BLOCK RESETPATHS ;
20 | BLOCK ASYNCPATHS ;
21 | IOBUF PORT "los[0]" IO_TYPE=LVTTL33 ;
22 | IOBUF PORT "los[1]" IO_TYPE=LVTTL33 ;
23 | IOBUF PORT "los[2]" IO_TYPE=LVTTL33 ;
24 | IOBUF PORT "data_out_o[0]" IO_TYPE=LVTTL33 ;
25 | IOBUF PORT "data_out_o[1]" IO_TYPE=LVTTL33 ;
26 | IOBUF PORT "data_out_o[2]" IO_TYPE=LVTTL33 ;
27 | IOBUF PORT "data_out_o[3]" IO_TYPE=LVTTL33 ;
28 | IOBUF PORT "data_out_o[4]" IO_TYPE=LVTTL33 ;
29 | IOBUF PORT "data_out_o[5]" IO_TYPE=LVTTL33 ;
30 | IOBUF PORT "data_out_o[6]" IO_TYPE=LVTTL33 ;
31 | IOBUF PORT "data_out_o[7]" IO_TYPE=LVTTL33 ;
32 | IOBUF PORT "data_out_o[8]" IO_TYPE=LVTTL33 ;
33 | IOBUF PORT "data_out_o[9]" IO_TYPE=LVTTL33 ;
34 | IOBUF PORT "data_out_o[10]" IO_TYPE=LVTTL33 ;
35 | IOBUF PORT "data_out_o[11]" IO_TYPE=LVTTL33 ;
36 | IOBUF PORT "data_out_o[12]" IO_TYPE=LVTTL33 ;
37 | IOBUF PORT "data_out_o[13]" IO_TYPE=LVTTL33 ;
38 | IOBUF PORT "data_out_o[14]" IO_TYPE=LVTTL33 ;
39 | IOBUF PORT "data_out_o[15]" IO_TYPE=LVTTL33 ;
40 | IOBUF PORT "data_out_o[16]" IO_TYPE=LVTTL33 ;
41 | IOBUF PORT "data_out_o[17]" IO_TYPE=LVTTL33 ;
42 | IOBUF PORT "data_out_o[18]" IO_TYPE=LVTTL33 ;
43 | IOBUF PORT "data_out_o[19]" IO_TYPE=LVTTL33 ;
44 | IOBUF PORT "data_out_o[20]" IO_TYPE=LVTTL33 ;
45 | IOBUF PORT "data_out_o[21]" IO_TYPE=LVTTL33 ;
46 | IOBUF PORT "data_out_o[22]" IO_TYPE=LVTTL33 ;
47 | IOBUF PORT "data_out_o[23]" IO_TYPE=LVTTL33 ;
48 | IOBUF PORT "data_out_o[24]" IO_TYPE=LVTTL33 ;
49 | IOBUF PORT "data_out_o[25]" IO_TYPE=LVTTL33 ;
50 | IOBUF PORT "data_out_o[26]" IO_TYPE=LVTTL33 ;
51 | IOBUF PORT "data_out_o[27]" IO_TYPE=LVTTL33 ;
52 | IOBUF PORT "data_out_o[28]" IO_TYPE=LVTTL33 ;
53 | IOBUF PORT "data_out_o[29]" IO_TYPE=LVTTL33 ;
54 | IOBUF PORT "data_out_o[30]" IO_TYPE=LVTTL33 ;
55 | IOBUF PORT "data_out_o[31]" IO_TYPE=LVTTL33 ;
56 | IOBUF PORT "disable1" IO_TYPE=LVTTL33 ;
57 | IOBUF PORT "disable2" IO_TYPE=LVTTL33 ;
58 | IOBUF PORT "disable3" IO_TYPE=LVTTL33 ;
59 | IOBUF PORT "led[0]" IO_TYPE=LVTTL33 ;
60 | IOBUF PORT "led[1]" IO_TYPE=LVTTL33 ;
61 | IOBUF PORT "led[2]" IO_TYPE=LVTTL33 ;
62 | IOBUF PORT "miso" IO_TYPE=LVTTL33 ;
63 | IOBUF PORT "led[3]" IO_TYPE=LVTTL33 PULLMODE=NONE ;
64 | IOBUF PORT "led[4]" IO_TYPE=LVTTL33 PULLMODE=NONE ;
65 | IOBUF PORT "led[5]" IO_TYPE=LVTTL33 PULLMODE=NONE ;
66 | IOBUF PORT "led[6]" IO_TYPE=LVTTL33 PULLMODE=NONE ;
67 | IOBUF PORT "led[7]" IO_TYPE=LVTTL33 PULLMODE=NONE ;
68 | LOCATE COMP "gsrn" SITE "P4" ;
69 | BLOCK JTAGPATHS ;
70 | FREQUENCY NET "rx_pclk_1" 250.000000 MHz ;
71 | FREQUENCY NET "clk_100" 100.000000 MHz ;
72 | IOBUF PORT "gsrn" IO_TYPE=LVTTL33 ;
73 | IOBUF PORT "switch[0]" IO_TYPE=LVTTL33 ;
74 | IOBUF PORT "switch[1]" IO_TYPE=LVTTL33 ;
75 | IOBUF PORT "switch[2]" IO_TYPE=LVTTL33 ;
76 | LOCATE COMP "switch[7]" SITE "A16" ;
77 | LOCATE COMP "led[0]" SITE "A13" ;
78 | LOCATE COMP "led[1]" SITE "A12" ;
79 | LOCATE COMP "led[2]" SITE "B19" ;
80 | LOCATE COMP "led[3]" SITE "A18" ;
81 | LOCATE COMP "led[4]" SITE "B18" ;
82 | LOCATE COMP "led[5]" SITE "C17" ;
83 | LOCATE COMP "led[6]" SITE "A17" ;
84 | LOCATE COMP "led[7]" SITE "B17" ;
85 | LOCATE COMP "switch[0]" SITE "J1" ;
86 | LOCATE COMP "switch[1]" SITE "H1" ;
87 | LOCATE COMP "switch[2]" SITE "K1" ;
88 | LOCATE COMP "disable1" SITE "B15" ;
89 | LOCATE COMP "disable2" SITE "D11" ;
90 | LOCATE COMP "disable3" SITE "D12" ;
91 | LOCATE COMP "los[0]" SITE "B13" ;
92 | LOCATE COMP "los[1]" SITE "B12" ;
93 | LOCATE COMP "los[2]" SITE "C13" ;
94 | LOCATE COMP "clk_25_in" SITE "B11" ;
95 | LOCATE COMP "clk_25_en" SITE "C11" ;
96 | IOBUF PORT "switch[7]" IO_TYPE=LVTTL33 ;
97 | IOBUF PORT "clk_25_in_c" IO_TYPE=LVTTL33 ;
98 | IOBUF PORT "clk_25_en" IO_TYPE=LVTTL33 ;
99 | LOCATE COMP "switch[3]" SITE "E15" ;
100 | IOBUF PORT "switch[3]" IO_TYPE=LVCMOS25 ;
101 | IOBUF PORT "data_out_i[0]" IO_TYPE=LVTTL33 ;
102 | IOBUF PORT "data_out_i[1]" IO_TYPE=LVTTL33 ;
103 | IOBUF PORT "data_out_i[2]" IO_TYPE=LVTTL33 ;
104 | IOBUF PORT "data_out_i[3]" IO_TYPE=LVTTL33 ;
105 | IOBUF PORT "data_out_i[4]" IO_TYPE=LVTTL33 ;
106 | IOBUF PORT "data_out_i[5]" IO_TYPE=LVTTL33 ;
107 | IOBUF PORT "data_out_i[6]" IO_TYPE=LVTTL33 ;
108 | IOBUF PORT "data_out_i[7]" IO_TYPE=LVTTL33 ;
109 | IOBUF PORT "data_out_i[8]" IO_TYPE=LVTTL33 ;
110 | IOBUF PORT "data_out_i[9]" IO_TYPE=LVTTL33 ;
111 | IOBUF PORT "data_out_i[10]" IO_TYPE=LVTTL33 ;
112 | IOBUF PORT "data_out_i[11]" IO_TYPE=LVTTL33 ;
113 | IOBUF PORT "data_out_i[12]" IO_TYPE=LVTTL33 ;
114 | IOBUF PORT "data_out_i[13]" IO_TYPE=LVTTL33 ;
115 | IOBUF PORT "data_out_i[14]" IO_TYPE=LVTTL33 ;
116 | IOBUF PORT "data_out_i[15]" IO_TYPE=LVTTL33 ;
117 | IOBUF PORT "data_out_i[16]" IO_TYPE=LVTTL33 ;
118 | IOBUF PORT "data_out_i[17]" IO_TYPE=LVTTL33 ;
119 | IOBUF PORT "data_out_i[18]" IO_TYPE=LVTTL33 ;
120 | IOBUF PORT "data_out_i[19]" IO_TYPE=LVTTL33 ;
121 | IOBUF PORT "data_out_i[20]" IO_TYPE=LVTTL33 ;
122 | IOBUF PORT "data_out_i[21]" IO_TYPE=LVTTL33 ;
123 | IOBUF PORT "data_out_i[22]" IO_TYPE=LVTTL33 ;
124 | IOBUF PORT "data_out_i[23]" IO_TYPE=LVTTL33 ;
125 | IOBUF PORT "data_out_i[24]" IO_TYPE=LVTTL33 ;
126 | IOBUF PORT "data_out_i[25]" IO_TYPE=LVTTL33 ;
127 | IOBUF PORT "data_out_i[26]" IO_TYPE=LVTTL33 ;
128 | IOBUF PORT "data_out_i[27]" IO_TYPE=LVTTL33 ;
129 | IOBUF PORT "data_out_i[28]" IO_TYPE=LVTTL33 ;
130 | IOBUF PORT "data_out_i[29]" IO_TYPE=LVTTL33 ;
131 | IOBUF PORT "data_out_i[30]" IO_TYPE=LVTTL33 ;
132 | IOBUF PORT "data_out_i[31]" IO_TYPE=LVTTL33 ;
133 | IOBUF PORT "timestamp[1]" IO_TYPE=LVTTL33 ;
134 | IOBUF PORT "timestamp[0]" IO_TYPE=LVTTL33 ;
135 | LOCATE COMP "mosi" SITE "U20" ;
136 | LOCATE COMP "sclk" SITE "R20" ;
137 | LOCATE COMP "cs_n" SITE "U19" ;
138 | LOCATE COMP "miso" SITE "T19" ;
139 | FREQUENCY NET "clk_25_in_c" 25.000000 MHz ;
140 | LOCATE COMP "uart_tx" SITE "N20" ;
141 | LOCATE COMP "uart_rx" SITE "P18" ;
142 | IOBUF PORT "uart_tx" IO_TYPE=LVTTL33 PULLMODE=NONE ;
143 | IOBUF PORT "uart_rx" IO_TYPE=LVTTL33 PULLMODE=NONE ;
144 |
--------------------------------------------------------------------------------
/py_script/analyzer.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | import timeit
4 | if (os.name == "posix"):
5 | from spidev import SpiDev
6 |
7 | # Print iterations progress
8 |
9 |
10 | def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd="\r"):
11 | '''
12 | Call in a loop to create terminal progress bar
13 | @params:
14 | iteration - Required : current iteration (Int)
15 | total - Required : total iterations (Int)
16 | prefix - Optional : prefix string (Str)
17 | suffix - Optional : suffix string (Str)
18 | decimals - Optional : positive number of decimals in percent complete (Int)
19 | length - Optional : character length of bar (Int)
20 | fill - Optional : bar fill character (Str)
21 | printEnd - Optional : end character (e.g. "\r", "\r\n") (Str)
22 | '''
23 | percent = ("{0:." + str(decimals) + "f}").format(100 *
24 | (iteration / float(total)))
25 | filledLength = int(length * iteration // total)
26 | bar = fill * filledLength + '-' * (length - filledLength)
27 | print(f'\r{prefix} |{bar}| {percent}% {suffix}', end=printEnd)
28 | # Print New Line on Complete
29 | if iteration == total:
30 | print()
31 |
32 |
33 | def writePacket(file, msg, direction):
34 | flag = int(msg[len(byteArray)-1])
35 | data = []
36 | if (len(msg) == 33):
37 | for i in range(8):
38 | if (flag >> i & 1):
39 | timestamp = 0
40 | # data = []
41 | for j in range(4):
42 | timestamp = timestamp + (msg[i*4+j])*(256**(3-j))
43 | timestamp = timestamp * 4
44 | f.write('\n')
45 | f.write(direction)
46 | f.write(str(timestamp))
47 | f.write(', ns')
48 | else:
49 | for j in range(4):
50 | f.write(", 0x")
51 | f.write(hex(msg[i*4+j])[2:].zfill(2))
52 | # data.append(msg[i*4+j])
53 |
54 |
55 | def parseMem(testfile):
56 | byteArray = []
57 | flags = 0
58 | for linesIter in range(8):
59 | # read line from stim file
60 | testline = testfile.readline()
61 | if (len(testline) == 0):
62 | break
63 | # flag indicates timestamp
64 | flags = flags + int(testline[0])*(2**linesIter)
65 | for byteIter in range(4):
66 | byte = 0
67 | # get byte end
68 | endByte = 35 - (3 - byteIter) * 9
69 | for bitIter in range(8):
70 | byte = byte + int(testline[(endByte-bitIter)])*(2**bitIter)
71 | byteArray.append(byte)
72 | byteArray.append(flags)
73 | msg = byteArray
74 | """
75 | for i in range(len(msg)):
76 | print(hex(msg[i]), end =" ")
77 | print()
78 | """
79 | return msg
80 |
81 |
82 | def read_packets(spi, mem_num, address):
83 | msg = [0x03]
84 | msg.append(mem_num)
85 | first_b = address.to_bytes(2, 'big')
86 | msg.append(int(first_b[0]))
87 | # msg.append(0)
88 | msg.append(int(first_b[1]))
89 | # msg.append(address)
90 | spi.writebytes(msg)
91 | answer = spi.readbytes(33)
92 | '''
93 | for i in range (len(msg)):
94 | print(hex(msg[i])[2:].zfill(2),end=" ")
95 | print(": ", end =" ")
96 | for i in range (len(answer)):
97 | print(hex(answer[i])[2:].zfill(2), end=" ")
98 | print()
99 | '''
100 | return answer
101 |
102 | # *********************************************************************************
103 | # MAIN
104 | # *********************************************************************************
105 |
106 |
107 | mode = sys.argv
108 | print(mode)
109 |
110 | start = timeit.default_timer()
111 | if os.path.exists("out.csv"):
112 | os.remove("out.csv")
113 | print("file removed")
114 |
115 | f = open("out.csv", "a")
116 |
117 | lineBytes = []
118 |
119 | if (os.name == "nt"):
120 | testfile = open("up_memory.mem", "r")
121 | testfile1 = open("down_memory.mem", "r")
122 | testfile3 = open("read_stim_out.txt", "r")
123 | testfile_out = open("decoded_str.txt", "w")
124 | testread_out = open("readboard.txt", "w")
125 |
126 | if (os.name == "posix"):
127 | spi = SpiDev()
128 | spi.open(0, 0)
129 | spi.max_speed_hz = 1000000
130 | spi.mode = 1
131 | testread_out = open("readboard.txt", "w")
132 |
133 | byte = 0
134 | byteArray = []
135 | packet = {}
136 |
137 | flags = 0
138 | lineCounter = 0
139 | addr = 0
140 | # printProgressBar(0, 2048, prefix = 'Progress:', suffix = 'Complete', length = 50)
141 |
142 | msg = []
143 | for lines in range(2048):
144 | # printProgressBar(lines + 1, 2048, prefix = 'Progress line up: ', suffix = 'Complete', length = 50)
145 | if (os.name == "nt"):
146 | if (mode[1] == "in"):
147 | msg = parseMem(testfile)
148 | # for i in range(33):
149 | # testfile_out.write("0x")
150 | # testfile_out.write(hex(msg[i])[2:].zfill(2) )
151 | # testfile_out.write(" ")
152 | # testfile_out.write("\n")
153 | if (mode[1] == "out"):
154 | testline = testfile3.readline()
155 | enc_string = testline.split()
156 | for i in range(len(enc_string)):
157 | msg.append(int(enc_string[i], base=16))
158 | writePacket(f, msg, "->, ")
159 | msg = []
160 |
161 | if (os.name == "posix"):
162 | msg = read_packets(spi, 0, addr)
163 | writePacket(f, msg, "->, ")
164 |
165 | # testread_out.write(hex(addr)[2:].zfill(4))
166 | # testread_out.write(" ")
167 | for i in range(len(msg)):
168 | testread_out.write("0x")
169 | testread_out.write(hex(msg[i])[2:].zfill(2))
170 | testread_out.write(" ")
171 | testread_out.write("\n")
172 | addr = addr + 32
173 |
174 | addr = 0
175 | # printProgressBar(0, 2048, prefix = 'Progress:', suffix = 'Complete', length = 50)
176 | for lines in range(2048):
177 | # printProgressBar(lines + 1, 2048, prefix = 'Progress line down: ', suffix = 'Complete', length = 50)
178 | if (os.name == "nt"):
179 | if (mode[1] == "in"):
180 | msg = parseMem(testfile1)
181 |
182 | # msg = parseMem(testfile1)
183 | writePacket(f, msg, "<-, ")
184 | msg = []
185 | if (os.name == "posix"):
186 | msg = read_packets(spi, 1, addr)
187 | writePacket(f, msg, "<-, ")
188 | for i in range(len(msg)):
189 | testread_out.write("0x")
190 | testread_out.write(hex(msg[i])[2:].zfill(2))
191 | testread_out.write(" ")
192 | testread_out.write("\n")
193 | addr = addr + 32
194 |
195 | stop = timeit.default_timer()
196 | print('Time: ', stop - start, 's')
197 |
--------------------------------------------------------------------------------
/fpga_logic/src/pci_wrapper_pkg.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- Entity: pci_wrapper_pkg
3 | -- Date:2016-06-03
4 | -- Author: grpa
5 | --
6 | -- Description:
7 | --------------------------------------------------------------------------------
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 |
11 | package pci_wrapper_pkg is
12 |
13 | --! TLP Header types
14 | constant RX_MEM_RD_FMT_TYPE : std_logic_vector(6 downto 0) := "0000000";
15 | constant RX_MEM_WR_FMT_TYPE : std_logic_vector(6 downto 0) := "1000000";
16 | constant RX_CPLD_FMT_TYPE : std_logic_vector(6 downto 0) := "1001010";
17 | constant RX_CFG_WR_FMT_TYPE : std_logic_vector(6 downto 0) := "1000100";
18 | constant RX_CFG_RD_FMT_TYPE : std_logic_vector(6 downto 0) := "0000100";
19 | constant RX_CPL_FMT_TYPE : std_logic_vector(6 downto 0) := "0001010";
20 | constant TX_MSG_RQ_FMT_TYPE : std_logic_vector(6 downto 0) := "0110100";
21 | constant RX_RESP_PTM_TYPE : std_logic_vector(6 downto 0) := "1110000";
22 | --! These bits encoded by the completer to indicate success in fulfilling the request
23 | constant SUCCESSFUL_CMPL : std_logic_vector (2 downto 0) := "000"; --! Successful Completion (SC)
24 | constant UNSUPPRTD_RQ : std_logic_vector (2 downto 0) := "001"; --! Unsupported Request (UR)
25 | constant CONF_REQ_RS : std_logic_vector (2 downto 0) := "010"; --! Config Req Retry Status (CR S)
26 | constant COMPLETER_ABORT : std_logic_vector (2 downto 0) := "100"; --! Completer abort. (CA)
27 |
28 | type t_tx_tlp_intf_d is record
29 | tx_data_vc0 : std_logic_vector(15 downto 0);
30 | tx_req_vc0 : std_logic;
31 | tx_st_vc0 : std_logic;
32 | tx_end_vc0 : std_logic;
33 | tx_nlfy_vc0 : std_logic;
34 | end record;
35 |
36 | type t_tx_tlp_intf_q is record
37 | tx_rdy_vc0 : std_logic;
38 | tx_ca_ph_vc0 : std_logic_vector (8 downto 0);
39 | tx_ca_nph_vc0 : std_logic_vector (8 downto 0);
40 | tx_ca_cplh_vc0 : std_logic_vector (8 downto 0);
41 | tx_ca_pd_vc0 : std_logic_vector(12 downto 0);
42 | tx_ca_npd_vc0 : std_logic_vector(12 downto 0);
43 | tx_ca_cpld_vc0 : std_logic_vector(12 downto 0);
44 | tx_ca_p_recheck_vc0 : std_logic;
45 | tx_ca_cpl_recheck_vc0 : std_logic;
46 | end record;
47 |
48 | type t_rx_tlp_intf_d is record
49 | ur_np_ext : std_logic;
50 | ur_p_ext : std_logic;
51 | ph_buf_status_vc0 : std_logic;
52 | pd_buf_status_vc0 : std_logic;
53 | nph_buf_status_vc0 : std_logic;
54 | npd_buf_status_vc0 : std_logic;
55 | ph_processed_vc0 : std_logic;
56 | nph_processed_vc0 : std_logic;
57 | pd_processed_vc0 : std_logic;
58 | npd_processed_vc0 : std_logic;
59 | pd_num_vc0 : std_logic_vector(7 downto 0);
60 | npd_num_vc0 : std_logic_vector(7 downto 0);
61 | end record;
62 |
63 | type t_rx_tlp_intf_q is record
64 | rx_data_vc0 : std_logic_vector(15 downto 0);
65 | rx_st_vc0 : std_logic;
66 | rx_end_vc0 : std_logic;
67 | rx_us_req_vc0 : std_logic;
68 | rx_malf_tlp_vc0 : std_logic;
69 | rx_bar_hit : std_logic_vector(6 downto 0);
70 | end record;
71 |
72 | type t_phy_layer_d is record
73 | no_pcie_train : std_logic;
74 | force_lsm_active : std_logic;
75 | force_rec_ei : std_logic;
76 | force_phy_status : std_logic;
77 | force_disable_scr : std_logic;
78 | hl_snd_beacon : std_logic;
79 | hl_disable_scr : std_logic;
80 | hl_gto_dis : std_logic;
81 | hl_gto_det : std_logic;
82 | hl_gto_hrst : std_logic;
83 | hl_gto_l0stx : std_logic;
84 | hl_gto_l0stxfts : std_logic;
85 | hl_gto_l1 : std_logic;
86 | hl_gto_l2 : std_logic;
87 | hl_gto_lbk : std_logic;
88 | hl_gto_rcvry : std_logic;
89 | hl_gto_cfg : std_logic;
90 | tx_lbk_kcntl : std_logic_vector(1 downto 0);
91 | tx_lbk_data : std_logic_vector(15 downto 0);
92 | end record;
93 |
94 | type t_phy_layer_q is record
95 | phy_ltssm_state : std_logic_vector(3 downto 0);
96 | phy_pol_compliance : std_logic;
97 | tx_lbk_rdy : std_logic;
98 | rx_lbk_kcntl : std_logic_vector(1 downto 0);
99 | rx_lbk_data : std_logic_vector(15 downto 0);
100 | end record;
101 |
102 | type t_data_link_layer_d is record
103 | tx_dllp_val : std_logic_vector(1 downto 0);
104 | tx_pmtype : std_logic_vector(2 downto 0);
105 | tx_vsd_data : std_logic_vector(23 downto 0);
106 | end record;
107 |
108 | type t_data_link_layer_q is record
109 | dl_inactive : std_logic;
110 | dl_init : std_logic;
111 | dl_active : std_logic;
112 | dl_up : std_logic;
113 | tx_dllp_sent : std_logic;
114 | rxdp_pmd_type : std_logic_vector(2 downto 0);
115 | rxdp_vsd_data : std_logic_vector(23 downto 0);
116 | rxdp_dllp_val : std_logic_vector(1 downto 0);
117 | end record;
118 |
119 | type t_transaction_layer_d is record
120 | cmpln_tout : std_logic;
121 | cmpltr_abort_np : std_logic;
122 | cmpltr_abort_p : std_logic;
123 | unexp_cmpln : std_logic;
124 | np_req_pend : std_logic;
125 | end record;
126 |
127 | type t_config_reg_d is record
128 | inta_n : std_logic;
129 | msi : std_logic_vector(7 downto 0);
130 | pme_status : std_logic;
131 | end record;
132 |
133 | type t_config_reg_q is record
134 | bus_num : std_logic_vector(7 downto 0);
135 | dev_num : std_logic_vector(4 downto 0);
136 | func_num : std_logic_vector(2 downto 0);
137 | cmd_reg_out : std_logic_vector(5 downto 0);
138 | dev_cntl_out : std_logic_vector(14 downto 0);
139 | lnk_cntl_out : std_logic_vector(7 downto 0);
140 | mm_enable : std_logic_vector(2 downto 0);
141 | msi_enable : std_logic;
142 | pme_en : std_logic;
143 | pm_power_state : std_logic_vector(1 downto 0);
144 | end record;
145 |
146 | end package;
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer-cache.lib:
--------------------------------------------------------------------------------
1 | EESchema-LIBRARY Version 2.4
2 | #encoding utf-8
3 | #
4 | # pcie_analyzer_+3.3VCC
5 | #
6 | DEF pcie_analyzer_+3.3VCC #PWR 0 0 Y Y 1 F P
7 | F0 "#PWR" 0 -150 50 H I C CNN
8 | F1 "pcie_analyzer_+3.3VCC" 0 140 50 H V C CNN
9 | F2 "" 0 0 50 H I C CNN
10 | F3 "" 0 0 50 H I C CNN
11 | DRAW
12 | P 2 0 1 0 -30 50 0 100 N
13 | P 2 0 1 0 0 0 0 100 N
14 | P 2 0 1 0 0 100 30 50 N
15 | X +3.3VCC 1 0 0 0 U 50 50 1 1 W N
16 | ENDDRAW
17 | ENDDEF
18 | #
19 | # pcie_analyzer_AXIAL_CABLE_SL8800_08
20 | #
21 | DEF pcie_analyzer_AXIAL_CABLE_SL8800_08 ST 0 40 Y Y 1 F N
22 | F0 "ST" 300 150 50 H V C CNN
23 | F1 "pcie_analyzer_AXIAL_CABLE_SL8800_08" 300 -1600 50 H V C CNN
24 | F2 "PCIE_adapter:AXIAL_CABLE_SL8800_08" 400 -1600 50 H I C CNN
25 | F3 "" 200 -200 50 H I C CNN
26 | DRAW
27 | S 200 -1050 650 -1250 0 1 0 N
28 | S 200 -750 650 -950 0 1 0 N
29 | S 200 -450 650 -650 0 1 0 N
30 | S 200 -150 650 -350 0 1 0 N
31 | S 200 50 650 -1500 0 1 0 N
32 | X 1 1 0 -200 200 R 50 50 1 1 I
33 | X 2 2 0 -300 200 R 50 50 1 1 I
34 | X 3 3 0 -500 200 R 50 50 1 1 I
35 | X 4 4 0 -600 200 R 50 50 1 1 I
36 | X 5 5 0 -800 200 R 50 50 1 1 I
37 | X 6 6 0 -900 200 R 50 50 1 1 I
38 | X 7 7 0 -1100 200 R 50 50 1 1 I
39 | X 8 8 0 -1200 200 R 50 50 1 1 I
40 | X M M 0 -1400 200 R 50 50 1 1 I
41 | X M M 0 0 200 R 50 50 1 1 I
42 | ENDDRAW
43 | ENDDEF
44 | #
45 | # pcie_analyzer_C
46 | #
47 | DEF pcie_analyzer_C C 0 10 N N 1 F N
48 | F0 "C" 50 75 50 H V L CNB
49 | F1 "pcie_analyzer_C" 50 -75 50 H V L CNN
50 | F2 "" 0 15 50 H I C CNN
51 | F3 "" 0 15 50 H I C CNN
52 | $FPLIST
53 | C_*
54 | $ENDFPLIST
55 | DRAW
56 | P 5 0 1 2 -65 -15 65 -15 65 -25 -65 -25 -65 -15 F
57 | P 5 0 1 2 -65 25 65 25 65 15 -65 15 -65 25 F
58 | X ~ 1 0 100 80 D 50 50 1 1 P
59 | X ~ 2 0 -100 80 U 50 50 1 1 P
60 | ENDDRAW
61 | ENDDEF
62 | #
63 | # pcie_analyzer_Conn_Coaxial
64 | #
65 | DEF pcie_analyzer_Conn_Coaxial J 0 40 Y N 1 F N
66 | F0 "J" 10 120 50 H V C CNN
67 | F1 "pcie_analyzer_Conn_Coaxial" 100 -400 50 H V C CNN
68 | F2 "" 0 0 50 H I C CNN
69 | F3 "" 0 0 50 H I C CNN
70 | $FPLIST
71 | *BNC*
72 | *SMA*
73 | *SMB*
74 | *SMC*
75 | *Cinch*
76 | $ENDFPLIST
77 | DRAW
78 | A 8 0 71 1636 0 0 1 10 N -60 20 80 0
79 | A 9 0 71 0 -1638 0 1 10 N 80 0 -60 -20
80 | C 10 0 20 0 1 8 N
81 | S -75 75 100 -375 0 1 0 N
82 | P 2 0 1 0 -100 0 -20 0 N
83 | X In 1 -200 0 200 R 50 50 1 1 P
84 | X Ext 2 300 0 200 L 50 50 1 1 P
85 | X ~ 3 300 -100 200 L 50 50 1 1 P
86 | X ~ 4 300 -200 200 L 50 50 1 1 P
87 | X ~ 5 300 -300 200 L 50 50 1 1 P
88 | ENDDRAW
89 | ENDDEF
90 | #
91 | # pcie_analyzer_Ferrite_Bead
92 | #
93 | DEF pcie_analyzer_Ferrite_Bead FB 0 40 N N 1 F N
94 | F0 "FB" 0 175 50 H V C CNB
95 | F1 "pcie_analyzer_Ferrite_Bead" 0 100 50 H V C CNN
96 | F2 "" 0 0 50 V I C CNN
97 | F3 "" 0 0 50 V I C CNN
98 | $FPLIST
99 | Choke_*
100 | *Coil*
101 | Inductor_*
102 | L_*
103 | $ENDFPLIST
104 | DRAW
105 | A -75 0 25 1 1799 0 1 0 N -50 0 -100 0
106 | A -25 0 25 1 1799 0 1 0 N 0 0 -50 0
107 | A 25 0 25 1 1799 0 1 0 N 50 0 0 0
108 | A 75 0 25 1 1799 0 1 0 N 100 0 50 0
109 | P 2 0 1 0 -70 40 -90 40 N
110 | P 2 0 1 0 -30 40 -50 40 N
111 | P 2 0 1 0 10 40 -10 40 N
112 | P 2 0 1 0 50 40 30 40 N
113 | P 2 0 1 0 90 40 70 40 N
114 | X 1 1 -150 0 50 R 50 50 1 1 P
115 | X 2 2 150 0 50 L 50 50 1 1 P
116 | ENDDRAW
117 | ENDDEF
118 | #
119 | # pcie_analyzer_GND
120 | #
121 | DEF pcie_analyzer_GND #PWR 0 0 Y Y 1 F P
122 | F0 "#PWR" -5 -170 50 H I C CNN
123 | F1 "pcie_analyzer_GND" 0 -100 50 H I C CNN
124 | F2 "" 0 0 50 H I C CNN
125 | F3 "" 0 0 50 H I C CNN
126 | DRAW
127 | P 2 0 1 6 0 -50 0 0 N
128 | P 2 0 1 10 55 -50 -55 -50 N
129 | X GND 1 0 0 0 D 50 50 1 1 W N
130 | ENDDRAW
131 | ENDDEF
132 | #
133 | # pcie_analyzer_HDR40
134 | #
135 | DEF pcie_analyzer_HDR40 J 0 40 Y Y 1 F N
136 | F0 "J" 75 150 50 H V C CNN
137 | F1 "pcie_analyzer_HDR40" 150 -2050 50 H V C CNN
138 | F2 "" 0 0 50 H I C CNN
139 | F3 "" 0 0 50 H I C CNN
140 | DRAW
141 | C 90 -1900 30 0 1 0 N
142 | C 90 -1800 30 0 1 0 N
143 | C 90 -1700 30 0 1 0 N
144 | C 90 -1600 30 0 1 0 N
145 | C 90 -1500 30 0 1 0 N
146 | C 90 -1400 30 0 1 0 N
147 | C 90 -1300 30 0 1 0 N
148 | C 90 -1200 30 0 1 0 N
149 | C 90 -1100 30 0 1 0 N
150 | C 90 -1000 30 0 1 0 N
151 | C 90 -900 30 0 1 0 N
152 | C 90 -800 30 0 1 0 N
153 | C 90 -700 30 0 1 0 N
154 | C 90 -600 30 0 1 0 N
155 | C 90 -500 30 0 1 0 N
156 | C 90 -400 30 0 1 0 N
157 | C 90 -300 30 0 1 0 N
158 | C 90 -200 30 0 1 0 N
159 | C 90 -100 30 0 1 0 N
160 | C 210 -1900 30 0 1 0 N
161 | C 210 -1800 30 0 1 0 N
162 | C 210 -1700 30 0 1 0 N
163 | C 210 -1600 30 0 1 0 N
164 | C 210 -1500 30 0 1 0 N
165 | C 210 -1400 30 0 1 0 N
166 | C 210 -1300 30 0 1 0 N
167 | C 210 -1200 30 0 1 0 N
168 | C 210 -1100 30 0 1 0 N
169 | C 210 -1000 30 0 1 0 N
170 | C 210 -900 30 0 1 0 N
171 | C 210 -800 30 0 1 0 N
172 | C 210 -700 30 0 1 0 N
173 | C 210 -600 30 0 1 0 N
174 | C 210 -500 30 0 1 0 N
175 | C 210 -400 30 0 1 0 N
176 | C 210 -300 30 0 1 0 N
177 | C 210 -200 30 0 1 0 N
178 | C 210 -100 30 0 1 0 N
179 | C 210 0 30 0 1 0 N
180 | S 0 80 300 -1980 0 1 0 N
181 | S 60 30 120 -30 0 1 0 N
182 | X ~ 1 -200 0 200 R 50 50 1 1 B
183 | X ~ 10 500 -400 200 L 50 50 1 1 B
184 | X ~ 11 -200 -500 200 R 50 50 1 1 B
185 | X ~ 12 500 -500 200 L 50 50 1 1 B
186 | X ~ 13 -200 -600 200 R 50 50 1 1 B
187 | X ~ 14 500 -600 200 L 50 50 1 1 B
188 | X ~ 15 -200 -700 200 R 50 50 1 1 B
189 | X ~ 16 500 -700 200 L 50 50 1 1 B
190 | X ~ 17 -200 -800 200 R 50 50 1 1 B
191 | X ~ 18 500 -800 200 L 50 50 1 1 B
192 | X ~ 19 -200 -900 200 R 50 50 1 1 B
193 | X ~ 2 500 0 200 L 50 50 1 1 B
194 | X ~ 20 500 -900 200 L 50 50 1 1 B
195 | X ~ 21 -200 -1000 200 R 50 50 1 1 B
196 | X ~ 22 500 -1000 200 L 50 50 1 1 B
197 | X ~ 23 -200 -1100 200 R 50 50 1 1 B
198 | X ~ 24 500 -1100 200 L 50 50 1 1 B
199 | X ~ 25 -200 -1200 200 R 50 50 1 1 B
200 | X ~ 26 500 -1200 200 L 50 50 1 1 B
201 | X ~ 27 -200 -1300 200 R 50 50 1 1 B
202 | X ~ 28 500 -1300 200 L 50 50 1 1 B
203 | X ~ 29 -200 -1400 200 R 50 50 1 1 B
204 | X ~ 3 -200 -100 200 R 50 50 1 1 B
205 | X ~ 30 500 -1400 200 L 50 50 1 1 B
206 | X ~ 31 -200 -1500 200 R 50 50 1 1 B
207 | X ~ 32 500 -1500 200 L 50 50 1 1 B
208 | X ~ 33 -200 -1600 200 R 50 50 1 1 B
209 | X ~ 34 500 -1600 200 L 50 50 1 1 B
210 | X ~ 35 -200 -1700 200 R 50 50 1 1 B
211 | X ~ 36 500 -1700 200 L 50 50 1 1 B
212 | X ~ 37 -200 -1800 200 R 50 50 1 1 B
213 | X ~ 38 500 -1800 200 L 50 50 1 1 B
214 | X ~ 39 -200 -1900 200 R 50 50 1 1 B
215 | X ~ 4 500 -100 200 L 50 50 1 1 B
216 | X ~ 40 500 -1900 200 L 50 50 1 1 B
217 | X ~ 5 -200 -200 200 R 50 50 1 1 B
218 | X ~ 6 500 -200 200 L 50 50 1 1 B
219 | X ~ 7 -200 -300 200 R 50 50 1 1 B
220 | X ~ 8 500 -300 200 L 50 50 1 1 B
221 | X ~ 9 -200 -400 200 R 50 50 1 1 B
222 | ENDDRAW
223 | ENDDEF
224 | #
225 | # pcie_analyzer_ONET1191P
226 | #
227 | DEF pcie_analyzer_ONET1191P D 0 40 Y Y 1 F N
228 | F0 "D" 900 300 50 H V C CNN
229 | F1 "pcie_analyzer_ONET1191P" 500 -800 50 H V C CNN
230 | F2 "" 600 200 50 V I C CNN
231 | F3 "" 600 200 50 V I C CNN
232 | DRAW
233 | S 0 100 1000 -1200 0 1 0 N
234 | X VCC 1 400 300 200 D 50 50 1 1 W
235 | X LOS 10 1200 -300 200 L 50 50 1 1 I
236 | X DISABLE 11 -200 -300 200 R 50 50 1 1 I
237 | X VAR 12 -200 -900 200 R 50 50 1 1 I
238 | X GND 13 500 -1400 200 U 50 50 1 1 W
239 | X DOUT- 14 1200 0 200 L 50 50 1 1 O
240 | X DOUT+ 15 1200 -100 200 L 50 50 1 1 O
241 | X GND 16 600 -1400 200 U 50 50 1 1 W
242 | X VCC 2 500 300 200 D 50 50 1 1 W
243 | X GND 3 300 -1400 200 U 50 50 1 1 W
244 | X GND 4 400 -1400 200 U 50 50 1 1 W
245 | X COC- 5 -200 -500 200 R 50 50 1 1 I
246 | X COC+ 6 -200 -600 200 R 50 50 1 1 I
247 | X DIN+ 7 -200 0 200 R 50 50 1 1 I
248 | X DIN- 8 -200 -100 200 R 50 50 1 1 I
249 | X TH 9 -200 -800 200 R 50 50 1 1 I
250 | X EP EP 700 -1400 200 U 50 50 1 1 W
251 | ENDDRAW
252 | ENDDEF
253 | #
254 | # pcie_analyzer_R
255 | #
256 | DEF pcie_analyzer_R R 0 0 N Y 1 F N
257 | F0 "R" 50 50 50 H V L CNB
258 | F1 "pcie_analyzer_R" 50 -50 50 H V L CNN
259 | F2 "" -70 0 50 V I C CNN
260 | F3 "" 0 0 50 H I C CNN
261 | $FPLIST
262 | R_*
263 | R_*
264 | $ENDFPLIST
265 | DRAW
266 | S -30 -65 30 65 0 1 8 N
267 | X ~ 1 0 100 35 D 50 50 1 1 P
268 | X ~ 2 0 -100 35 U 50 50 1 1 P
269 | ENDDRAW
270 | ENDDEF
271 | #
272 | #End Library
273 |
--------------------------------------------------------------------------------
/py_script/parse2.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | from datetime import datetime
3 |
4 | def hex_str_to_num(words: [str]) -> '[int]':
5 | out = []
6 | for word in words:
7 | if word.startswith("0x"):
8 | out.append(int(word[2:], 16))
9 | else:
10 | raise ValueError(f"hex_str_to_num: invalid word '{word}'")
11 | return out
12 |
13 |
14 | def two_byte(bytes: [int]) -> int:
15 | return bytes[1] | (bytes[0] << 8)
16 |
17 | def four_byte(bytes: [int]) -> int:
18 | return bytes[3] | (bytes[2] << 8) | (bytes[1] << 16) | (bytes[0] << 24)
19 |
20 | def eight_byte(bytes: [int]) -> int:
21 | return (four_byte(bytes[0:4]) << 32) | four_byte(bytes[4:8])
22 |
23 | class FmtTypes:
24 | CPLD = 0b010_01010
25 | MRD = 0b000_00000
26 | MWR = 0b010_00000
27 | MSGD = 0b011_10100
28 |
29 | def fmt_type_to_str(val: int) -> str:
30 | match val:
31 | case FmtTypes.MSGD:
32 | return "MsgD"
33 | case 0b001_10000:
34 | return "Msg"
35 | case 0b001_10100:
36 | return "Msg"
37 | case 0b000_01010:
38 | return "Cpl"
39 | case FmtTypes.CPLD:
40 | return "CplD"
41 | case FmtTypes.MRD:
42 | return "MRd" #3DW
43 | case 0b001_00000:
44 | return "MRd_4DW"
45 | case FmtTypes.MWR:
46 | return "MWr" #3DW
47 | case 0b011_00000:
48 | return "MWr_4DW"
49 | case other:
50 | return f"??? 0b{val: b}"
51 |
52 | def tlp_tag_to_slot(tag: int) -> int:
53 | # bit 4:0
54 | return tag & 0b11111
55 |
56 |
57 | def tlp_tag_to_index(tag: int) -> int:
58 | # bit6:5
59 | return (tag & 0b1100000) >> 5
60 |
61 |
62 | def tlp_tag_to_process(tag: int) -> int:
63 | # bit 7
64 | if ((tag & 0b1000_0000) == 0b1000_0000):
65 | # acyclic
66 | return "acyclic"
67 | else:
68 | return "cyclic"
69 |
70 |
71 | def parse_tlp(bytes: [int], packet: dict):
72 | fmt_type = bytes[0]
73 | packet['tlp_fmt_type'] = fmt_type
74 | if len(bytes) >= 4:
75 | length_dw = bytes[3] | ((bytes[2] & 0b11) << 8)
76 | length = length_dw * 4
77 | # if length_dw > 100:
78 | # print(f"len_dw={length_dw} {bytes[2]} {bytes[3]}")
79 | packet['tlp_length_dw'] = length_dw
80 | if fmt_type == FmtTypes.CPLD:
81 | if len(bytes) > 11:
82 | byte_count = bytes[7] | ((bytes[6] & 0b1111) << 8)
83 | packet['tlp_byte_count'] = byte_count
84 | packet['tlp_tag'] = bytes[10]
85 | lower_addr = bytes[11] & 0b0111_1111
86 | packet['tlp_lower_addr'] = lower_addr
87 | idx_data_start = 12 + lower_addr
88 | packet['tlp_data'] = bytes[idx_data_start:(idx_data_start+byte_count)]
89 | elif fmt_type == FmtTypes.MRD:
90 | if len(bytes) >= 11:
91 | packet['tlp_addr'] = four_byte(bytes[8:12]) & 0b11111111_11111111_11111111_11111100
92 | elif fmt_type == FmtTypes.MWR:
93 | if len(bytes) >= 13:
94 | packet['tlp_data'] = bytes[12:(12+length)]
95 | packet['tlp_addr'] = four_byte(bytes[8:12]) & 0b11111111_11111111_11111111_11111100
96 | packet['tlp_first_be'] = bytes[7] & 0b1111
97 | packet['tlp_last_be'] = (bytes[7] >> 4) & 0b1111
98 | packet['tlp_be'] = bytes[7]
99 | elif fmt_type == FmtTypes.MSGD:
100 | idx_ts = 8
101 | idx_prop_delay = idx_ts + 8
102 | idx_after_prop_delay = idx_prop_delay + 4
103 | if len(bytes) >= idx_prop_delay:
104 | # packet['tlp_data'] = bytes[9:(9+8)] # timestamp master time
105 | packet['tlp_ts_master'] = eight_byte(bytes[idx_ts:idx_prop_delay]) # timestamp master time
106 | if len(bytes) >= idx_after_prop_delay:
107 | packet['tlp_prop_delay'] = four_byte(bytes[idx_prop_delay:idx_after_prop_delay]) # propagation delay
108 | else:
109 | packet['tlp_data'] = bytes[4:length]
110 |
111 |
112 | def parse_file(filename: str):
113 | out = []
114 | with open(filename) as f:
115 | lines = f.readlines()
116 | for line in lines:
117 | # print(f"len={len(line)}")
118 | # print(line)
119 | words = line.split(", ")
120 | # print(f"words='{words}'")
121 | if len(words) >= 6:
122 | packet_type = hex_str_to_num([words[3]])[0]
123 | packet = {
124 | "direction": words[0],
125 | "ts": int(words[1]),
126 | "type": packet_type, # int(words[3][3:], 16),
127 | "number": two_byte(hex_str_to_num(words[4:6])),
128 | }
129 | if packet_type == PacketTypes.TYPE_START_TLP and len(words) >= 7:
130 | parse_tlp(hex_str_to_num(words[6:]), packet)
131 | out.append(packet)
132 | return out
133 |
134 |
135 | class PacketTypes:
136 | TYPE_START_TLP = 0xfb
137 | TYPE_START_DLLP = 0x5c
138 |
139 |
140 | def do_parse(filename: str):
141 | parsed = parse_file(filename)
142 | sortedlist = sorted(parsed, key=lambda packet: packet["ts"], reverse=False)
143 | # print(sortedlist[0])
144 | return sortedlist
145 |
146 |
147 | def type_to_str(type: int) -> 'str':
148 | match type:
149 | case PacketTypes.TYPE_START_TLP:
150 | return "TLP"
151 | case PacketTypes.TYPE_START_DLLP:
152 | return "DLLP"
153 | case other:
154 | return f"??? type=0x{type:x}"
155 |
156 |
157 | def data_as_str(vals: [int]) -> str:
158 | out = "["
159 | str_vals = map(lambda val: f"0x{val:02x}", vals)
160 | out += ','.join(str_vals)
161 | out += "]"
162 | return out
163 |
164 | def print_parsed(sortedlist: [dict]):
165 | last = 0
166 | for packet in sortedlist:
167 | delta_ts = packet['ts'] - last
168 | tlp_str = ""
169 | if 'tlp_fmt_type' in packet:
170 | tlp_str += f"{fmt_type_to_str(packet['tlp_fmt_type']):4} "
171 | if 'tlp_length_dw' in packet:
172 | tlp_str += f"lenDW={packet['tlp_length_dw']} "
173 | if 'tlp_byte_count' in packet:
174 | tlp_str += f"bytecount={packet['tlp_byte_count']} "
175 | if 'tlp_tag' in packet:
176 | tlp_str += f"tag=(slot={tlp_tag_to_slot(packet['tlp_tag'])} idx={tlp_tag_to_index(packet['tlp_tag'])} {tlp_tag_to_process(packet['tlp_tag'])}) "
177 | if 'tlp_addr' in packet:
178 | tlp_str += f"addr=0x{packet['tlp_addr']:08x} "
179 | if 'tlp_lower_addr' in packet:
180 | tlp_str += f"tlp_lower_addr=0x{packet['tlp_lower_addr']:02x} "
181 | if 'tlp_data' in packet:
182 | tlp_str += f"data={data_as_str(packet['tlp_data'])} "
183 | if 'tlp_first_be' in packet:
184 | tlp_str += f"1st_be=0b{packet['tlp_first_be']:04b} "
185 | if 'tlp_last_be' in packet:
186 | tlp_str += f"last_be=0b{packet['tlp_last_be']:04b} "
187 | if 'tlp_ts_master' in packet:
188 | # tlp_str += f"ts_master={packet['tlp_ts_master']} ({datetime.fromtimestamp(packet['tlp_ts_master']/1e9).strftime("%A, %B %d, %Y %I:%M:%S")}) "
189 | tlp_str += f"ts_master=0x{packet['tlp_ts_master']:016x} ts_master={packet['tlp_ts_master']} "
190 | if 'tlp_prop_delay' in packet:
191 | tlp_str += f"prop_delay=0x{packet['tlp_prop_delay']:08x} "
192 |
193 | # if 'tlp_be' in packet:
194 | # tlp_str += f"be=0x{packet['tlp_be']:02x} "
195 |
196 | print(f"{packet['direction']} {packet['ts']/1e6: 12.6f} {delta_ts: 10} {type_to_str(packet['type']):3} {packet['number']: 8} {tlp_str}")
197 | last = packet['ts']
198 |
199 | def execute():
200 | """build a m100 io module initial package"""
201 | parser = argparse.ArgumentParser(
202 | prog='',
203 | description='',
204 | epilog=r'')
205 | parser.add_argument('record_csv')
206 | args = parser.parse_args()
207 |
208 | parsed = do_parse(args.record_csv)
209 | print_parsed(parsed)
210 |
211 |
212 | if __name__ == "__main__":
213 | execute()
--------------------------------------------------------------------------------
/fpga_logic/src/rev_analyzer.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- Entity: rev_analyzer
3 | -- Date: 23 Sep 2021
4 | -- Author: GRPA
5 | --
6 | -- Description: brief
7 | --------------------------------------------------------------------------------
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | use ieee.numeric_std.all;
11 |
12 | --vhdl_comp_off
13 | --library sinplify;
14 | --use sinplify.attributes.all;
15 | --vhdl_comp_on
16 |
17 | package rev_analyzer_pkg is
18 | type t_rev_analyzer_in is record
19 | button : std_logic;
20 | data_in_rx : std_logic_vector (35 downto 0);
21 | data_in_tx : std_logic_vector (35 downto 0);
22 |
23 | stop_trigger : std_logic;
24 | end record;
25 | type t_rev_analyzer_out is record
26 | led_out : std_logic_vector (7 downto 0);
27 | trigger_ena : std_logic;
28 | read_addr : std_logic_vector (14 downto 0);
29 |
30 | data_out_rx : std_logic_vector (31 downto 0);
31 | timestamp_ena_rx : std_logic;
32 | data_ena_rx : std_logic;
33 |
34 | data_out_tx : std_logic_vector (31 downto 0);
35 | timestamp_ena_tx : std_logic;
36 | data_ena_tx : std_logic;
37 | end record;
38 | end package;
39 |
40 | library ieee;
41 | use ieee.std_logic_1164.all;
42 | use ieee.numeric_std.all;
43 | use ieee.numeric_std_unsigned.all;
44 | use work.rev_analyzer_pkg.all;
45 |
46 | --! placeholder for sinplify libraries
47 | --vhdl_comp_off
48 | --library sinplify;
49 | --use sinplify.attributes.all;
50 | --vhdl_comp_on
51 |
52 | entity rev_analyzer is
53 | port (
54 | clk : in std_logic; -- input clock, xx MHz.
55 | rst : in std_logic;
56 | d : in t_rev_analyzer_in;
57 | q : out t_rev_analyzer_out
58 | );
59 | attribute syn_preserve : boolean;
60 | attribute syn_preserve of q : signal is true;
61 | end rev_analyzer;
62 |
63 | architecture arch of rev_analyzer is
64 |
65 | type t_state is (WAIT_ST, TRIGGER_ST, READ_ST);
66 | type reg_t is record
67 | button_del : std_logic;
68 | led_out : std_logic_vector (7 downto 0);
69 | trigger_ena : std_logic;
70 | trigger_stop : std_logic_vector (1 downto 0);
71 | wait_cnt : std_logic_vector (3 downto 0);
72 | read_addr : std_logic_vector (14 downto 0);
73 | state : t_state;
74 |
75 | read_data_rx : std_logic_vector (31 downto 0);
76 | timestamp_rx : std_logic;
77 | data_ena_rx : std_logic;
78 |
79 | read_data_tx : std_logic_vector (31 downto 0);
80 | timestamp_tx : std_logic;
81 | data_ena_tx : std_logic;
82 |
83 | end record reg_t;
84 |
85 | constant REG_T_INIT : reg_t := (
86 | button_del => '0',
87 | led_out => (others => '0'),
88 | trigger_ena => '0',
89 | trigger_stop => (others => '0'),
90 | wait_cnt => (others => '0'),
91 | read_addr => (others => '0'),
92 | state => WAIT_ST,
93 |
94 | read_data_rx => (others => '0'),
95 | timestamp_rx => '0',
96 | data_ena_rx => '0',
97 |
98 | read_data_tx => (others => '0'),
99 | timestamp_tx => '0',
100 | data_ena_tx => '0'
101 | );
102 |
103 | signal r, rin : reg_t;
104 |
105 | --******************************************************************************
106 | -- REVEAL ANALYZER SIGNALS
107 | -- placeholder for debug
108 | -- attributes used to prevent signals optimizing
109 | --******************************************************************************
110 | signal data_in_rx : std_logic_vector (31 downto 0);
111 | signal data_in_tx : std_logic_vector (31 downto 0);
112 | signal timestamp_flag_rx : std_logic;
113 | signal timestamp_flag_tx : std_logic;
114 | signal data_ena_rx : std_logic;
115 | signal data_ena_tx : std_logic;
116 | --
117 | attribute syn_preserve of data_in_rx : signal is true;
118 | attribute syn_preserve of timestamp_flag_rx : signal is true;
119 | attribute syn_preserve of data_ena_rx : signal is true;
120 | attribute syn_preserve of data_ena_tx : signal is true;
121 | attribute syn_preserve of data_in_tx : signal is true;
122 | attribute syn_preserve of timestamp_flag_tx : signal is true;
123 | --******************************************************************************
124 |
125 | begin
126 |
127 | data_in_rx <= d.data_in_rx(34 downto 27) & d.data_in_rx(25 downto 18) & d.data_in_rx(16 downto 9) & d.data_in_rx(7 downto 0);
128 | timestamp_flag_rx <= d.data_in_rx(35);
129 | data_ena_rx <= '1' when r.state = READ_ST else '0';
130 | data_in_tx <= d.data_in_tx(34 downto 27) & d.data_in_tx(25 downto 18) & d.data_in_tx(16 downto 9) & d.data_in_tx(7 downto 0);
131 | timestamp_flag_tx <= d.data_in_tx(35);
132 | data_ena_tx <= '1' when r.state = READ_ST else '0';
133 |
134 | comb : process (r, d) is
135 | variable v: reg_t;
136 | begin
137 | v := r;
138 | v.button_del := d.button;
139 | v.trigger_stop := r.trigger_stop(0) & d.stop_trigger;
140 |
141 | v.read_data_rx := d.data_in_rx(34 downto 27) & d.data_in_rx(25 downto 18) & d.data_in_rx(16 downto 9) & d.data_in_rx(7 downto 0);
142 | v.timestamp_rx := d.data_in_rx(35);
143 |
144 | v.read_data_tx := d.data_in_tx(34 downto 27) & d.data_in_tx(25 downto 18) & d.data_in_tx(16 downto 9) & d.data_in_tx(7 downto 0);
145 | v.timestamp_tx := d.data_in_tx(35);
146 |
147 | case r.state is
148 | when WAIT_ST =>
149 | v.led_out(7) := '0';
150 | v.led_out(6) := '1';
151 | v.led_out(5) := '1';
152 | v.data_ena_rx := '0';
153 | v.data_ena_tx := '0';
154 | if r.button_del = '0' and d.button = '1' then
155 | v.trigger_ena := '1';
156 | v.state := TRIGGER_ST;
157 | end if;
158 | when TRIGGER_ST =>
159 | v.led_out(7) := '0';
160 | v.led_out(6) := '0';
161 | v.led_out(5) := '1';
162 | if r.trigger_stop(1) = '0' and r.trigger_stop(0) = '1' then
163 | v.state := READ_ST;
164 | end if;
165 | when READ_ST =>
166 | v.led_out(7) := '0';
167 | v.led_out(6) := '0';
168 | v.led_out(5) := '0';
169 | if r.read_addr < 15X"00FF" then
170 | v.read_addr := r.read_addr + 1;
171 | v.data_ena_rx := '1';
172 | v.data_ena_tx := '1';
173 | else
174 | v.read_addr := (others => '0');
175 | v.state := WAIT_ST;
176 | end if;
177 | end case;
178 |
179 | if r.trigger_ena = '1' then
180 | if r.wait_cnt < "1111" then
181 | v.wait_cnt := r.wait_cnt + 1;
182 | else
183 | v.trigger_ena := '0';
184 | v.wait_cnt := (others => '0');
185 | end if;
186 | end if;
187 | --TODO: ADD YOUR CODE HERE
188 | rin <= v;
189 | end process comb;
190 |
191 | q.read_addr <= r.read_addr;
192 | q.led_out <= r.led_out;
193 | q.trigger_ena <= r.trigger_ena;
194 |
195 | q.data_out_rx <= r.read_data_rx;
196 | q.timestamp_ena_rx <= r.timestamp_rx;
197 | q.data_ena_rx <= r.data_ena_rx;
198 |
199 | q.data_out_tx <= r.read_data_tx;
200 | q.timestamp_ena_tx <= r.timestamp_tx;
201 | q.data_ena_tx <= r.data_ena_tx;
202 |
203 | -- Register process
204 | regs : process (clk) is
205 | begin
206 | -- Synchronous reset
207 | if rising_edge(clk) then
208 | if rst = '1' then
209 | r <= REG_T_INIT;
210 | else
211 | r <= rin;
212 | end if;
213 | end if;
214 | end process regs;
215 | end arch;
--------------------------------------------------------------------------------
/fpga_logic/sim/vunit/spi_controller_tb.v1:
--------------------------------------------------------------------------------
1 | library ieee;
2 | use ieee.std_logic_1164.all;
3 | use ieee.std_logic_unsigned.all;
4 | use ieee.math_real.all;
5 | use ieee.numeric_std.all;
6 |
7 | package spi_controller_tb_pkg is
8 | type payload_t is array (0 to 128) of std_logic_vector (7 downto 0);
9 | procedure spi_test (
10 | constant freq : in integer;
11 | signal clk : out std_logic;
12 | signal miso : in std_logic;
13 | signal mosi : out std_logic;
14 | signal cs : out std_logic;
15 |
16 | signal data_in : in payload_t;
17 | signal data_out : out payload_t;
18 | constant len : in integer
19 | );
20 | end package;
21 | package body spi_controller_tb_pkg is
22 | procedure spi_test (
23 | constant freq : in integer;
24 | signal clk : out std_logic;
25 | signal miso : in std_logic;
26 | signal mosi : out std_logic;
27 | signal cs : out std_logic;
28 |
29 | signal data_in : in payload_t;
30 | signal data_out : out payload_t;
31 | constant len : in integer) is
32 |
33 | variable waittime : time;
34 | variable realtime : real;
35 | begin
36 | realtime := 1.0 / Real(freq*2);
37 | waittime := realtime * 1 us;
38 | cs <= '0';
39 | wait for waittime;-- (1/Real(freq))*1 us;
40 | clk <= '0';
41 | for i in 0 to len - 1 loop
42 | for j in 0 to 7 loop
43 | data_out(i)(7 - j) <= miso;
44 | wait for waittime;--(1/freq)*500 ns;
45 | clk <= '1';
46 | mosi <= data_in(i)(7 - j);
47 | wait for waittime;--(1/freq)*500 ns;
48 | clk <= '0';
49 | end loop;
50 | end loop;
51 | wait for waittime;-- (1/freq)*1 us;
52 | cs <= '1';
53 | wait for waittime;--(1/freq)*1 us;
54 | end spi_test;
55 | end package body;
56 |
57 | library ieee;
58 | use ieee.std_logic_1164.all;
59 | use ieee.std_logic_unsigned.all;
60 | use ieee.numeric_std.all;
61 | use ieee.std_logic_textio.all;
62 | use std.textio.all;
63 |
64 | use work.controller_pkg.all;
65 | use work.spi_controller_tb_pkg.all;
66 | use work.analyzer_pkg.all;
67 |
68 | library aldec;
69 | use aldec.aldec_tools.all;
70 |
71 | library vunit_lib;
72 | context vunit_lib.vunit_context;
73 | --context vunit_lib.vc_context;
74 |
75 | entity spi_controller_tb is
76 | generic (runner_cfg : string);
77 | end spi_controller_tb;
78 |
79 | architecture arch of spi_controller_tb is
80 |
81 | constant SPI_WORD_SIZE : integer := 8;
82 |
83 | signal clk_100 : std_logic;
84 | signal rst : std_logic;
85 | signal SCLK : std_logic;
86 | signal mosi : std_logic;
87 | signal miso : std_logic;
88 | signal cs_n : std_logic;
89 | signal d_cntr : t_controller_in;
90 | signal q_cntr : t_controller_out;
91 |
92 | signal payload : payload_t;
93 | signal spi_data_in : payload_t;
94 | signal tb_end : boolean := false;
95 |
96 | signal d_mem_data_out : std_logic_vector (35 downto 0);
97 | signal u_mem_data_out : std_logic_vector (35 downto 0);
98 | constant payload_clear : payload_t := (others => (others => '0'));
99 | begin
100 | /*
101 | asdb_dump("/spi_controller_tb/rst");
102 | asdb_dump("/spi_controller_tb/clk_100");
103 | asdb_dump("/spi_controller_tb/SCLK");
104 | asdb_dump("/spi_controller_tb/mosi");
105 | asdb_dump("/spi_controller_tb/miso");
106 | asdb_dump("/spi_controller_tb/cs_n");
107 | asdb_dump("/spi_controller_tb/d_cntr");
108 | asdb_dump("/spi_controller_tb/q_cntr");
109 | asdb_dump("/spi_controller_tb/controller_inst/r");
110 | */
111 | main : process
112 | begin
113 | test_runner_setup (runner, runner_cfg);
114 | if run ("test start") then
115 | wait until tb_end = true;
116 | report "all data was transferred";
117 | end if;
118 | test_runner_cleanup(runner);
119 | end process;
120 |
121 | rst_process : process is
122 | begin
123 | rst <= '1';
124 | wait for 300 ns;
125 | rst <= '0';
126 | wait for 100 ns;
127 | wait;
128 | end process;
129 |
130 | clk_100_process : process is
131 | begin
132 | clk_100 <= '1';
133 | wait for 5 ns;
134 | clk_100 <= '0';
135 | wait for 5 ns;
136 | end process;
137 |
138 | test_process: process is
139 | variable f : integer := 10;
140 | begin
141 | tb_end <= false;
142 | sclk <= '0';
143 | cs_n <= '1';
144 | miso <= 'Z';
145 | mosi <= 'Z';
146 |
147 | wait for 400 ns;
148 | payload(0) <= X"03"; -- read memory
149 | payload(1) <= X"00"; -- select mem
150 | payload(2) <= X"00"; -- address hi
151 | payload(3) <= X"20"; -- address lo
152 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 4);
153 | wait for 1 us;
154 |
155 | payload <= payload_clear;
156 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 33);
157 | wait for 1 us;
158 |
159 | payload(0) <= X"03"; -- read memory
160 | payload(1) <= X"00"; -- select mem
161 | payload(2) <= X"00"; -- address hi
162 | payload(3) <= X"00"; -- address lo
163 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 4);
164 | wait for 1 us;
165 |
166 | payload <= payload_clear;
167 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 33);
168 | wait for 1 us;
169 |
170 | payload(0) <= X"02"; -- read memory
171 | payload(1) <= X"00"; -- select mem
172 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 2);
173 | wait for 1 us;
174 | payload <= payload_clear;
175 | spi_test(freq => f, clk => sclk, miso => miso, mosi => mosi, cs => cs_n, data_in => payload, data_out => spi_data_in, len => 8);
176 | wait for 1 us;
177 |
178 | tb_end <= true;
179 | wait;
180 |
181 | end process;
182 |
183 | spi_slave_inst : entity work.SPI_SLAVE
184 | generic map(
185 | WORD_SIZE => SPI_WORD_SIZE
186 | )
187 | port map(
188 | CLK => clk_100,
189 | RST => rst,
190 | SCLK => sclk,
191 | CS_N => cs_n,
192 | MOSI => mosi,
193 | MISO => miso,
194 | DIN => q_cntr.data_out,
195 | DIN_VLD => q_cntr.data_out_vld,
196 | DIN_RDY => d_cntr.data_out_rdy,
197 | DOUT => d_cntr.data_in,
198 | DOUT_VLD => d_cntr.data_in_vld,
199 | CS_N_OUT => d_cntr.cs_n
200 | );
201 |
202 | d_cntr.mem_data_in <= d_mem_data_out when q_cntr.mem_select = '0' else u_mem_data_out;
203 | controller_inst : entity work.controller
204 | port map(
205 | clk => clk_100,
206 | rst => rst,
207 | d => d_cntr,
208 | q => q_cntr
209 | );
210 | ram_inst_d: entity work.pdpram
211 | generic map (
212 | addr_width => 16,
213 | data_width => 36
214 | )
215 | port map (
216 | write_en => '0',
217 | waddr => (others => '0'),
218 | wclk => '0',
219 | raddr => q_cntr.addr_read,
220 | rclk => clk_100,
221 | din => (others => '0'),
222 | dout => d_mem_data_out
223 | );
224 |
225 | ram_inst_u: entity work.pdpram
226 | generic map (
227 | addr_width => 16,
228 | data_width => 36
229 | )
230 | port map (
231 | write_en => '0',
232 | waddr => (others => '0'),
233 | wclk => '0',
234 | raddr => q_cntr.addr_read,
235 | rclk => clk_100,
236 | din => (others => '0'),
237 | dout => u_mem_data_out
238 | );
239 |
240 | end arch;
--------------------------------------------------------------------------------
/fpga_logic/src/analyzer_pkg.vhd:
--------------------------------------------------------------------------------
1 | --! analyzer package
2 | library ieee;
3 | use ieee.std_logic_1164.all;
4 |
5 | package analyzer_pkg is
6 | constant MEM_LEN : integer := 16;
7 |
8 | constant K_PAD_SYM_23_7 : std_logic_vector(7 downto 0) := X"F7"; -- PAD; used in framing and link width and lane ordering negotiations
9 | constant K_STP_SYM_27_7 : std_logic_vector(7 downto 0) := X"FB"; -- start TLP; Marks the start of a transaction layer packet
10 | constant K_PAD_SKP_28_0 : std_logic_vector(7 downto 0) := X"1C"; -- skip; used for compensating for different bit rates
11 | constant K_PAD_FTS_28_1 : std_logic_vector(7 downto 0) := X"30"; -- Fast Training Sequence; Used within a ordered set to exit from L0s to L0
12 | constant K_SDP_SYM_28_2 : std_logic_vector(7 downto 0) := X"5C"; -- start DLLP; marks the start of a data link layer packet
13 | constant K_PAD_IDL_28_3 : std_logic_vector(7 downto 0) := X"7C"; -- Idle; used in the electrical idle ordered set
14 | constant K_COM_SYM_28_5 : std_logic_vector(7 downto 0) := X"BC"; -- comma; used for lane and link initialization and management
15 | constant K_PAD_EIE_28_7 : std_logic_vector(7 downto 0) := X"FC"; -- Electrical Idle Exit; Reserved in 2.5 GT/s
16 | constant K_END_SYM_29_7 : std_logic_vector(7 downto 0) := X"FD"; -- end; marks the end of a TLP packet or DLLP packet
17 | constant K_EDB_SYM_30_7 : std_logic_vector(7 downto 0) := X"FE"; -- EnD Bad; marks the end of nullified TLP
18 |
19 | -- TLP Packet Types
20 | -- FMT TYPE
21 | constant TLP_TYPE_MRD3 : std_logic_vector (7 downto 0) := B"000_00000"; -- Memory read request 3DW
22 | constant TLP_TYPE_MRD4 : std_logic_vector (7 downto 0) := B"001_00000"; -- Memory read request 4DW
23 | constant TLP_TYPE_MRDLK3 : std_logic_vector (7 downto 0) := B"000_00001"; -- Memory read lock request 3DW
24 | constant TLP_TYPE_MRDLK4 : std_logic_vector (7 downto 0) := B"001_00001"; -- Memory read lock request 4DW
25 | constant TLP_TYPE_MWR3 : std_logic_vector (7 downto 0) := B"010_00000"; -- Memory write request 3DW
26 | constant TLP_TYPE_MWR4 : std_logic_vector (7 downto 0) := B"011_00000"; -- Memory write request 4DW
27 | constant TLP_TYPE_IORD : std_logic_vector (7 downto 0) := B"000_00010"; -- IO Read request
28 | constant TLP_TYPE_IOWR : std_logic_vector (7 downto 0) := B"010_00010"; -- IO Write request
29 | constant TLP_TYPE_CFGRD0 : std_logic_vector (7 downto 0) := B"000_00100"; -- Config type 0 Read request
30 | constant TLP_TYPE_CFGWR0 : std_logic_vector (7 downto 0) := B"010_00100"; -- Config type 0 Write request
31 | constant TLP_TYPE_CFGRD1 : std_logic_vector (7 downto 0) := B"000_00101"; -- Config type 1 Read request
32 | constant TLP_TYPE_CFGWR1 : std_logic_vector (7 downto 0) := B"010_00101"; -- Config type 1 Write request
33 | constant TLP_TYPE_TCFGRD : std_logic_vector (7 downto 0) := B"000_11011"; --
34 | constant TLP_TYPE_TCFGWR : std_logic_vector (7 downto 0) := B"010_11011";
35 | constant TLP_TYPE_MSG : std_logic_vector (7 downto 0) := B"001_10000"; -- Message request
36 | constant TLP_TYPE_MSGD : std_logic_vector (7 downto 0) := B"011_10000"; -- Message request with data
37 | constant TLP_TYPE_CPL : std_logic_vector (7 downto 0) := B"000_01010"; -- Completion
38 | constant TLP_TYPE_CPLD : std_logic_vector (7 downto 0) := B"010_01010"; -- Completion with data
39 | constant TLP_TYPE_CPLLK : std_logic_vector (7 downto 0) := B"000_01011"; -- Completion/Locked
40 | constant TLP_TYPE_CPLDLK : std_logic_vector (7 downto 0) := B"010_01011"; -- Completion with data
41 |
42 | -- DLLP Packet Types
43 | constant DLLP_TYPE_ACK : std_logic_vector (7 downto 0) := B"0000_0000"; -- TLP Acknowledge
44 | constant DLLP_TYPE_NAK : std_logic_vector (7 downto 0) := B"0001_0000"; -- TLP Negative acknowledge
45 | constant DLLP_TYPE_PM_L1 : std_logic_vector (7 downto 0) := B"0010_0000"; -- Power management Enter L1
46 | constant DLLP_TYPE_PM_L23 : std_logic_vector (7 downto 0) := B"0010_0001"; -- Power management Enter L23
47 | constant DLLP_TYPE_PM_ASR1 : std_logic_vector (7 downto 0) := B"0010_0011"; -- Power management Active state request L1
48 | constant DLLP_TYPE_REQ_ACK : std_logic_vector (7 downto 0) := B"0010_0100"; -- Power management request ack
49 | constant DLLP_TYPE_VEN_SP : std_logic_vector (7 downto 0) := B"0011_0000"; -- vendor specific
50 | constant DLLP_TYPE_FC1P : std_logic_vector (7 downto 0) := B"0100_0000"; -- InitFC1-P
51 | constant DLLP_TYPE_FC1NP : std_logic_vector (7 downto 0) := B"0101_0000"; -- InitFC1-NP
52 | constant DLLP_TYPE_FC1CPL : std_logic_vector (7 downto 0) := B"0110_0000"; -- InitFC1-Cpl
53 | constant DLLP_TYPE_FC2P : std_logic_vector (7 downto 0) := B"1100_0000"; -- InitFC2-P
54 | constant DLLP_TYPE_FC2NP : std_logic_vector (7 downto 0) := B"1101_0000"; -- InitFC2-NP
55 | constant DLLP_TYPE_FC2CPL : std_logic_vector (7 downto 0) := B"1110_0000"; -- InitFC2-Cpl
56 | constant DLLP_TYPE_FCP : std_logic_vector (7 downto 0) := B"1000_0000"; -- UpdateFC-P
57 | constant DLLP_TYPE_FCNP : std_logic_vector (7 downto 0) := B"1001_0000"; -- UpdateFC-NP
58 | constant DLLP_TYPE_FCCPL : std_logic_vector (7 downto 0) := B"1010_0000"; -- UpdateFC-Cpl
59 |
60 | -- SPI Controller commands
61 | constant C_WRITE_REG_CMD : std_logic_vector (7 downto 0) := X"01"; -- write controller register
62 | constant C_READ_REG_CMD : std_logic_vector (7 downto 0) := X"02"; -- read controller register
63 | constant C_READ_MEM : std_logic_vector (7 downto 0) := X"03"; -- read analyzer memory
64 |
65 | -- Controller Register set
66 | constant C_CONFIG_REG : std_logic_vector (7 downto 0) := X"00"; -- config register
67 | constant C_STATUS_REG_0 : std_logic_vector (7 downto 0) := X"01"; -- status register
68 | constant C_STATUS_REG_1 : std_logic_vector (7 downto 0) := X"02"; -- status register
69 | constant C_CONFIG_TLP : std_logic_vector (7 downto 0) := X"03";
70 | constant C_CONFIG_DLLP : std_logic_vector (7 downto 0) := X"04";
71 | constant C_CONFIG_ORDSET : std_logic_vector (7 downto 0) := X"05";
72 | constant C_MEM_AMNT_1_LO : std_logic_vector (7 downto 0) := X"06"; -- entries of memory 1
73 | constant C_MEM_AMNT_1_HI : std_logic_vector (7 downto 0) := X"07";
74 | constant C_MEM_AMNT_2_LO : std_logic_vector (7 downto 0) := X"08"; -- entries of memory 2
75 | constant C_MEM_AMNT_2_HI : std_logic_vector (7 downto 0) := X"09";
76 |
77 | type t_packet_type is (DLLP_PKT, TLP_PKT, ORDR_ST, IDLE);
78 | type t_tlp_type is (NO_PCK, MRD, MRDLK, MWR, IORD, IOWR, CFGRD0, CFGWR0, CFGRD1, CFGWR1, TCFGRD, TCFGWR, MSG, MSGD, CPL, CPLD, CPLLK, CPLDLK);
79 | type t_dllp_type is (NO_PCK, ACK, NAK, PM_L1, PM_L23, PM_ASR1, REQ_ACK, VEN_SP, FC1P, FC1NP, FC1CPL, FC2P, FC2NP, FC2CPL, FCP, FCNP, FCCPL);
80 | type t_order_set_type is (NO_PCK, TS1, TS2, SKIP, FTS, EIDLE);
81 |
82 | type t_trigger_type is record
83 | packet_type_en : std_logic;
84 | packet_type : t_packet_type;
85 |
86 | tlp_type_en : std_logic;
87 | tlp_type : t_tlp_type;
88 |
89 | dllp_type_en : std_logic;
90 | dllp_type : t_dllp_type;
91 |
92 | order_set_en : std_logic;
93 | order_set_type : t_order_set_type;
94 |
95 | addr_match_en : std_logic;
96 | addr_match : std_logic_vector (31 downto 0);
97 | end record;
98 |
99 | type t_filter_in is record
100 | tlp_save : std_logic;
101 | dllp_save : std_logic;
102 | order_set_save : std_logic;
103 | end record;
104 |
105 | type t_analyzer_in is record
106 | data_in_unscr : std_logic_vector (7 downto 0);
107 | data_in_scr : std_logic_vector (7 downto 0);
108 | rx_k : std_logic;
109 |
110 | trigger_start : std_logic;
111 | trigger_stop : std_logic;
112 | trigger_set : t_trigger_type;
113 | filter_in : t_filter_in;
114 | end record;
115 |
116 | type t_analyzer_out is record
117 | addr_wr : std_logic_vector (15 downto 0);
118 | data_wr : std_logic_vector (35 downto 0);
119 | wr_en : std_logic;
120 | trigger_out : std_logic;
121 | data_amount : std_logic_vector (15 downto 0);
122 | addr_pointer : std_logic_vector (15 downto 0);
123 | stop_trigger : std_logic;
124 | end record;
125 |
126 | type t_intf_controller_o is record
127 | start_trig : std_logic;
128 | stop_trig : std_logic;
129 | reset_o : std_logic;
130 |
131 | filter_in : t_filter_in;
132 | trigger_set : t_trigger_type;
133 | end record;
134 |
135 | type t_intf_controller_i is record
136 | status_reg_0 : std_logic_vector (7 downto 0);
137 | status_reg_1 : std_logic_vector (7 downto 0);
138 |
139 | data_amount_0 : std_logic_vector (15 downto 0);
140 | data_amount_1 : std_logic_vector (15 downto 0);
141 | end record;
142 | constant INTF_CONTROLLER_O : t_intf_controller_o := (
143 | '0',
144 | '0',
145 | '0',
146 | ('0','0','0'),
147 | ('0',TLP_PKT,'0',NO_PCK,'0',NO_PCK,'0',NO_PCK,'0',(others => '0'))
148 | );
149 |
150 | end package;
151 |
152 |
--------------------------------------------------------------------------------
/fpga_logic/src/spi_slave.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- PROJECT: SPI MASTER AND SLAVE FOR FPGA
3 | --------------------------------------------------------------------------------
4 | -- AUTHORS: Jakub Cabal
5 | -- LICENSE: The MIT License, please read LICENSE file
6 | -- WEBSITE: https://github.com/jakubcabal/spi-fpga
7 | --------------------------------------------------------------------------------
8 |
9 | library IEEE;
10 | use IEEE.STD_LOGIC_1164.ALL;
11 | use IEEE.NUMERIC_STD.ALL;
12 | use IEEE.MATH_REAL.ALL;
13 |
14 | -- THE SPI SLAVE MODULE SUPPORT ONLY SPI MODE 0 (CPOL=0, CPHA=0)!!!
15 |
16 | entity SPI_SLAVE is
17 | Generic (
18 | WORD_SIZE : natural := 8 -- size of transfer word in bits, must be power of two
19 | );
20 | Port (
21 | CLK : in std_logic; -- system clock
22 | RST : in std_logic; -- high active synchronous reset
23 | -- SPI SLAVE INTERFACE
24 | SCLK : in std_logic; -- SPI clock
25 | CS_N : in std_logic; -- SPI chip select, active in low
26 | MOSI : in std_logic; -- SPI serial data from master to slave
27 | MISO : out std_logic; -- SPI serial data from slave to master
28 | -- USER INTERFACE
29 | DIN : in std_logic_vector(WORD_SIZE-1 downto 0); -- data for transmission to SPI master
30 | DIN_VLD : in std_logic; -- when DIN_VLD = 1, data for transmission are valid
31 | DIN_RDY : out std_logic; -- when DIN_RDY = 1, SPI slave is ready to accept valid data for transmission
32 | DOUT : out std_logic_vector(WORD_SIZE-1 downto 0); -- received data from SPI master
33 | DOUT_VLD : out std_logic; -- when DOUT_VLD = 1, received data are valid
34 | CS_N_OUT : out std_logic
35 | );
36 | end entity;
37 |
38 | architecture RTL of SPI_SLAVE is
39 |
40 | constant BIT_CNT_WIDTH : natural := natural(ceil(log2(real(WORD_SIZE))));
41 |
42 | signal sclk_meta : std_logic;
43 | signal cs_n_meta : std_logic;
44 | signal mosi_meta : std_logic;
45 | signal sclk_reg : std_logic;
46 | signal cs_n_reg : std_logic;
47 | signal mosi_reg : std_logic;
48 | signal spi_clk_reg : std_logic;
49 | signal spi_clk_redge_en : std_logic;
50 | signal spi_clk_fedge_en : std_logic;
51 | signal bit_cnt : unsigned(BIT_CNT_WIDTH-1 downto 0);
52 | signal bit_cnt_max : std_logic;
53 | signal last_bit_en : std_logic;
54 | signal load_data_en : std_logic;
55 | signal data_shreg : std_logic_vector(WORD_SIZE-1 downto 0);
56 | signal slave_ready : std_logic;
57 | signal shreg_busy : std_logic;
58 | signal rx_data_vld : std_logic;
59 |
60 | begin
61 |
62 | -- -------------------------------------------------------------------------
63 | -- INPUT SYNCHRONIZATION REGISTERS
64 | -- -------------------------------------------------------------------------
65 |
66 | -- Synchronization registers to eliminate possible metastability.
67 | sync_ffs_p : process (CLK)
68 | begin
69 | if (rising_edge(CLK)) then
70 | sclk_meta <= SCLK;
71 | cs_n_meta <= CS_N;
72 | mosi_meta <= MOSI;
73 | sclk_reg <= sclk_meta;
74 | cs_n_reg <= cs_n_meta;
75 | mosi_reg <= mosi_meta;
76 | end if;
77 | end process;
78 |
79 | -- -------------------------------------------------------------------------
80 | -- SPI CLOCK REGISTER
81 | -- -------------------------------------------------------------------------
82 |
83 | -- The SPI clock register is necessary for clock edge detection.
84 | spi_clk_reg_p : process (CLK)
85 | begin
86 | if (rising_edge(CLK)) then
87 | if (RST = '1') then
88 | spi_clk_reg <= '0';
89 | else
90 | spi_clk_reg <= sclk_reg;
91 | end if;
92 | end if;
93 | end process;
94 |
95 | -- -------------------------------------------------------------------------
96 | -- SPI CLOCK EDGES FLAGS
97 | -- -------------------------------------------------------------------------
98 |
99 | -- Falling edge is detect when sclk_reg=0 and spi_clk_reg=1.
100 | spi_clk_fedge_en <= not sclk_reg and spi_clk_reg;
101 | -- Rising edge is detect when sclk_reg=1 and spi_clk_reg=0.
102 | spi_clk_redge_en <= sclk_reg and not spi_clk_reg;
103 |
104 | -- -------------------------------------------------------------------------
105 | -- RECEIVED BITS COUNTER
106 | -- -------------------------------------------------------------------------
107 |
108 | -- The counter counts received bits from the master. Counter is enabled when
109 | -- falling edge of SPI clock is detected and not asserted cs_n_reg.
110 | bit_cnt_p : process (CLK)
111 | begin
112 | if (rising_edge(CLK)) then
113 | if (RST = '1') then
114 | bit_cnt <= (others => '0');
115 | elsif (spi_clk_fedge_en = '1' and cs_n_reg = '0') then
116 | if (bit_cnt_max = '1') then
117 | bit_cnt <= (others => '0');
118 | else
119 | bit_cnt <= bit_cnt + 1;
120 | end if;
121 | end if;
122 | end if;
123 | end process;
124 |
125 | -- The flag of maximal value of the bit counter.
126 | bit_cnt_max <= '1' when (bit_cnt = WORD_SIZE-1) else '0';
127 |
128 | -- -------------------------------------------------------------------------
129 | -- LAST BIT FLAG REGISTER
130 | -- -------------------------------------------------------------------------
131 |
132 | -- The flag of last bit of received byte is only registered the flag of
133 | -- maximal value of the bit counter.
134 | last_bit_en_p : process (CLK)
135 | begin
136 | if (rising_edge(CLK)) then
137 | if (RST = '1') then
138 | last_bit_en <= '0';
139 | else
140 | last_bit_en <= bit_cnt_max;
141 | end if;
142 | end if;
143 | end process;
144 |
145 | -- -------------------------------------------------------------------------
146 | -- RECEIVED DATA VALID FLAG
147 | -- -------------------------------------------------------------------------
148 |
149 | -- Received data from master are valid when falling edge of SPI clock is
150 | -- detected and the last bit of received byte is detected.
151 | rx_data_vld <= spi_clk_fedge_en and last_bit_en;
152 |
153 | -- -------------------------------------------------------------------------
154 | -- SHIFT REGISTER BUSY FLAG REGISTER
155 | -- -------------------------------------------------------------------------
156 |
157 | -- Data shift register is busy until it sends all input data to SPI master.
158 | shreg_busy_p : process (CLK)
159 | begin
160 | if (rising_edge(CLK)) then
161 | if (RST = '1') then
162 | shreg_busy <= '0';
163 | else
164 | if (DIN_VLD = '1' and (cs_n_reg = '1' or rx_data_vld = '1')) then
165 | shreg_busy <= '1';
166 | elsif (rx_data_vld = '1') then
167 | shreg_busy <= '0';
168 | else
169 | shreg_busy <= shreg_busy;
170 | end if;
171 | end if;
172 | end if;
173 | end process;
174 |
175 | -- The SPI slave is ready for accept new input data when cs_n_reg is assert and
176 | -- shift register not busy or when received data are valid.
177 | slave_ready <= (cs_n_reg and not shreg_busy) or rx_data_vld;
178 |
179 | -- The new input data is loaded into the shift register when the SPI slave
180 | -- is ready and input data are valid.
181 | load_data_en <= slave_ready and DIN_VLD;
182 |
183 | -- -------------------------------------------------------------------------
184 | -- DATA SHIFT REGISTER
185 | -- -------------------------------------------------------------------------
186 |
187 | -- The shift register holds data for sending to master, capture and store
188 | -- incoming data from master.
189 | data_shreg_p : process (CLK)
190 | begin
191 | if (rising_edge(CLK)) then
192 | if (load_data_en = '1') then
193 | data_shreg <= DIN;
194 | elsif (spi_clk_redge_en = '1' and cs_n_reg = '0') then
195 | data_shreg <= data_shreg(WORD_SIZE-2 downto 0) & mosi_reg;
196 | end if;
197 | end if;
198 | end process;
199 |
200 | -- -------------------------------------------------------------------------
201 | -- MISO REGISTER
202 | -- -------------------------------------------------------------------------
203 |
204 | -- The output MISO register ensures that the bits are transmit to the master
205 | -- when is not assert cs_n_reg and falling edge of SPI clock is detected.
206 | miso_p : process (CLK)
207 | begin
208 | if (rising_edge(CLK)) then
209 | if (load_data_en = '1') then
210 | MISO <= DIN(WORD_SIZE-1);
211 | elsif (spi_clk_fedge_en = '1' and cs_n_reg = '0') then
212 | MISO <= data_shreg(WORD_SIZE-1);
213 | end if;
214 | end if;
215 | end process;
216 |
217 | -- -------------------------------------------------------------------------
218 | -- ASSIGNING OUTPUT SIGNALS
219 | -- -------------------------------------------------------------------------
220 |
221 | DIN_RDY <= slave_ready;
222 | DOUT <= data_shreg;
223 | DOUT_VLD <= rx_data_vld;
224 | CS_N_OUT <= cs_n_reg;
225 |
226 | end architecture;
227 |
--------------------------------------------------------------------------------
/fpga_logic/src/pci_core_wrapper.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- Entity: pci_core_wrapper
3 | -- Date:2016-06-03
4 | -- Author: grpa
5 | --
6 | -- Description:
7 | --------------------------------------------------------------------------------
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | use ieee.numeric_std.all;
11 |
12 | library ecp5um;
13 | use ecp5um.components.all;
14 | use work.pci_wrapper_pkg.all;
15 |
16 | package pci_core_wrapper_pkg is
17 |
18 | type t_pci_core_wrapper_in is record
19 | tx_tlp : t_tx_tlp_intf_d;
20 | rx_tlp : t_rx_tlp_intf_d;
21 | data_link : t_data_link_layer_d;
22 | transaction : t_transaction_layer_d;
23 | cfg : t_config_reg_d;
24 | end record;
25 |
26 | type t_pci_core_wrapper_out is record
27 | tx_tlp : t_tx_tlp_intf_q;
28 | rx_tlp : t_rx_tlp_intf_q;
29 | phy : t_phy_layer_q;
30 | data_link : t_data_link_layer_q;
31 | cfg : t_config_reg_q;
32 | end record;
33 |
34 | end package pci_core_wrapper_pkg;
35 |
36 | library ieee;
37 | use ieee.std_logic_1164.all;
38 | use ieee.numeric_std.all;
39 | use work.pci_core_wrapper_pkg.all;
40 |
41 | entity pci_core_wrapper is
42 | port (
43 | pll_refclki : in std_logic;
44 | rxrefclk : in std_logic;
45 | no_pcie_train : in std_logic;
46 |
47 | pci_core_hdinn0 : in std_logic;
48 | pci_core_hdinp0 : in std_logic;
49 |
50 | pci_core_hdoutn0 : out std_logic;
51 | pci_core_hdoutp0 : out std_logic;
52 |
53 | pci_rst_n : in std_logic;
54 | sli_rst : in std_logic;
55 |
56 | sys_clk_125 : out std_logic;
57 |
58 | d : in t_pci_core_wrapper_in;
59 | q : out t_pci_core_wrapper_out
60 | );
61 | end pci_core_wrapper;
62 |
63 | architecture arch of pci_core_wrapper is
64 | begin
65 |
66 | pci_core_inst :entity work.pcie
67 | port map (
68 |
69 | pll_refclki => pll_refclki,
70 | rxrefclk => rxrefclk,
71 |
72 | rst_n => pci_rst_n,
73 | sli_rst => sli_rst,
74 | serdes_pdb => open,
75 | serdes_rst_dual_c => open,
76 | tx_pwrup_c => open,
77 | tx_serdes_rst_c => open,
78 | sys_clk_125 => sys_clk_125,
79 |
80 | flip_lanes => '0',
81 |
82 | hdinn0 => pci_core_hdinn0,
83 | hdinp0 => pci_core_hdinp0,
84 | hdoutn0 => pci_core_hdoutn0,
85 | hdoutp0 => pci_core_hdoutp0,
86 | -- TRANSMIT TLP INTERFACE
87 | tx_data_vc0 => d.tx_tlp.tx_data_vc0,
88 | tx_end_vc0 => d.tx_tlp.tx_end_vc0,
89 | tx_nlfy_vc0 => d.tx_tlp.tx_nlfy_vc0,
90 | tx_req_vc0 => d.tx_tlp.tx_req_vc0,
91 | tx_st_vc0 => d.tx_tlp.tx_st_vc0,
92 |
93 | tx_ca_cpld_vc0 => q.tx_tlp.tx_ca_cpld_vc0,
94 | tx_ca_cplh_vc0 => q.tx_tlp.tx_ca_cplh_vc0,
95 | tx_ca_npd_vc0 => q.tx_tlp.tx_ca_npd_vc0,
96 | tx_ca_nph_vc0 => q.tx_tlp.tx_ca_nph_vc0,
97 | tx_ca_pd_vc0 => q.tx_tlp.tx_ca_pd_vc0,
98 | tx_ca_ph_vc0 => q.tx_tlp.tx_ca_ph_vc0,
99 | tx_ca_cpl_recheck_vc0 => q.tx_tlp.tx_ca_cpl_recheck_vc0,
100 | tx_ca_p_recheck_vc0 => q.tx_tlp.tx_ca_p_recheck_vc0,
101 | tx_rdy_vc0 => q.tx_tlp.tx_rdy_vc0,
102 | -- RECEIVE TLP INTERFACE
103 | npd_buf_status_vc0 => d.rx_tlp.npd_buf_status_vc0,
104 | npd_processed_vc0 => d.rx_tlp.npd_processed_vc0,
105 | nph_buf_status_vc0 => d.rx_tlp.nph_buf_status_vc0,
106 | nph_processed_vc0 => d.rx_tlp.nph_processed_vc0,
107 | pd_buf_status_vc0 => d.rx_tlp.pd_buf_status_vc0,
108 | pd_processed_vc0 => d.rx_tlp.pd_processed_vc0,
109 | ph_buf_status_vc0 => d.rx_tlp.ph_buf_status_vc0,
110 | ph_processed_vc0 => d.rx_tlp.ph_processed_vc0,
111 | ur_np_ext => '0',-- d.rx_tlp.ur_np_ext,
112 | ur_p_ext => '0',-- d.rx_tlp.ur_p_ext,
113 | npd_num_vc0 => d.rx_tlp.npd_num_vc0,
114 | pd_num_vc0 => d.rx_tlp.pd_num_vc0,
115 |
116 | rx_data_vc0 => q.rx_tlp.rx_data_vc0,
117 | rx_bar_hit => q.rx_tlp.rx_bar_hit,
118 | rx_end_vc0 => q.rx_tlp.rx_end_vc0,
119 | rx_malf_tlp_vc0 => q.rx_tlp.rx_malf_tlp_vc0,
120 | rx_st_vc0 => q.rx_tlp.rx_st_vc0,
121 | rx_us_req_vc0 => q.rx_tlp.rx_us_req_vc0,
122 | -- CONFIGURATION REGISTERS
123 | inta_n => '1',--TODO d.cfg.inta_n,
124 | msi => d.cfg.msi,
125 | pme_status => '0',--d.cfg.pme_status,
126 |
127 | bus_num => q.cfg.bus_num,
128 | cmd_reg_out => q.cfg.cmd_reg_out,
129 | dev_cntl_out => q.cfg.dev_cntl_out,
130 | dev_num => q.cfg.dev_num,
131 | func_num => q.cfg.func_num,
132 | lnk_cntl_out => q.cfg.lnk_cntl_out,
133 | mm_enable => q.cfg.mm_enable,
134 | pm_power_state => q.cfg.pm_power_state,
135 | msi_enable => q.cfg.msi_enable,
136 | pme_en => q.cfg.pme_en,
137 | -- DATA LINK LAYER
138 | tx_dllp_val => "00",--d.data_link.tx_dllp_val,
139 | tx_pmtype => "000",--d.data_link.tx_pmtype,
140 | tx_vsd_data => (others=>'0'),--d.data_link.tx_vsd_data,
141 |
142 | dl_inactive => q.data_link.dl_inactive,
143 | dl_init => q.data_link.dl_init,
144 | dl_active => q.data_link.dl_active,
145 | dl_up => q.data_link.dl_up,
146 | tx_dllp_sent => q.data_link.tx_dllp_sent,
147 | rxdp_pmd_type => q.data_link.rxdp_pmd_type,
148 | rxdp_vsd_data => q.data_link.rxdp_vsd_data,
149 | rxdp_dllp_val => q.data_link.rxdp_dllp_val,
150 | -- TRANSACTION LAYER
151 | unexp_cmpln => d.transaction.unexp_cmpln,
152 | np_req_pend => '0',--d.transaction.np_req_pend,
153 | cmpln_tout => '0',--d.transaction.cmpln_tout,
154 | cmpltr_abort_np => '0',-- d.transaction.cmpltr_abort_np,
155 | cmpltr_abort_p => '0',-- d.transaction.cmpltr_abort_p,
156 | -- CONTROL AND STATUS
157 | no_pcie_train => no_pcie_train,--'1',--TODO set 0 to implementation
158 | force_lsm_active => '0',--TODO set 0 to implementation d.phy.force_lsm_active,
159 | force_rec_ei => '0',--d.phy.force_rec_ei,
160 | force_phy_status => '0',--d.phy.force_phy_status,
161 | force_disable_scr => '0',--d.phy.force_disable_scr,
162 | hl_snd_beacon => '0',--d.phy.hl_snd_beacon,
163 | hl_disable_scr => '0',--d.phy.hl_disable_scr,
164 | hl_gto_dis => '0',--d.phy.hl_gto_dis,
165 | hl_gto_det => '0',--d.phy.hl_gto_det,
166 | hl_gto_hrst => '0',--d.phy.hl_gto_hrst,
167 | hl_gto_l0stx => '0',--d.phy.hl_gto_l0stx,
168 | hl_gto_l0stxfts => '0',--d.phy.hl_gto_l0stxfts,
169 | hl_gto_l1 => '0',--d.phy.hl_gto_l1,
170 | hl_gto_l2 => '0',--d.phy.hl_gto_l2,
171 | hl_gto_lbk => '0',--d.phy.hl_gto_lbk,
172 | hl_gto_rcvry => '0',--d.phy.hl_gto_rcvry,
173 | hl_gto_cfg => '0',--d.phy.hl_gto_cfg,
174 | tx_lbk_kcntl => (others => '0'),--d.phy.tx_lbk_kcntl,
175 | tx_lbk_data => (others => '0'),--d.phy.tx_lbk_data,
176 |
177 | --------------------------------------------------------------------
178 | -- sci
179 | --------------------------------------------------------------------
180 | sci_wrdata => (others => '0'),
181 | sci_addr => (others => '0'),
182 | sci_rddata => open,
183 | sci_int => open,
184 | sci_en_dual => '0',
185 | sci_sel_dual => '0',
186 | sci_rd => '0',
187 | sci_wrn => '0',
188 | sci_sel => '0',
189 | sci_en => '0',
190 | --------------------------------------------------------------------
191 |
192 | phy_ltssm_state => q.phy.phy_ltssm_state,
193 | phy_pol_compliance => q.phy.phy_pol_compliance,
194 | tx_lbk_rdy => q.phy.tx_lbk_rdy,
195 | rx_lbk_kcntl => q.phy.rx_lbk_kcntl,
196 | rx_lbk_data => q.phy.rx_lbk_data
197 | );
198 |
199 |
200 | end arch;
201 |
202 |
--------------------------------------------------------------------------------
/hardware/main/pcie_analyzer/pcie_analyzer.kicad_pro:
--------------------------------------------------------------------------------
1 | {
2 | "board": {
3 | "design_settings": {
4 | "defaults": {
5 | "board_outline_line_width": 0.049999999999999996,
6 | "copper_line_width": 0.19999999999999998,
7 | "copper_text_italic": false,
8 | "copper_text_size_h": 1.5,
9 | "copper_text_size_v": 1.5,
10 | "copper_text_thickness": 0.3,
11 | "copper_text_upright": false,
12 | "courtyard_line_width": 0.049999999999999996,
13 | "dimension_precision": 4,
14 | "dimension_units": 3,
15 | "dimensions": {
16 | "arrow_length": 1270000,
17 | "extension_offset": 500000,
18 | "keep_text_aligned": true,
19 | "suppress_zeroes": false,
20 | "text_position": 0,
21 | "units_format": 1
22 | },
23 | "fab_line_width": 0.09999999999999999,
24 | "fab_text_italic": false,
25 | "fab_text_size_h": 1.0,
26 | "fab_text_size_v": 1.0,
27 | "fab_text_thickness": 0.15,
28 | "fab_text_upright": false,
29 | "other_line_width": 0.09999999999999999,
30 | "other_text_italic": false,
31 | "other_text_size_h": 1.0,
32 | "other_text_size_v": 1.0,
33 | "other_text_thickness": 0.15,
34 | "other_text_upright": false,
35 | "pads": {
36 | "drill": 1.02,
37 | "height": 1.37,
38 | "width": 1.37
39 | },
40 | "silk_line_width": 0.12,
41 | "silk_text_italic": false,
42 | "silk_text_size_h": 1.0,
43 | "silk_text_size_v": 1.0,
44 | "silk_text_thickness": 0.15,
45 | "silk_text_upright": false,
46 | "zones": {
47 | "45_degree_only": false,
48 | "min_clearance": 0.19999999999999998
49 | }
50 | },
51 | "diff_pair_dimensions": [],
52 | "drc_exclusions": [],
53 | "meta": {
54 | "filename": "board_design_settings.json",
55 | "version": 2
56 | },
57 | "rule_severities": {
58 | "annular_width": "error",
59 | "clearance": "error",
60 | "copper_edge_clearance": "error",
61 | "courtyards_overlap": "error",
62 | "diff_pair_gap_out_of_range": "error",
63 | "diff_pair_uncoupled_length_too_long": "error",
64 | "drill_out_of_range": "error",
65 | "duplicate_footprints": "warning",
66 | "extra_footprint": "warning",
67 | "footprint_type_mismatch": "error",
68 | "hole_clearance": "error",
69 | "hole_near_hole": "error",
70 | "invalid_outline": "error",
71 | "item_on_disabled_layer": "error",
72 | "items_not_allowed": "error",
73 | "length_out_of_range": "error",
74 | "malformed_courtyard": "error",
75 | "microvia_drill_out_of_range": "error",
76 | "missing_courtyard": "ignore",
77 | "missing_footprint": "warning",
78 | "net_conflict": "warning",
79 | "npth_inside_courtyard": "ignore",
80 | "padstack": "error",
81 | "pth_inside_courtyard": "ignore",
82 | "shorting_items": "error",
83 | "silk_over_copper": "warning",
84 | "silk_overlap": "warning",
85 | "skew_out_of_range": "error",
86 | "through_hole_pad_without_hole": "error",
87 | "too_many_vias": "error",
88 | "track_dangling": "warning",
89 | "track_width": "error",
90 | "tracks_crossing": "error",
91 | "unconnected_items": "error",
92 | "unresolved_variable": "error",
93 | "via_dangling": "warning",
94 | "zone_has_empty_net": "error",
95 | "zones_intersect": "error"
96 | },
97 | "rule_severitieslegacy_courtyards_overlap": true,
98 | "rule_severitieslegacy_no_courtyard_defined": false,
99 | "rules": {
100 | "allow_blind_buried_vias": false,
101 | "allow_microvias": false,
102 | "max_error": 0.005,
103 | "min_clearance": 0.0,
104 | "min_copper_edge_clearance": 0.024999999999999998,
105 | "min_hole_clearance": 0.25,
106 | "min_hole_to_hole": 0.25,
107 | "min_microvia_diameter": 0.19999999999999998,
108 | "min_microvia_drill": 0.09999999999999999,
109 | "min_silk_clearance": 0.0,
110 | "min_through_hole_diameter": 0.19999999999999998,
111 | "min_track_width": 0.09999999999999999,
112 | "min_via_annular_width": 0.049999999999999996,
113 | "min_via_diameter": 0.39999999999999997,
114 | "use_height_for_length_calcs": true
115 | },
116 | "track_widths": [
117 | 0.0,
118 | 0.205232
119 | ],
120 | "via_dimensions": [
121 | {
122 | "diameter": 0.0,
123 | "drill": 0.0
124 | },
125 | {
126 | "diameter": 0.45,
127 | "drill": 0.2
128 | }
129 | ],
130 | "zones_allow_external_fillets": false,
131 | "zones_use_no_outline": true
132 | },
133 | "layer_presets": []
134 | },
135 | "boards": [],
136 | "cvpcb": {
137 | "equivalence_files": []
138 | },
139 | "erc": {
140 | "erc_exclusions": [],
141 | "meta": {
142 | "version": 0
143 | },
144 | "pin_map": [
145 | [
146 | 0,
147 | 0,
148 | 0,
149 | 0,
150 | 0,
151 | 0,
152 | 1,
153 | 0,
154 | 0,
155 | 0,
156 | 0,
157 | 2
158 | ],
159 | [
160 | 0,
161 | 2,
162 | 0,
163 | 1,
164 | 0,
165 | 0,
166 | 1,
167 | 0,
168 | 2,
169 | 2,
170 | 2,
171 | 2
172 | ],
173 | [
174 | 0,
175 | 0,
176 | 0,
177 | 0,
178 | 0,
179 | 0,
180 | 1,
181 | 0,
182 | 1,
183 | 0,
184 | 1,
185 | 2
186 | ],
187 | [
188 | 0,
189 | 1,
190 | 0,
191 | 0,
192 | 0,
193 | 0,
194 | 1,
195 | 1,
196 | 2,
197 | 1,
198 | 1,
199 | 2
200 | ],
201 | [
202 | 0,
203 | 0,
204 | 0,
205 | 0,
206 | 0,
207 | 0,
208 | 1,
209 | 0,
210 | 0,
211 | 0,
212 | 0,
213 | 2
214 | ],
215 | [
216 | 0,
217 | 0,
218 | 0,
219 | 0,
220 | 0,
221 | 0,
222 | 0,
223 | 0,
224 | 0,
225 | 0,
226 | 0,
227 | 2
228 | ],
229 | [
230 | 1,
231 | 1,
232 | 1,
233 | 1,
234 | 1,
235 | 0,
236 | 1,
237 | 1,
238 | 1,
239 | 1,
240 | 1,
241 | 2
242 | ],
243 | [
244 | 0,
245 | 0,
246 | 0,
247 | 1,
248 | 0,
249 | 0,
250 | 1,
251 | 0,
252 | 0,
253 | 0,
254 | 0,
255 | 2
256 | ],
257 | [
258 | 0,
259 | 2,
260 | 1,
261 | 2,
262 | 0,
263 | 0,
264 | 1,
265 | 0,
266 | 2,
267 | 2,
268 | 2,
269 | 2
270 | ],
271 | [
272 | 0,
273 | 2,
274 | 0,
275 | 1,
276 | 0,
277 | 0,
278 | 1,
279 | 0,
280 | 2,
281 | 0,
282 | 0,
283 | 2
284 | ],
285 | [
286 | 0,
287 | 2,
288 | 1,
289 | 1,
290 | 0,
291 | 0,
292 | 1,
293 | 0,
294 | 2,
295 | 0,
296 | 0,
297 | 2
298 | ],
299 | [
300 | 2,
301 | 2,
302 | 2,
303 | 2,
304 | 2,
305 | 2,
306 | 2,
307 | 2,
308 | 2,
309 | 2,
310 | 2,
311 | 2
312 | ]
313 | ],
314 | "rule_severities": {
315 | "bus_definition_conflict": "error",
316 | "bus_entry_needed": "error",
317 | "bus_label_syntax": "error",
318 | "bus_to_bus_conflict": "error",
319 | "bus_to_net_conflict": "error",
320 | "different_unit_footprint": "error",
321 | "different_unit_net": "error",
322 | "duplicate_reference": "error",
323 | "duplicate_sheet_names": "error",
324 | "extra_units": "error",
325 | "global_label_dangling": "warning",
326 | "hier_label_mismatch": "error",
327 | "label_dangling": "error",
328 | "lib_symbol_issues": "warning",
329 | "multiple_net_names": "warning",
330 | "net_not_bus_member": "warning",
331 | "no_connect_connected": "warning",
332 | "no_connect_dangling": "warning",
333 | "pin_not_connected": "error",
334 | "pin_not_driven": "error",
335 | "pin_to_pin": "warning",
336 | "power_pin_not_driven": "error",
337 | "similar_labels": "warning",
338 | "unannotated": "error",
339 | "unit_value_mismatch": "error",
340 | "unresolved_variable": "error",
341 | "wire_dangling": "error"
342 | }
343 | },
344 | "libraries": {
345 | "pinned_footprint_libs": [],
346 | "pinned_symbol_libs": []
347 | },
348 | "meta": {
349 | "filename": "pcie_analyzer.kicad_pro",
350 | "version": 1
351 | },
352 | "net_settings": {
353 | "classes": [
354 | {
355 | "bus_width": 12.0,
356 | "clearance": 0.2032,
357 | "diff_pair_gap": 0.25,
358 | "diff_pair_via_gap": 0.25,
359 | "diff_pair_width": 0.2,
360 | "line_style": 0,
361 | "microvia_diameter": 0.3,
362 | "microvia_drill": 0.1,
363 | "name": "Default",
364 | "pcb_color": "rgba(0, 0, 0, 0.000)",
365 | "schematic_color": "rgba(0, 0, 0, 0.000)",
366 | "track_width": 0.2,
367 | "via_diameter": 0.4,
368 | "via_drill": 0.2,
369 | "wire_width": 6.0
370 | },
371 | {
372 | "bus_width": 12.0,
373 | "clearance": 0.2032,
374 | "diff_pair_gap": 0.25,
375 | "diff_pair_via_gap": 0.25,
376 | "diff_pair_width": 0.2,
377 | "line_style": 0,
378 | "microvia_diameter": 0.3,
379 | "microvia_drill": 0.1,
380 | "name": "Diff",
381 | "nets": [],
382 | "pcb_color": "rgba(0, 0, 0, 0.000)",
383 | "schematic_color": "rgba(0, 0, 0, 0.000)",
384 | "track_width": 0.205232,
385 | "via_diameter": 0.6,
386 | "via_drill": 0.2,
387 | "wire_width": 6.0
388 | },
389 | {
390 | "bus_width": 12.0,
391 | "clearance": 0.3,
392 | "diff_pair_gap": 0.25,
393 | "diff_pair_via_gap": 0.25,
394 | "diff_pair_width": 0.2,
395 | "line_style": 0,
396 | "microvia_diameter": 0.3,
397 | "microvia_drill": 0.1,
398 | "name": "Single endet 50",
399 | "nets": [],
400 | "pcb_color": "rgba(0, 0, 0, 0.000)",
401 | "schematic_color": "rgba(0, 0, 0, 0.000)",
402 | "track_width": 0.29337,
403 | "via_diameter": 0.6,
404 | "via_drill": 0.2,
405 | "wire_width": 6.0
406 | }
407 | ],
408 | "meta": {
409 | "version": 2
410 | },
411 | "net_colors": null
412 | },
413 | "pcbnew": {
414 | "last_paths": {
415 | "gencad": "",
416 | "idf": "",
417 | "netlist": "pcie_analyzer.net",
418 | "specctra_dsn": "",
419 | "step": "",
420 | "vrml": ""
421 | },
422 | "page_layout_descr_file": ""
423 | },
424 | "schematic": {
425 | "annotate_start_num": 0,
426 | "drawing": {
427 | "default_line_thickness": 6.0,
428 | "default_text_size": 50.0,
429 | "field_names": [],
430 | "intersheets_ref_own_page": false,
431 | "intersheets_ref_prefix": "",
432 | "intersheets_ref_short": false,
433 | "intersheets_ref_show": false,
434 | "intersheets_ref_suffix": "",
435 | "junction_size_choice": 3,
436 | "label_size_ratio": 0.25,
437 | "pin_symbol_size": 0.0,
438 | "text_offset_ratio": 0.08
439 | },
440 | "legacy_lib_dir": "",
441 | "legacy_lib_list": [],
442 | "meta": {
443 | "version": 1
444 | },
445 | "net_format_name": "Pcbnew",
446 | "ngspice": {
447 | "fix_include_paths": true,
448 | "fix_passive_vals": false,
449 | "meta": {
450 | "version": 0
451 | },
452 | "model_mode": 0,
453 | "workbook_filename": ""
454 | },
455 | "page_layout_descr_file": "",
456 | "plot_directory": "",
457 | "spice_adjust_passive_values": false,
458 | "spice_external_command": "spice \"%I\"",
459 | "subpart_first_id": 65,
460 | "subpart_id_separator": 0
461 | },
462 | "sheets": [],
463 | "text_variables": {}
464 | }
465 |
--------------------------------------------------------------------------------
/fpga_logic/src/controller.vhd:
--------------------------------------------------------------------------------
1 | --------------------------------------------------------------------------------
2 | -- Entity: controller
3 | -- Date: 27 Aug 2021
4 | -- Author: GRPA
5 | --
6 | -- Description: brief
7 | --------------------------------------------------------------------------------
8 | library ieee;
9 | use ieee.std_logic_1164.all;
10 | use ieee.numeric_std.all;
11 | use work.analyzer_pkg.all;
12 |
13 | package controller_pkg is
14 |
15 |
16 | type t_controller_in is record
17 | -- user spi interface
18 | cs_n : std_logic;
19 | data_in : std_logic_vector (7 downto 0);
20 | data_in_vld : std_logic;
21 | data_out_rdy : std_logic;
22 |
23 | -- memory 1 interface
24 | u_mem_data_in : std_logic_vector (35 downto 0);
25 | -- memory 2 interface
26 | mem_data_in : std_logic_vector (35 downto 0);
27 |
28 | -- controller interface
29 | los : std_logic_vector (1 downto 0);
30 | rx_cdr_lol_s : std_logic_vector (1 downto 0);
31 | lsm_status : std_logic_vector (1 downto 0);
32 | rxstatus0 : std_logic_vector (1 downto 0);
33 | rxstatus1 : std_logic_vector (1 downto 0);
34 | trig_run : std_logic;
35 | controller_in : t_intf_controller_i;
36 | end record;
37 |
38 | type t_controller_out is record
39 | -- user spi interface
40 | data_out : std_logic_vector (7 downto 0);
41 | data_out_vld : std_logic;
42 |
43 | -- memory interface
44 | mem_select : std_logic;
45 | addr_read : std_logic_vector (15 downto 0);
46 |
47 | -- controller interface
48 | controller_out : t_intf_controller_o;
49 | end record;
50 | end package;
51 |
52 | library ieee;
53 | use ieee.std_logic_1164.all;
54 | use ieee.std_logic_unsigned.all;
55 | use ieee.numeric_std.all;
56 | use work.controller_pkg.all;
57 |
58 | use work.analyzer_pkg.all;
59 |
60 | entity controller is
61 | port (
62 | clk : in std_logic; -- input clock, xx MHz.
63 | rst : in std_logic;
64 | d : in t_controller_in;
65 | q : out t_controller_out
66 | );
67 | end controller;
68 |
69 | architecture arch of controller is
70 |
71 | type t_state is (IDLE, CMD_ST, ADDR_ST, TRANSFER_ST, WR_REG_ST);
72 | type reg_t is record
73 | -- TODO: ADDR REGISTERS HERE
74 | state : t_state;
75 | cmd_r : std_logic_vector (7 downto 0);
76 | read_memory : std_logic;
77 | read_register : std_logic;
78 | mem_select : std_logic;
79 | next_byte : std_logic;
80 | cs_n_d : std_logic;
81 | din_rdy_d : std_logic;
82 | byte_counter : std_logic_vector (7 downto 0);
83 |
84 | data_out : std_logic_vector (7 downto 0);
85 | data_out_vld : std_logic;
86 |
87 | read_addr : std_logic_vector (17 downto 0);
88 | mem_data : std_logic_vector (31 downto 0);
89 | mem_ext_data : std_logic_vector (7 downto 0);
90 |
91 | trigger_start : std_logic;
92 | trigger_stop : std_logic;
93 | -- register set
94 |
95 | intf_controller : t_intf_controller_o;
96 |
97 | end record reg_t;
98 |
99 | constant REG_T_INIT : reg_t := (
100 | state => IDLE,
101 | cmd_r => (others => '0'),
102 | read_memory => '0',
103 | read_register => '0',
104 | mem_select => '0',
105 | next_byte => '0',
106 | cs_n_d => '0',
107 | din_rdy_d => '0',
108 | byte_counter => (others => '0'),
109 |
110 | data_out => (others => '0'),
111 | data_out_vld => '0',
112 |
113 | read_addr => (others => '0'),
114 | mem_data => (others => '0'),
115 | mem_ext_data => (others => '0'),
116 |
117 | trigger_start => '0',
118 | trigger_stop => '0',
119 |
120 | intf_controller => INTF_CONTROLLER_O
121 | );
122 |
123 | signal r, rin : reg_t;
124 |
125 | begin
126 |
127 | comb : process (r, d) is
128 | variable v: reg_t;
129 | begin
130 | v := r;
131 | v.cs_n_d := d.cs_n;
132 | v.din_rdy_d := d.data_out_rdy;
133 | if d.data_out_rdy = '1' then
134 | v.data_out_vld := '0';
135 | end if;
136 |
137 | v.trigger_start := '0';
138 | v.trigger_stop := '0';
139 |
140 | case r.state is
141 | when IDLE =>
142 | -- wait for falling edge of cs_n
143 | if d.cs_n = '0' and r.cs_n_d = '1' then
144 | -- when first command comes
145 | if r.read_memory = '0' and r.read_register = '0' then
146 | v.state := CMD_ST;
147 | end if;
148 | -- when read memory after command
149 | if r.read_memory = '1' or r.read_register = '1' then
150 | v.state := TRANSFER_ST;
151 | end if;
152 | end if;
153 | when CMD_ST =>
154 | -- first byte is command
155 | v.read_addr := (others => '0');
156 | if d.data_in_vld = '1' then
157 | v.state := ADDR_ST; -- next byte after command is address
158 | v.cmd_r := d.data_in; -- save command for using in other states
159 | end if;
160 | when ADDR_ST =>
161 | case r.cmd_r is
162 | when C_WRITE_REG_CMD => -- write register
163 | if d.data_in_vld = '1' then
164 | v.read_addr(7 downto 0) := d.data_in;
165 | v.state := WR_REG_ST;
166 | end if;
167 | when C_READ_REG_CMD => -- read register
168 | if d.data_in_vld = '1' then
169 | if r.byte_counter = X"01" then -- register address
170 | v.mem_select := d.data_in(0);
171 | end if;
172 | end if;
173 | if d.cs_n = '1' then -- end of spi transfer
174 | v.read_register := '1';
175 | v.state := IDLE;
176 | end if;
177 | when C_READ_MEM => -- read memory
178 | if d.data_in_vld = '1' then
179 | case r.byte_counter is
180 | when X"01" => -- memory select
181 | v.mem_select := d.data_in(0);
182 | when X"02" => -- low address
183 | v.read_addr(15 downto 8) := d.data_in;
184 | when X"03" => -- high address
185 | v.read_addr(7 downto 0) := d.data_in;
186 | when others =>
187 | end case;
188 | end if;
189 | if d.cs_n = '1' then -- end of spi transfer
190 | v.read_memory := '1';
191 | v.state := IDLE;
192 | end if;
193 | when others =>
194 | end case;
195 | when TRANSFER_ST => -- read registers state
196 | if d.cs_n = '1' then
197 | v.state := IDLE;
198 | v.read_memory := '0';
199 | v.read_register := '0';
200 | end if;
201 | when WR_REG_ST =>
202 | if d.data_in_vld = '1' then
203 | v.read_addr(7 downto 0) := r.read_addr(7 downto 0) + 1;
204 | case r.read_addr(7 downto 0) is
205 | when C_CONFIG_REG => -- READ ONLY
206 | v.intf_controller.start_trig := d.data_in(0);
207 | v.intf_controller.stop_trig := d.data_in(1);
208 | v.intf_controller.reset_o := d.data_in(7);
209 | when C_CONFIG_TLP =>
210 | v.intf_controller.filter_in.tlp_save := d.data_in(0);
211 | when C_CONFIG_DLLP =>
212 | v.intf_controller.filter_in.dllp_save := d.data_in(0);
213 | when C_CONFIG_ORDSET =>
214 | v.intf_controller.filter_in.order_set_save := d.data_in(0);
215 | when others =>
216 | end case;
217 | end if;
218 | if d.cs_n = '1' then -- end of spi transfer
219 | v.state := IDLE;
220 | end if;
221 | when others =>
222 | end case;
223 |
224 | -- read controller registers
225 | if r.read_register = '1' then
226 | if d.cs_n = '0' then
227 | -- increment address by read_rdy or falling edge on cs_n
228 | if (d.data_out_rdy = '1' or r.cs_n_d = '1') then
229 | v.read_addr := std_logic_vector(unsigned(r.read_addr) + 1);
230 | end if;
231 | end if;
232 | -- address mux
233 | case r.read_addr(7 downto 0) is
234 | -- when C_CONFIG_REG => -- READ ONLY
235 | -- v.data_out := X"01";
236 | when C_STATUS_REG_0 =>
237 | v.data_out := d.trig_run & d.rxstatus0 & d.rxstatus1 & "000";
238 | when C_STATUS_REG_1 =>
239 | v.data_out := d.lsm_status & d.rx_cdr_lol_s & d.los & "00";
240 | when C_CONFIG_TLP =>
241 | v.data_out := "0000000" & r.intf_controller.filter_in.tlp_save;
242 | when C_CONFIG_DLLP =>
243 | v.data_out := "0000000" & r.intf_controller.filter_in.dllp_save;
244 | when C_CONFIG_ORDSET =>
245 | v.data_out := "0000000" & r.intf_controller.filter_in.order_set_save;
246 | when C_MEM_AMNT_1_LO =>
247 | v.data_out := d.controller_in.data_amount_0(7 downto 0);
248 | when C_MEM_AMNT_1_HI =>
249 | v.data_out := d.controller_in.data_amount_0(15 downto 8);
250 | when C_MEM_AMNT_2_LO =>
251 | v.data_out := d.controller_in.data_amount_1(7 downto 0);
252 | when C_MEM_AMNT_2_HI =>
253 | v.data_out := d.controller_in.data_amount_1(15 downto 8);
254 | when others =>
255 | v.data_out := X"00";
256 | end case;
257 | end if;
258 |
259 | -- read memory
260 | if r.read_memory = '1' then
261 | if d.cs_n = '0' then
262 | -- increment address by read_rdy or falling edge on cs_n
263 | if (d.data_out_rdy = '1' or r.cs_n_d = '1') then
264 | v.read_addr := std_logic_vector(unsigned(r.read_addr) + 1);
265 | -- shift register for timestamp bit
266 | if r.read_addr(1 downto 0) = "00" then
267 | v.mem_ext_data(6 downto 0) := r.mem_ext_data(7 downto 1);
268 | v.mem_ext_data(7) := d.mem_data_in(35);
269 | end if;
270 | end if;
271 | end if;
272 | -- first 32 bytes are data
273 | if r.byte_counter < 31 then
274 | case r.read_addr(1 downto 0) is
275 | when "00" => v.data_out := d.mem_data_in (34 downto 27);
276 | when "01" => v.data_out := d.mem_data_in (25 downto 18);
277 | when "10" => v.data_out := d.mem_data_in (16 downto 9);
278 | when "11" => v.data_out := d.mem_data_in (7 downto 0);
279 | when others =>
280 | end case;
281 | -- last byte Nr.33 is timestamp flag register
282 | else
283 | v.data_out := r.mem_ext_data;
284 | end if;
285 | end if;
286 |
287 | -- byte counter
288 | if d.cs_n = '0'then
289 | if d.data_in_vld = '1' and r.din_rdy_d = '0' then
290 | v.byte_counter := std_logic_vector(unsigned(r.byte_counter) + 1);
291 | end if;
292 | else
293 | v.byte_counter := (others => '0');
294 | end if;
295 |
296 | if r.read_memory = '1' or r.read_register = '1' then
297 | v.data_out_vld := '1';
298 | else
299 | v.data_out_vld := '0';
300 | end if;
301 |
302 | rin <= v;
303 | end process comb;
304 |
305 | -- Register process
306 | regs : process (clk) is
307 | begin
308 | -- Synchronous reset
309 | if rising_edge(clk) then
310 | if rst = '1' then
311 | r <= REG_T_INIT;
312 | else
313 | r <= rin;
314 | end if;
315 | end if;
316 | end process regs;
317 |
318 | q.mem_select <= r.mem_select;
319 | q.data_out <= r.data_out;
320 | q.data_out_vld <= r.data_out_vld;
321 | q.addr_read <= r.read_addr(17 downto 2);
322 | q.controller_out <= r.intf_controller;
323 | end arch;
--------------------------------------------------------------------------------
/hardware/common/libs/pretty/HMC914LP4E.kicad_mod:
--------------------------------------------------------------------------------
1 | (module HMC914LP4E (layer F.Cu) (tedit 610F9211)
2 | (fp_text reference REF** (at 0 -3.5) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value SMT_24_ADI (at 0 4) (layer F.SilkS)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_circle (center -3.1557 -1.25) (end -3.1557 -1.25) (layer F.CrtYd) (width 0.05))
9 | (fp_line (start -1.631 2.254) (end -2.254 2.254) (layer F.CrtYd) (width 0.05))
10 | (fp_line (start -1.631 2.5588) (end -1.631 2.254) (layer F.CrtYd) (width 0.05))
11 | (fp_line (start 1.631 2.5588) (end -1.631 2.5588) (layer F.CrtYd) (width 0.05))
12 | (fp_line (start 1.631 2.254) (end 1.631 2.5588) (layer F.CrtYd) (width 0.05))
13 | (fp_line (start 2.254 2.254) (end 1.631 2.254) (layer F.CrtYd) (width 0.05))
14 | (fp_line (start 2.254 1.631) (end 2.254 2.254) (layer F.CrtYd) (width 0.05))
15 | (fp_line (start 2.5588 1.631) (end 2.254 1.631) (layer F.CrtYd) (width 0.05))
16 | (fp_line (start 2.5588 -1.631) (end 2.5588 1.631) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start 2.254 -1.631) (end 2.5588 -1.631) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start 2.254 -2.254) (end 2.254 -1.631) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start 1.631 -2.254) (end 2.254 -2.254) (layer F.CrtYd) (width 0.05))
20 | (fp_line (start 1.631 -2.5588) (end 1.631 -2.254) (layer F.CrtYd) (width 0.05))
21 | (fp_line (start -1.631 -2.5588) (end 1.631 -2.5588) (layer F.CrtYd) (width 0.05))
22 | (fp_line (start -1.631 -2.254) (end -1.631 -2.5588) (layer F.CrtYd) (width 0.05))
23 | (fp_line (start -2.254 -2.254) (end -1.631 -2.254) (layer F.CrtYd) (width 0.05))
24 | (fp_line (start -2.254 -1.631) (end -2.254 -2.254) (layer F.CrtYd) (width 0.05))
25 | (fp_line (start -2.5588 -1.631) (end -2.254 -1.631) (layer F.CrtYd) (width 0.05))
26 | (fp_line (start -2.5588 1.631) (end -2.5588 -1.631) (layer F.CrtYd) (width 0.05))
27 | (fp_line (start -2.254 1.631) (end -2.5588 1.631) (layer F.CrtYd) (width 0.05))
28 | (fp_line (start -2.254 2.254) (end -2.254 1.631) (layer F.CrtYd) (width 0.05))
29 | (fp_poly (pts (xy -1.4732 -1.4732) (xy 1.4732 -1.4732) (xy 1.4732 1.4732) (xy -1.4732 1.4732)) (layer F.Paste) (width 0.1))
30 | (fp_poly (pts (xy -1.4732 -1.4732) (xy 1.4732 -1.4732) (xy 1.4732 1.4732) (xy -1.4732 1.4732)) (layer F.Mask) (width 0.1))
31 | (fp_poly (pts (xy -1.4732 -1.4732) (xy 1.4732 -1.4732) (xy 1.4732 1.4732) (xy -1.4732 1.4732)) (layer F.Cu) (width 0.1))
32 | (fp_poly (pts (xy 0.559501 -2.558801) (xy 0.559501 -2.812801) (xy 0.940501 -2.812801) (xy 0.940501 -2.558801)) (layer F.SilkS) (width 0.1))
33 | (fp_poly (pts (xy 0.059499 2.558801) (xy 0.059499 2.812801) (xy 0.4405 2.812801) (xy 0.4405 2.558801)) (layer F.SilkS) (width 0.1))
34 | (fp_line (start -1.70974 -2.127) (end -2.127 -2.127) (layer F.SilkS) (width 0.12))
35 | (fp_line (start 2.127 -1.70974) (end 2.127 -2.127) (layer F.SilkS) (width 0.12))
36 | (fp_line (start 1.70974 2.127) (end 2.127 2.127) (layer F.SilkS) (width 0.12))
37 | (fp_line (start -2.127 1.70974) (end -2.127 2.127) (layer F.SilkS) (width 0.12))
38 | (fp_line (start -2 -2) (end -2 2) (layer F.Fab) (width 0.1))
39 | (fp_line (start 2 -2) (end -2 -2) (layer F.Fab) (width 0.1))
40 | (fp_line (start 2 2) (end 2 -2) (layer F.Fab) (width 0.1))
41 | (fp_line (start -2 2) (end 2 2) (layer F.Fab) (width 0.1))
42 | (fp_line (start -2.127 -2.127) (end -2.127 -1.70974) (layer F.SilkS) (width 0.12))
43 | (fp_line (start 2.127 -2.127) (end 1.70974 -2.127) (layer F.SilkS) (width 0.12))
44 | (fp_line (start 2.127 2.127) (end 2.127 1.70974) (layer F.SilkS) (width 0.12))
45 | (fp_line (start -2.127 2.127) (end -1.70974 2.127) (layer F.SilkS) (width 0.12))
46 | (fp_line (start 2 -1.4024) (end 2 -1.4024) (layer F.Fab) (width 0.1))
47 | (fp_line (start 2 -1.0976) (end 2 -1.4024) (layer F.Fab) (width 0.1))
48 | (fp_line (start 2 -1.0976) (end 2 -1.0976) (layer F.Fab) (width 0.1))
49 | (fp_line (start 2 -1.4024) (end 2 -1.0976) (layer F.Fab) (width 0.1))
50 | (fp_line (start 2 -0.9024) (end 2 -0.9024) (layer F.Fab) (width 0.1))
51 | (fp_line (start 2 -0.5976) (end 2 -0.9024) (layer F.Fab) (width 0.1))
52 | (fp_line (start 2 -0.5976) (end 2 -0.5976) (layer F.Fab) (width 0.1))
53 | (fp_line (start 2 -0.9024) (end 2 -0.5976) (layer F.Fab) (width 0.1))
54 | (fp_line (start 2 -0.4024) (end 2 -0.4024) (layer F.Fab) (width 0.1))
55 | (fp_line (start 2 -0.0976) (end 2 -0.4024) (layer F.Fab) (width 0.1))
56 | (fp_line (start 2 -0.0976) (end 2 -0.0976) (layer F.Fab) (width 0.1))
57 | (fp_line (start 2 -0.4024) (end 2 -0.0976) (layer F.Fab) (width 0.1))
58 | (fp_line (start 2 0.0976) (end 2 0.0976) (layer F.Fab) (width 0.1))
59 | (fp_line (start 2 0.4024) (end 2 0.0976) (layer F.Fab) (width 0.1))
60 | (fp_line (start 2 0.4024) (end 2 0.4024) (layer F.Fab) (width 0.1))
61 | (fp_line (start 2 0.0976) (end 2 0.4024) (layer F.Fab) (width 0.1))
62 | (fp_line (start 2 0.5976) (end 2 0.5976) (layer F.Fab) (width 0.1))
63 | (fp_line (start 2 0.9024) (end 2 0.5976) (layer F.Fab) (width 0.1))
64 | (fp_line (start 2 0.9024) (end 2 0.9024) (layer F.Fab) (width 0.1))
65 | (fp_line (start 2 0.5976) (end 2 0.9024) (layer F.Fab) (width 0.1))
66 | (fp_line (start 2 1.0976) (end 2 1.0976) (layer F.Fab) (width 0.1))
67 | (fp_line (start 2 1.4024) (end 2 1.0976) (layer F.Fab) (width 0.1))
68 | (fp_line (start 2 1.4024) (end 2 1.4024) (layer F.Fab) (width 0.1))
69 | (fp_line (start 2 1.0976) (end 2 1.4024) (layer F.Fab) (width 0.1))
70 | (fp_line (start 1.4024 2) (end 1.4024 2) (layer F.Fab) (width 0.1))
71 | (fp_line (start 1.0976 2) (end 1.4024 2) (layer F.Fab) (width 0.1))
72 | (fp_line (start 1.0976 2) (end 1.0976 2) (layer F.Fab) (width 0.1))
73 | (fp_line (start 1.4024 2) (end 1.0976 2) (layer F.Fab) (width 0.1))
74 | (fp_line (start 0.9024 2) (end 0.9024 2) (layer F.Fab) (width 0.1))
75 | (fp_line (start 0.5976 2) (end 0.9024 2) (layer F.Fab) (width 0.1))
76 | (fp_line (start 0.5976 2) (end 0.5976 2) (layer F.Fab) (width 0.1))
77 | (fp_line (start 0.9024 2) (end 0.5976 2) (layer F.Fab) (width 0.1))
78 | (fp_line (start 0.4024 2) (end 0.4024 2) (layer F.Fab) (width 0.1))
79 | (fp_line (start 0.0976 2) (end 0.4024 2) (layer F.Fab) (width 0.1))
80 | (fp_line (start 0.0976 2) (end 0.0976 2) (layer F.Fab) (width 0.1))
81 | (fp_line (start 0.4024 2) (end 0.0976 2) (layer F.Fab) (width 0.1))
82 | (fp_line (start -0.0976 2) (end -0.0976 2) (layer F.Fab) (width 0.1))
83 | (fp_line (start -0.4024 2) (end -0.0976 2) (layer F.Fab) (width 0.1))
84 | (fp_line (start -0.4024 2) (end -0.4024 2) (layer F.Fab) (width 0.1))
85 | (fp_line (start -0.0976 2) (end -0.4024 2) (layer F.Fab) (width 0.1))
86 | (fp_line (start -0.5976 2) (end -0.5976 2) (layer F.Fab) (width 0.1))
87 | (fp_line (start -0.9024 2) (end -0.5976 2) (layer F.Fab) (width 0.1))
88 | (fp_line (start -0.9024 2) (end -0.9024 2) (layer F.Fab) (width 0.1))
89 | (fp_line (start -0.5976 2) (end -0.9024 2) (layer F.Fab) (width 0.1))
90 | (fp_line (start -1.0976 2) (end -1.0976 2) (layer F.Fab) (width 0.1))
91 | (fp_line (start -1.4024 2) (end -1.0976 2) (layer F.Fab) (width 0.1))
92 | (fp_line (start -1.4024 2) (end -1.4024 2) (layer F.Fab) (width 0.1))
93 | (fp_line (start -1.0976 2) (end -1.4024 2) (layer F.Fab) (width 0.1))
94 | (fp_line (start -2 1.4024) (end -2 1.4024) (layer F.Fab) (width 0.1))
95 | (fp_line (start -2 1.0976) (end -2 1.4024) (layer F.Fab) (width 0.1))
96 | (fp_line (start -2 1.0976) (end -2 1.0976) (layer F.Fab) (width 0.1))
97 | (fp_line (start -2 1.4024) (end -2 1.0976) (layer F.Fab) (width 0.1))
98 | (fp_line (start -2 0.9024) (end -2 0.9024) (layer F.Fab) (width 0.1))
99 | (fp_line (start -2 0.5976) (end -2 0.9024) (layer F.Fab) (width 0.1))
100 | (fp_line (start -2 0.5976) (end -2 0.5976) (layer F.Fab) (width 0.1))
101 | (fp_line (start -2 0.9024) (end -2 0.5976) (layer F.Fab) (width 0.1))
102 | (fp_line (start -2 0.4024) (end -2 0.4024) (layer F.Fab) (width 0.1))
103 | (fp_line (start -2 0.0976) (end -2 0.4024) (layer F.Fab) (width 0.1))
104 | (fp_line (start -2 0.0976) (end -2 0.0976) (layer F.Fab) (width 0.1))
105 | (fp_line (start -2 0.4024) (end -2 0.0976) (layer F.Fab) (width 0.1))
106 | (fp_line (start -2 -0.0976) (end -2 -0.0976) (layer F.Fab) (width 0.1))
107 | (fp_line (start -2 -0.4024) (end -2 -0.0976) (layer F.Fab) (width 0.1))
108 | (fp_line (start -2 -0.4024) (end -2 -0.4024) (layer F.Fab) (width 0.1))
109 | (fp_line (start -2 -0.0976) (end -2 -0.4024) (layer F.Fab) (width 0.1))
110 | (fp_line (start -2 -0.5976) (end -2 -0.5976) (layer F.Fab) (width 0.1))
111 | (fp_line (start -2 -0.9024) (end -2 -0.5976) (layer F.Fab) (width 0.1))
112 | (fp_line (start -2 -0.9024) (end -2 -0.9024) (layer F.Fab) (width 0.1))
113 | (fp_line (start -2 -0.5976) (end -2 -0.9024) (layer F.Fab) (width 0.1))
114 | (fp_line (start -2 -1.0976) (end -2 -1.0976) (layer F.Fab) (width 0.1))
115 | (fp_line (start -2 -1.4024) (end -2 -1.0976) (layer F.Fab) (width 0.1))
116 | (fp_line (start -2 -1.4024) (end -2 -1.4024) (layer F.Fab) (width 0.1))
117 | (fp_line (start -2 -1.0976) (end -2 -1.4024) (layer F.Fab) (width 0.1))
118 | (fp_line (start -1.4024 -2) (end -1.4024 -2) (layer F.Fab) (width 0.1))
119 | (fp_line (start -1.0976 -2) (end -1.4024 -2) (layer F.Fab) (width 0.1))
120 | (fp_line (start -1.0976 -2) (end -1.0976 -2) (layer F.Fab) (width 0.1))
121 | (fp_line (start -1.4024 -2) (end -1.0976 -2) (layer F.Fab) (width 0.1))
122 | (fp_line (start -0.9024 -2) (end -0.9024 -2) (layer F.Fab) (width 0.1))
123 | (fp_line (start -0.5976 -2) (end -0.9024 -2) (layer F.Fab) (width 0.1))
124 | (fp_line (start -0.5976 -2) (end -0.5976 -2) (layer F.Fab) (width 0.1))
125 | (fp_line (start -0.9024 -2) (end -0.5976 -2) (layer F.Fab) (width 0.1))
126 | (fp_line (start -0.4024 -2) (end -0.4024 -2) (layer F.Fab) (width 0.1))
127 | (fp_line (start -0.0976 -2) (end -0.4024 -2) (layer F.Fab) (width 0.1))
128 | (fp_line (start -0.0976 -2) (end -0.0976 -2) (layer F.Fab) (width 0.1))
129 | (fp_line (start -0.4024 -2) (end -0.0976 -2) (layer F.Fab) (width 0.1))
130 | (fp_line (start 0.0976 -2) (end 0.0976 -2) (layer F.Fab) (width 0.1))
131 | (fp_line (start 0.4024 -2) (end 0.0976 -2) (layer F.Fab) (width 0.1))
132 | (fp_line (start 0.4024 -2) (end 0.4024 -2) (layer F.Fab) (width 0.1))
133 | (fp_line (start 0.0976 -2) (end 0.4024 -2) (layer F.Fab) (width 0.1))
134 | (fp_line (start 0.5976 -2) (end 0.5976 -2) (layer F.Fab) (width 0.1))
135 | (fp_line (start 0.9024 -2) (end 0.5976 -2) (layer F.Fab) (width 0.1))
136 | (fp_line (start 0.9024 -2) (end 0.9024 -2) (layer F.Fab) (width 0.1))
137 | (fp_line (start 0.5976 -2) (end 0.9024 -2) (layer F.Fab) (width 0.1))
138 | (fp_line (start 1.0976 -2) (end 1.0976 -2) (layer F.Fab) (width 0.1))
139 | (fp_line (start 1.4024 -2) (end 1.0976 -2) (layer F.Fab) (width 0.1))
140 | (fp_line (start 1.4024 -2) (end 1.4024 -2) (layer F.Fab) (width 0.1))
141 | (fp_line (start 1.0976 -2) (end 1.4024 -2) (layer F.Fab) (width 0.1))
142 | (fp_line (start -2 -0.73) (end -0.73 -2) (layer F.Fab) (width 0.1))
143 | (fp_poly (pts (xy -1.70974 -2.127) (xy -2.2 -2.1) (xy -2.2 -1.7) (xy -2.7 -1.7)
144 | (xy -2.7 -2.5) (xy -1.7 -2.5)) (layer F.SilkS) (width 0.1))
145 | (pad 1 smd rect (at -1.949201 -1.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
146 | (pad 2 smd rect (at -1.949201 -0.750001 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
147 | (pad 3 smd rect (at -1.949201 -0.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
148 | (pad 4 smd rect (at -1.949201 0.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
149 | (pad 5 smd rect (at -1.949201 0.750001 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
150 | (pad 6 smd rect (at -1.949201 1.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
151 | (pad 7 smd rect (at -1.25 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
152 | (pad 8 smd rect (at -0.750001 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
153 | (pad 9 smd rect (at -0.25 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
154 | (pad 10 smd rect (at 0.25 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
155 | (pad 11 smd rect (at 0.750001 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
156 | (pad 12 smd rect (at 1.25 1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
157 | (pad 13 smd rect (at 1.949201 1.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
158 | (pad 14 smd rect (at 1.949201 0.750001 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
159 | (pad 15 smd rect (at 1.949201 0.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
160 | (pad 16 smd rect (at 1.949201 -0.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
161 | (pad 17 smd rect (at 1.949201 -0.750001 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
162 | (pad 18 smd rect (at 1.949201 -1.25 90) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
163 | (pad 19 smd rect (at 1.25 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
164 | (pad 20 smd rect (at 0.750001 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
165 | (pad 21 smd rect (at 0.25 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
166 | (pad 22 smd rect (at -0.25 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
167 | (pad 23 smd rect (at -0.750001 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
168 | (pad 24 smd rect (at -1.25 -1.949201) (size 0.254 0.7112) (layers F.Cu F.Paste F.Mask))
169 | (model ${KIPRJMOD}/../../common/libs/3dshapes/SMT_24_ADI.step
170 | (at (xyz 0 0 0))
171 | (scale (xyz 1 1 1))
172 | (rotate (xyz 0 0 0))
173 | )
174 | )
175 |
--------------------------------------------------------------------------------