Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
redpitaya_guide/cores/axis_red_pitaya_adc_v1_0/axis_red_pitaya_adc.v
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 lines (38 sloc)
1.31 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`timescale 1 ns / 1 ps | |
module axis_red_pitaya_adc # | |
( | |
parameter integer ADC_DATA_WIDTH = 14, | |
parameter integer AXIS_TDATA_WIDTH = 32 | |
) | |
( | |
// System signals | |
output wire adc_clk, | |
// ADC signals | |
output wire adc_csn, | |
input wire adc_clk_p, | |
input wire adc_clk_n, | |
input wire [ADC_DATA_WIDTH-1:0] adc_dat_a, | |
input wire [ADC_DATA_WIDTH-1:0] adc_dat_b, | |
// Master side | |
output wire m_axis_tvalid, | |
output wire [AXIS_TDATA_WIDTH-1:0] m_axis_tdata | |
); | |
localparam PADDING_WIDTH = AXIS_TDATA_WIDTH/2 - ADC_DATA_WIDTH; | |
reg [ADC_DATA_WIDTH-1:0] int_dat_a_reg; | |
reg [ADC_DATA_WIDTH-1:0] int_dat_b_reg; | |
wire int_clk0; | |
wire int_clk; | |
IBUFGDS adc_clk_inst0 (.I(adc_clk_p), .IB(adc_clk_n), .O(int_clk0)); | |
BUFG adc_clk_inst (.I(int_clk0), .O(int_clk)); | |
always @(posedge int_clk) | |
begin | |
int_dat_a_reg <= adc_dat_a; | |
int_dat_b_reg <= adc_dat_b; | |
end | |
assign adc_clk = int_clk; | |
assign adc_csn = 1'b1; | |
assign m_axis_tvalid = 1'b1; | |
assign m_axis_tdata = { | |
{(PADDING_WIDTH+1){int_dat_b_reg[ADC_DATA_WIDTH-1]}}, ~int_dat_b_reg[ADC_DATA_WIDTH-2:0], | |
{(PADDING_WIDTH+1){int_dat_a_reg[ADC_DATA_WIDTH-1]}}, ~int_dat_a_reg[ADC_DATA_WIDTH-2:0]}; | |
endmodule |