// automatically generated by
// perl intercon.pl ../source/register-map ../source/vxi_if.v ../source/route_fcm.v ../source/config_rom.v ../source/ds1822_driver.v ../source/sporty.v ../source/dds.v ../source/sync_free.v ../source/shadow_ram.v ../source/totalizer.v ../source/feedforward.v ../source/rf_timer.v ../source/history2e.v ../source/mult_controller.v ../source/fdbk_loop.v ../source/afterburner.v ../source/status.v ../source/stopwatch.v -o llrf_fcm.v
// processing file ../source/vxi_if.v
// processing file ../source/route_fcm.v
// processing file ../source/config_rom.v
// processing file ../source/ds1822_driver.v
// processing file ../source/sporty.v
// processing file ../source/dds.v
// processing file ../source/sync_free.v
// processing file ../source/shadow_ram.v
// processing file ../source/totalizer.v
// processing file ../source/feedforward.v
// processing file ../source/rf_timer.v
// processing file ../source/history2e.v
// processing file ../source/mult_controller.v
// processing file ../source/fdbk_loop.v
// processing file ../source/afterburner.v
// processing file ../source/status.v
// processing file ../source/stopwatch.v
`timescale 1ns / 1ns
module llrf_fcm
(
// module vxi_if
inout [15:0] QB,
input [3:0] HC,
input RESET,
input [13:0] PCI_AD,
input CLK40X,
output PCI_INTA_N,
output VHOLD,
output [15:0] IA,
output [15:0] QA,
output [15:0] IB,
output [15:0] QC,
// module route_fcm
output [7:0] TTLTRIG,
input LRC_1,
input LRC_2,
input PREPULSE,
input RF_ON,
// module ds1822_driver
inout DS_DFE,
inout DS_FCM,
inout DS_RFO,
inout DS_AFE,
// module sporty
output AMC_CLK,
output AMC_SDI,
output AMC_CS,
input AMC_SDO,
output AMC_RST,
output PLL_CLK,
output PLL_DATA,
output PLL_LE,
input PLL_MUXOUT,
// module rf_timer
output LED3,
output LED4,
// module history2e
input [`RAW_ADC_BITS-1:0] DA,
input [`RAW_ADC_BITS-1:0] DB,
input [`RAW_ADC_BITS-1:0] DC,
input [`RAW_ADC_BITS-1:0] DD,
// module afterburner
input CLK80X,
output [11:0] DE,
// module status
output LED2
);
// wires:
wire clk40; // vxi_if dds sync_free totalizer feedforward rf_timer history2e fdbk_loop afterburner status stopwatch
wire clk40_missing_pulse; // status
wire [15:0] config_rom__read_bus; // to read mux
wire daov_; // route_fcm status
wire dbov_; // route_fcm status
wire dcov_; // route_fcm status
wire ddov_; // route_fcm status
wire dds_run; // dds rf_timer
wire dds_substitute; // rf_timer fdbk_loop
wire [21:0] dkcm_bus; // dkcm_controller fdbk_loop afterburner
wire dkcm_busy; // dkcm_controller status
wire dkcm_controller__select; // select
wire ds1822_driver__cntl_sel; // select
wire ds1822_driver__data_sel; // select
wire [15:0] ds1822_driver__read_data; // to read mux
wire [13:0] fdbk_input; // history2e fdbk_loop
wire feedback_enable; // rf_timer fdbk_loop
wire [15:0] feedforward__host_dout; // to read mux
wire feedforward__select; // select
wire [12:0] feedforward_data; // feedforward fdbk_loop
wire feedforward_start; // feedforward rf_timer
wire [14:0] history2e__dcnt_at_pulse_end; // to read mux
wire [15:0] history2e__trace1_dout; // to read mux
wire [15:0] history2e__trace2_dout; // to read mux
wire [15:0] history2e__trace3_dout; // to read mux
wire [15:0] history2e__traced_dout; // to read mux
wire [14:0] history2e__ucnt_at_pulse_end; // to read mux
wire [13:0] host_addr; // vxi_if config_rom shadow_ram totalizer feedforward rf_timer history2e dkcm_controller stopwatch
wire host_clk; // vxi_if ds1822_driver sporty shadow_ram feedforward rf_timer history2e dkcm_controller fdbk_loop afterburner status stopwatch
wire [15:0] host_data; // vxi_if ds1822_driver sporty shadow_ram feedforward rf_timer dkcm_controller status stopwatch
wire host_interrupt; // vxi_if rf_timer
wire host_re; // vxi_if status
wire [15:0] host_read; // vxi_if
wire host_we; // vxi_if ds1822_driver sporty shadow_ram feedforward rf_timer dkcm_controller status stopwatch
wire il_stat_; // route_fcm status
wire integrate_enable; // rf_timer fdbk_loop
wire [1:0] lrc_slot; // route_fcm status
wire [11:0] outsig40; // history2e fdbk_loop afterburner
wire phase_sense_adjust; // rf_timer
wire pll_muxout_; // sporty status
wire power_down; // rf_timer
wire quad_sync; // sync_free rf_timer
wire rf_kill_; // rf_timer
wire rf_on_; // route_fcm rf_timer
wire rf_on_sync; // rf_timer status stopwatch
wire [15:0] rf_timer__host_read; // to read mux
wire rf_timer__hselect; // select
wire rst; // vxi_if ds1822_driver totalizer rf_timer history2e
wire [15:0] set_wave; // dds fdbk_loop
wire [15:0] shadow_ram__read_bus; // to read mux
wire shadow_ram__select; // select
wire [15:0] sporty__data; // to read mux
wire sporty__select_cntl; // select
wire sporty__select_data; // select
wire [15:0] sporty__status; // to read mux
wire status__error_en; // select
wire [15:0] status__errors; // to read mux
wire [15:0] status__status; // to read mux
wire stopwatch__control_sel; // select
wire [15:0] stopwatch__readout; // to read mux
wire sync_error; // sync_free status
wire sync_missing; // sync_free status
wire [15:0] totalizer__dout; // to read mux
wire totalizer_channel; // rf_timer history2e
wire totalizer_gate; // totalizer rf_timer
wire [13:0] totalizer_in; // totalizer history2e
wire trace_enable; // rf_timer history2e status
wire trigger_skipped; // rf_timer status
wire [15:0] vxi_if__int_status; // to read mux
wire vxi_if__int_status_en; // select
// regs:
reg [15:0] dds__set_i;
reg [15:0] dds__set_q;
reg [15:0] dds__freq;
reg [15:0] rf_timer__totalizer_delay;
reg [15:0] rf_timer__config_word;
reg [14:0] history2e__ustop_count;
reg [15:0] history2e__uhistory_config;
reg [14:0] history2e__dstop_count;
reg [15:0] history2e__dhistory_config;
// instantiations:
vxi_if vxi_if(
.QB(QB),
.HC(HC),
.RESET(RESET),
.PCI_AD(PCI_AD),
.CLK40X(CLK40X),
.PCI_INTA_N(PCI_INTA_N),
.VHOLD(VHOLD),
.IA(IA),
.QA(QA),
.IB(IB),
.QC(QC),
.clk40(clk40),
.host_clk(host_clk),
.host_addr(host_addr),
.host_data(host_data),
.host_read(host_read),
.host_we(host_we),
.host_re(host_re),
.rst(rst),
.host_interrupt(host_interrupt),
.int_status(vxi_if__int_status),
.int_status_en(vxi_if__int_status_en)
);
route_fcm route_fcm(
.TTLTRIG(TTLTRIG),
.LRC_1(LRC_1),
.LRC_2(LRC_2),
.PREPULSE(PREPULSE),
.RF_ON(RF_ON),
.rf_on_(rf_on_),
.daov_(daov_),
.dbov_(dbov_),
.dcov_(dcov_),
.ddov_(ddov_),
.lrc_slot(lrc_slot),
.il_stat_(il_stat_)
);
config_rom config_rom(
.host_addr(host_addr),
.read_bus(config_rom__read_bus)
);
ds1822_driver ds1822_driver(
.DS_DFE(DS_DFE),
.DS_FCM(DS_FCM),
.DS_RFO(DS_RFO),
.DS_AFE(DS_AFE),
.read_data(ds1822_driver__read_data),
.host_clk(host_clk),
.host_we(host_we),
.data_sel(ds1822_driver__data_sel),
.cntl_sel(ds1822_driver__cntl_sel),
.host_data(host_data),
.rst(rst)
);
sporty sporty(
.host_clk(host_clk),
.host_we(host_we),
.host_data(host_data),
.data(sporty__data),
.status(sporty__status),
.select_data(sporty__select_data),
.select_cntl(sporty__select_cntl),
.pll_muxout_(pll_muxout_),
.AMC_CLK(AMC_CLK),
.AMC_SDI(AMC_SDI),
.AMC_CS(AMC_CS),
.AMC_SDO(AMC_SDO),
.AMC_RST(AMC_RST),
.PLL_CLK(PLL_CLK),
.PLL_DATA(PLL_DATA),
.PLL_LE(PLL_LE),
.PLL_MUXOUT(PLL_MUXOUT)
);
dds dds(
.set_i(dds__set_i),
.set_q(dds__set_q),
.freq(dds__freq),
.clk40(clk40),
.dds_run(dds_run),
.set_wave(set_wave)
);
sync_free sync_free(
.clk40(clk40),
.quad_sync(quad_sync),
.sync_error(sync_error),
.sync_missing(sync_missing)
);
shadow_ram shadow_ram(
.host_clk(host_clk),
.host_we(host_we),
.host_addr(host_addr),
.select(shadow_ram__select),
.host_data(host_data),
.read_bus(shadow_ram__read_bus)
);
totalizer totalizer(
.host_addr(host_addr),
.dout(totalizer__dout),
.totalizer_in(totalizer_in),
.rst(rst),
.clk40(clk40),
.totalizer_gate(totalizer_gate)
);
feedforward feedforward(
.host_clk(host_clk),
.host_addr(host_addr),
.host_we(host_we),
.host_data(host_data),
.host_dout(feedforward__host_dout),
.select(feedforward__select),
.clk40(clk40),
.feedforward_start(feedforward_start),
.feedforward_data(feedforward_data)
);
rf_timer rf_timer(
.rst(rst),
.host_clk(host_clk),
.host_addr(host_addr),
.host_we(host_we),
.host_data(host_data),
.host_read(rf_timer__host_read),
.hselect(rf_timer__hselect),
.clk40(clk40),
.quad_sync(quad_sync),
.rf_on_sync(rf_on_sync),
.totalizer_delay(rf_timer__totalizer_delay),
.config_word(rf_timer__config_word),
.feedback_enable(feedback_enable),
.integrate_enable(integrate_enable),
.feedforward_start(feedforward_start),
.host_interrupt(host_interrupt),
.trace_enable(trace_enable),
.trigger_skipped(trigger_skipped),
.totalizer_gate(totalizer_gate),
.dds_run(dds_run),
.dds_substitute(dds_substitute),
.totalizer_channel(totalizer_channel),
.phase_sense_adjust(phase_sense_adjust),
.rf_on_(rf_on_),
.rf_kill_(rf_kill_),
.power_down(power_down),
.LED3(LED3),
.LED4(LED4)
);
history2e history2e(
.rst(rst),
.host_clk(host_clk),
.host_addr(host_addr),
.traced_dout(history2e__traced_dout),
.trace1_dout(history2e__trace1_dout),
.trace2_dout(history2e__trace2_dout),
.trace3_dout(history2e__trace3_dout),
.clk40(clk40),
.DA(DA),
.DB(DB),
.DC(DC),
.DD(DD),
.outsig40(outsig40),
.fdbk_input(fdbk_input),
.totalizer_channel(totalizer_channel),
.totalizer_in(totalizer_in),
.ustop_count(history2e__ustop_count),
.uhistory_config(history2e__uhistory_config),
.dstop_count(history2e__dstop_count),
.dhistory_config(history2e__dhistory_config),
.ucnt_at_pulse_end(history2e__ucnt_at_pulse_end),
.dcnt_at_pulse_end(history2e__dcnt_at_pulse_end),
.trace_enable(trace_enable)
);
dkcm_controller dkcm_controller(
.host_clk(host_clk),
.host_addr(host_addr),
.host_we(host_we),
.select(dkcm_controller__select),
.host_data(host_data),
.dkcm_busy(dkcm_busy),
.dkcm_bus(dkcm_bus)
);
fdbk_loop fdbk_loop(
.fdbk_input(fdbk_input),
.set_wave(set_wave),
.dkcm_bus(dkcm_bus),
.host_clk(host_clk),
.feedback_enable(feedback_enable),
.integrate_enable(integrate_enable),
.feedforward_data(feedforward_data),
.clk40(clk40),
.dds_substitute(dds_substitute),
.outsig40(outsig40)
);
afterburner afterburner(
.clk40(clk40),
.dkcm_bus(dkcm_bus),
.host_clk(host_clk),
.outsig40(outsig40),
.CLK80X(CLK80X),
.DE(DE)
);
status status(
.host_clk(host_clk),
.host_re(host_re),
.host_we(host_we),
.host_data(host_data),
.errors(status__errors),
.status(status__status),
.error_en(status__error_en),
.clk40(clk40),
.trace_enable(trace_enable),
.dkcm_busy(dkcm_busy),
.pll_muxout_(pll_muxout_),
.trigger_skipped(trigger_skipped),
.rf_on_sync(rf_on_sync),
.sync_error(sync_error),
.sync_missing(sync_missing),
.clk40_missing_pulse(clk40_missing_pulse),
.daov_(daov_),
.dbov_(dbov_),
.dcov_(dcov_),
.ddov_(ddov_),
.lrc_slot(lrc_slot),
.il_stat_(il_stat_),
.LED2(LED2)
);
stopwatch stopwatch(
.host_clk(host_clk),
.host_we(host_we),
.control_sel(stopwatch__control_sel),
.host_data(host_data),
.host_addr(host_addr),
.readout(stopwatch__readout),
.clk40(clk40),
.rf_on_sync(rf_on_sync)
);
// regwrite:
always @(posedge host_clk or posedge rst) if (rst) begin
dds__set_i <= 0;
dds__set_q <= 0;
dds__freq <= 0;
rf_timer__totalizer_delay <= 0;
rf_timer__config_word <= 0;
history2e__ustop_count <= 0;
history2e__uhistory_config <= 0;
history2e__dstop_count <= 0;
history2e__dhistory_config <= 0;
end else begin
if (host_we & host_addr==14'b00000000100000) dds__set_i <= host_data;
if (host_we & host_addr==14'b00000000100001) dds__set_q <= host_data;
if (host_we & host_addr==14'b00000000100010) dds__freq <= host_data;
if (host_we & host_addr==14'b00000000101000) rf_timer__totalizer_delay <= host_data;
if (host_we & host_addr==14'b00000000100011) rf_timer__config_word <= host_data;
if (host_we & host_addr==14'b00000000100100) history2e__ustop_count <= host_data;
if (host_we & host_addr==14'b00000000100101) history2e__uhistory_config <= host_data;
if (host_we & host_addr==14'b00000000100110) history2e__dstop_count <= host_data;
if (host_we & host_addr==14'b00000000100111) history2e__dhistory_config <= host_data;
end
// selects:
assign vxi_if__int_status_en = (host_addr[13: 0]==14'b00000000010100);
assign ds1822_driver__data_sel = (host_addr[13: 0]==14'b00000001010010);
assign ds1822_driver__cntl_sel = (host_addr[13: 0]==14'b00000001010011);
assign sporty__select_data = (host_addr[13: 0]==14'b00000001011010);
assign sporty__select_cntl = (host_addr[13: 0]==14'b00000001011011);
assign shadow_ram__select = (host_addr[13: 5]== 9'b000000001 );
assign feedforward__select = (host_addr[13: 9]== 5'b00110 );
assign rf_timer__hselect = (host_addr[13: 3]==11'b00000011000 );
assign dkcm_controller__select = (host_addr[13: 3]==11'b00000000110 );
assign status__error_en = (host_addr[13: 0]==14'b00000000010000);
assign stopwatch__control_sel = (host_addr[13: 3]==11'b00000001100 );
// regread:
reg [15:0] host_read_pipe;
assign host_read = 0 |
feedforward__host_dout & {16{host_addr[13: 9]== 5'b00110 }} |
rf_timer__host_read & {16{host_addr[13: 3]==11'b00000011000 }} |
history2e__traced_dout & {16{host_addr[13: 9]== 5'b10000 }} |
history2e__trace1_dout & {16{host_addr[13: 9]== 5'b10100 }} |
history2e__trace2_dout & {16{host_addr[13: 9]== 5'b11000 }} |
history2e__trace3_dout & {16{host_addr[13: 9]== 5'b11100 }} |
host_read_pipe & {16{host_addr[13: 7]== 7'b0000000 }};
always @(posedge host_clk or posedge rst) if (rst) begin
host_read_pipe <= 0;
end else begin
host_read_pipe <= 0 |
vxi_if__int_status & {16{host_addr[13: 0]==14'b00000000010100}} |
config_rom__read_bus & {16{host_addr[13: 4]==10'b0000000000 }} |
ds1822_driver__read_data & {16{host_addr[13: 0]==14'b00000001010010}} |
sporty__data & {16{host_addr[13: 0]==14'b00000001011010}} |
sporty__status & {16{host_addr[13: 0]==14'b00000001011011}} |
shadow_ram__read_bus & {16{host_addr[13: 5]== 9'b000000001 }} |
totalizer__dout & {16{host_addr[13: 2]==12'b000000000111 }} |
history2e__ucnt_at_pulse_end & {16{host_addr[13: 0]==14'b00000000010010}} |
history2e__dcnt_at_pulse_end & {16{host_addr[13: 0]==14'b00000000010011}} |
status__errors & {16{host_addr[13: 0]==14'b00000000010000}} |
status__status & {16{host_addr[13: 0]==14'b00000000010001}} |
stopwatch__readout & {16{host_addr[13: 3]==11'b00000001100 }};
end
// 0 errors
endmodule