Commit 2339aa4f authored by Alexey Grebenkin's avatar Alexey Grebenkin

add small service utilities

parent e3394574
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* Due to lack of functionality of gtxe2_gpl project as compared to the xilinx's primitive, * Due to lack of functionality of gtxe2_gpl project as compared to the xilinx's primitive,
* not all of the inputs are used and not all of the outputs are driven. * not all of the inputs are used and not all of the outputs are driven.
**/ **/
`include "gtxe2_chnl.v" //`include "gtxe2_chnl.v"
module GTXE2_CHANNEL( module GTXE2_CHANNEL(
// clocking ports, UG476 p.37 // clocking ports, UG476 p.37
input [2:0] CPLLREFCLKSEL, input [2:0] CPLLREFCLKSEL,
...@@ -148,11 +148,12 @@ module GTXE2_CHANNEL( ...@@ -148,11 +148,12 @@ module GTXE2_CHANNEL(
output TXOUTCLKPCS, output TXOUTCLKPCS,
output TXRATEDONE, output TXRATEDONE,
// TX Phase Interpolator PPM Controller Ports, ug476 p.154 // TX Phase Interpolator PPM Controller Ports, ug476 p.154
input TXPIPPMEN, // GTH only
/* input TXPIPPMEN,
input TXPIPPMOVRDEN, input TXPIPPMOVRDEN,
input TXPIPPMSEL, input TXPIPPMSEL,
input TXPIPPMPD, input TXPIPPMPD,
input [4:0] TXPIPPMSTEPSIZE, input [4:0] TXPIPPMSTEPSIZE,*/
// TX Configurable Driver Ports, ug476 p.156 // TX Configurable Driver Ports, ug476 p.156
input [2:0] TXBUFDIFFCTRL, input [2:0] TXBUFDIFFCTRL,
input TXDEEMPH, input TXDEEMPH,
...@@ -374,11 +375,12 @@ parameter RXPRBS_ERR_LOOPBACK = 1'b0; ...@@ -374,11 +375,12 @@ parameter RXPRBS_ERR_LOOPBACK = 1'b0;
// TX Fabric Clock Output Control Attributes, ug476 p. 153 // TX Fabric Clock Output Control Attributes, ug476 p. 153
parameter TXBUF_RESET_ON_RATE_CHANGE = "TRUE"; parameter TXBUF_RESET_ON_RATE_CHANGE = "TRUE";
// TX Phase Interpolator PPM Controller Attributes, ug476 p.155 // TX Phase Interpolator PPM Controller Attributes, ug476 p.155
parameter TXPI_SYNCFREQ_PPM = 3'b001; // GTH only
/*parameter TXPI_SYNCFREQ_PPM = 3'b001;
parameter TXPI_PPM_CFG = 8'd0; parameter TXPI_PPM_CFG = 8'd0;
parameter TXPI_INVSTROBE_SEL = 1'b0; parameter TXPI_INVSTROBE_SEL = 1'b0;
parameter TXPI_GREY_SEL = 1'b0; parameter TXPI_GREY_SEL = 1'b0;
parameter TXPI_PPMCLK_SEL = "12345"; parameter TXPI_PPMCLK_SEL = "12345";*/
// TX Configurable Driver Attributes, ug476 p.162 // TX Configurable Driver Attributes, ug476 p.162
parameter TX_DEEMPH0 = 5'b10100; parameter TX_DEEMPH0 = 5'b10100;
parameter TX_DEEMPH1 = 5'b01101; parameter TX_DEEMPH1 = 5'b01101;
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "gtxe2_chnl_clocking.v" //`include "gtxe2_chnl_clocking.v"
`include "gtxe2_chnl_tx.v" //`include "gtxe2_chnl_tx.v"
`include "gtxe2_chnl_rx.v" //`include "gtxe2_chnl_rx.v"
module gtxe2_chnl( module gtxe2_chnl(
input wire reset, input wire reset,
/* /*
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "gtxe2_chnl_cpll_inmux.v" //`include "gtxe2_chnl_cpll_inmux.v"
`include "gtxe2_chnl_outclk_mux.v" //`include "gtxe2_chnl_outclk_mux.v"
`include "gtxe2_chnl_cpll.v" //`include "gtxe2_chnl_cpll.v"
`include "clock_divider.v" //`include "clock_divider.v"
module gtxe2_chnl_clocking( module gtxe2_chnl_clocking(
// top-level interfaces // top-level interfaces
input wire [2:0] CPLLREFCLKSEL, input wire [2:0] CPLLREFCLKSEL,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "gtxe2_chnl_cpll_def.v" //`include "gtxe2_chnl_cpll_def.v"
module gtxe2_chnl_cpll( module gtxe2_chnl_cpll(
// top-level interfaces // top-level interfaces
input wire CPLLLOCKDETCLK, input wire CPLLLOCKDETCLK,
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
/** /**
* For now contains only deserializer, oob, 10x8 decoder, aligner and polarity invertor blocks * For now contains only deserializer, oob, 10x8 decoder, aligner and polarity invertor blocks
**/ **/
`include "gtxe2_chnl_rx_des.v" //`include "gtxe2_chnl_rx_des.v"
`include "gtxe2_chnl_rx_oob.v" //`include "gtxe2_chnl_rx_oob.v"
`include "gtxe2_chnl_rx_10x8dec.v" //`include "gtxe2_chnl_rx_10x8dec.v"
`include "gtxe2_chnl_rx_align.v" //`include "gtxe2_chnl_rx_align.v"
module gtxe2_chnl_rx( module gtxe2_chnl_rx(
input wire reset, input wire reset,
input wire RXP, input wire RXP,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "resync_fifo_nonsynt.v" //`include "resync_fifo_nonsynt.v"
module gtxe2_chnl_rx_des #( module gtxe2_chnl_rx_des #(
parameter [31:0] width = 20 parameter [31:0] width = 20
) )
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "gtxe2_chnl_tx_ser.v" //`include "gtxe2_chnl_tx_ser.v"
`include "gtxe2_chnl_tx_8x10enc.v" //`include "gtxe2_chnl_tx_8x10enc.v"
`include "gtxe2_chnl_tx_oob.v" //`include "gtxe2_chnl_tx_oob.v"
module gtxe2_chnl_tx( module gtxe2_chnl_tx(
input wire reset, input wire reset,
output wire TXP, output wire TXP,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`include "resync_fifo_nonsynt.v" //`include "resync_fifo_nonsynt.v"
module gtxe2_chnl_tx_ser #( module gtxe2_chnl_tx_ser #(
parameter [31:0] width = 20 parameter [31:0] width = 20
) )
......
#!/usr/bin/python
import sys
import os
import re
list_of_dirs = ['tb', 'gtxe2_channel']
for directory in list_of_dirs:
path_to_dir = sys.argv[1] + '/' + directory
for filename in os.listdir(path_to_dir):
if re.search(r'\.v$', filename) and os.path.isfile(path_to_dir + '/' + filename):
rfile = open(path_to_dir + '/' + filename, 'r')
lines = []
for line in rfile:
lines.append(re.sub(r'`include ', r'//`include ', line))
rfile.close()
wfile = open(path_to_dir + '/' + filename, 'w')
for line in lines:
wfile.write(line)
wfile.close()
#!/usr/bin/python
import sys
import re
import datetime
path_to_channel = sys.argv[1];
wfile = open(path_to_channel + '/../GTXE2_CHANNEL.v', 'w')
now = datetime.datetime.now()
header = \
'''/*******************************************************************************
* Module: GTXE2_CHANNEL
* Date: ''' + '%d-%02d-%02d' % (now.year, now.month, now.day) + '''
* Author: Alexey
* Description: emulates GTXE2_CHANNEL primitive behaviour.
* The file is gathered from multiple files
*
* Copyright (c) 2015 Elphel, Inc.
* GTXE2_CHANNEL.v is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GTXE2_CHANNEL.v file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/
'''
wfile.write(header)
def goToInclude(filename):
filedesc = open(path_to_channel + filename, 'r')
if re.search(r'_def.v$', filename):
header = 0
else:
header = 1
for line in filedesc:
# clean a header
if header:
if re.search(r'\*\*\*\*\*\*\*\/', line):
header = 0
else:
# go to included file
matches = re.search(r'`include +\"(.*)\"', line)
if matches:
goToInclude(matches.group(1))
else:
wfile.write(line)
wfile.write('\n')
filedesc.close()
goToInclude('GTXE2_CHANNEL_GPL.v')
wfile.close()
#!/usr/bin/python
import sys
import os
import re
list_of_dirs = ['tb', 'gtxe2_channel']
for directory in list_of_dirs:
path_to_dir = sys.argv[1] + '/' + directory
for filename in os.listdir(path_to_dir):
if re.search(r'\.v$', filename) and os.path.isfile(path_to_dir + '/' + filename):
rfile = open(path_to_dir + '/' + filename, 'r')
lines = []
for line in rfile:
lines.append(re.sub(r'//`include ', r'`include ', line))
rfile.close()
wfile = open(path_to_dir + '/' + filename, 'w')
for line in lines:
wfile.write(line)
wfile.close()
#!/bin/bash
LOGFILE_PATH="bld.log"
rm a.out
if [ "$GTX_PATH" == '' ]
then
GTX_PATH=".."
fi
iverilog $GTX_PATH/tb/tb.v -I$GTX_PATH/ -I$GTX_PATH/gtxe2_channel/ -I$GTX_PATH/gtxe2_common/ -I$GTX_PATH/tb/ -stb $1 2>&1| tee $LOGFILE_PATH
#!/bin/bash
if [ ! -z "$1" ]
then
SAV_FILE=$1
else
SAV_FILE="save.gtkw"
fi
./build #-pfileline=1
./simul
if [ $? != 0 ]
then
echo "BUILD FAILED"
exit
fi
gtkwave test.vcd $SAV_FILE &> waves.log &
echo all done
#!/bin/bash
LOGFILE_PATH="sim.log"
/usr/local/bin/vvp a.out -v $1 #2>&1 | tee $LOGFILE_PATH
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/> . * along with this program. If not, see <http://www.gnu.org/licenses/> .
*******************************************************************************/ *******************************************************************************/
`timescale 1ps/1ps `timescale 1ps/1ps
`include "GTXE2_CHANNEL_GPL.v" //`include "GTXE2_CHANNEL.v"
`include "test.v" //`include "test.v"
module tb(); module tb();
wire reset; wire reset;
wire TXP; wire TXP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment