Changeset 101 for trunk


Ignore:
Timestamp:
Mar 12, 2010, 11:59:48 AM (14 years ago)
Author:
demin
Message:

add exposure counter

Location:
trunk/MultiChannelUSB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MultiChannelUSB/Paella.qsf

    r90 r101  
    5656set_global_assignment -name VERILOG_FILE control.v
    5757set_global_assignment -name VERILOG_FILE analyser.v
     58set_global_assignment -name VERILOG_FILE counter.v
    5859set_global_assignment -name VERILOG_FILE histogram.v
    5960set_global_assignment -name VERILOG_FILE trigger.v
  • trunk/MultiChannelUSB/Paella.v

    r90 r101  
    104104        );
    105105               
     106        wire                    ana_dead [N-1:0];
    106107        wire                    ana_good [N-1:0];
    107108        wire    [11:0]  ana_data [N-1:0];
    108109        wire    [11:0]  ana_base [N-1:0];
    109110
     111        wire                    cnt_good [N-1:0];
     112
    110113        wire    [11:0]  osc_mux_data [N-1:0];
    111114
     
    119122        wire    [11:0]  adc_data [N-1:0];
    120123    wire        [11:0]  int_data [N-1:0];
     124    wire        [11:0]  sys_data [N-1:0];
    121125    wire        [11:0]  cmp_data;
    122126        wire    [11:0]  nowhere;
     
    146150                .adc_data(adc_data[2]));
    147151*/
    148 /*
     152
    149153        wire                    adc_pll_clk;
    150154
     155/*
    151156        adc_pll adc_pll_unit(
    152157                .inclk0(ADC_FCO),
     
    154159*/
    155160
     161        sys_pll sys_pll_unit(
     162                .inclk0(CLK_50MHz),
     163                .c0(sys_clock));
     164
    156165        test test_unit(
    157166                .clk(ADC_FCO),
    158 //              .data(adc_data[2]));
    159                 .data(nowhere));
     167                .data(adc_data[2]));
     168//              .data(nowhere));
    160169
    161170        adc_lvds #(
     
    166175                .lvds_fco(ADC_FCO),
    167176                .lvds_d(ADC_D[2:0]),
    168                 .adc_data({     adc_data[2],
    169 //              .adc_data({     nowhere,
     177//              .adc_data({     adc_data[2],
     178                .adc_data({     nowhere,
    170179                                        adc_data[1],
    171180                                        adc_data[0] }));
    172                                        
     181
     182/*                                     
    173183        assign                  cmp_data = CON_B[11:0];
    174184        assign                  sys_clock = ADC_DCO;
    175185        assign                  sys_frame = ADC_FCO;
    176 
    177         wire    [15:0]  cfg_bits [15:0];
    178         wire    [255:0] int_cfg_bits;
     186*/
     187
     188        wire    [15:0]  cfg_bits [31:0];
     189        wire    [511:0] int_cfg_bits;
    179190
    180191        wire    [31:0]  cfg_mux_selector;
     
    182193        wire                    cfg_reset;
    183194
    184         wire    [7:0]   bus_ssel;
     195        wire    [8:0]   bus_ssel;
    185196        wire                    bus_wren;
    186197        wire    [31:0]  bus_addr;
    187198        wire    [15:0]  bus_mosi;
    188         wire    [15:0]  bus_miso [5:0];
    189         wire    [5:0]   bus_busy;
     199        wire    [15:0]  bus_miso [7:0];
     200        wire    [8:0]   bus_busy;
    190201
    191202        wire    [15:0]  mrg_bus_miso;
    192203        wire                    mrg_bus_busy;
    193204
    194         wire    [79:0]  int_bus_miso;
     205        wire    [127:0] int_bus_miso;
    195206
    196207        genvar j;
    197208
    198209        generate
    199                 for (j = 0; j < 16; j = j + 1)
     210                for (j = 0; j < 32; j = j + 1)
    200211                begin : CONFIGURATION_OUTPUT
    201212                        assign cfg_bits[j] = int_cfg_bits[j*16+15:j*16];
     
    208219                .bus_ssel(bus_ssel[0]),
    209220                .bus_wren(bus_wren),
    210                 .bus_addr(bus_addr[3:0]),
     221                .bus_addr(bus_addr[4:0]),
    211222                .bus_mosi(bus_mosi),
    212223                .bus_miso(bus_miso[0]),
     
    224235                                uwt_a2[j][17:6],
    225236                                uwt_a1[j][14:3],
    226                                 adc_data[j]};
     237                                sys_data[j]};
    227238                end
    228239        endgenerate
    229240
    230         assign cfg_mux_selector = {cfg_bits[11], cfg_bits[10]};
     241        assign cfg_mux_selector = {cfg_bits[3], cfg_bits[2]};
    231242
    232243        lpm_mux #(
     
    258269                .clock(sys_clock),
    259270                .frame(sys_frame),
    260                 .reset(cfg_bits[12][14]),
    261                 .cfg_data(cfg_bits[12][11:0]),
     271                .reset(cfg_bits[0][0]),
     272                .cfg_data(cfg_bits[5][11:0]),
    262273                .trg_data(trg_mux_data),
    263274                .trg_flag(trg_flag));
     
    266277                .clock(sys_clock),
    267278                .frame(sys_frame),
    268                 .reset(cfg_bits[12][13]),
    269                 .cfg_data({cfg_bits[12][12], cfg_bits[13]}),
     279                .reset(cfg_bits[0][1]),
     280                .cfg_data(cfg_bits[4][0]),
    270281                .trg_flag(trg_flag),
    271282                .osc_data({cmp_data, osc_mux_data[2], osc_mux_data[1], osc_mux_data[0]}),
     
    280291                .bus_busy(bus_busy[1]));
    281292
     293
     294        adc_fifo #(.W(48)) adc_fifo_unit (
     295                .adc_clock(ADC_FCO),
     296                .adc_data({CON_B[11:0], adc_data[2], adc_data[1], adc_data[0]}),
     297                .sys_clock(sys_clock),
     298                .sys_frame(sys_frame),
     299                .sys_data({cmp_data, int_data[2], int_data[1], int_data[0]}));
     300
     301
    282302        generate
    283303                for (j = 0; j < 3; j = j + 1)
    284304                begin : MCA_CHAIN
    285305
    286                         assign int_data[j] = (cfg_bits[0][4*j]) ? (adc_data[j] ^ 12'hfff) : (adc_data[j]);
     306                        assign sys_data[j] = (cfg_bits[1][4*j]) ? (int_data[j] ^ 12'hfff) : (int_data[j]);
    287307
    288308                        uwt_bior31 #(.L(1)) uwt_1_unit (
     
    290310                                .frame(sys_frame),
    291311                                .reset(1'b0),
    292                                 .x({20'h00000, int_data[j]}),
     312                                .x({20'h00000, sys_data[j]}),
    293313                                .d(uwt_d1[j]),
    294314                                .a(uwt_a1[j]),
     
    319339                                .clock(sys_clock),
    320340                                .frame(sys_frame),
    321                                 .reset(cfg_bits[2+2*j][12]),
    322                                 .cfg_data({cfg_bits[2+2*j][11:0], cfg_bits[1+2*j][12:0]}),
     341                                .reset(cfg_bits[0][2+j]),
     342                                .cfg_data({cfg_bits[7+2*j][12:0], cfg_bits[6+2*j][11:0]}),
    323343                                .uwt_flag(uwt_flag3[j]),
    324344                                .uwt_data(uwt_peak3[j]),
     345                                .ana_dead(ana_dead[j]),
    325346                                .ana_good(ana_good[j]),
    326347                                .ana_data(ana_data[j]),
     
    330351                                .clock(sys_clock),
    331352                                .frame(sys_frame),
    332                                 .reset(cfg_bits[7+j][13]),
    333                                 .cfg_data(cfg_bits[7+j][12:0]),
    334                                 .hst_good(ana_good[j]),
     353                                .reset(cfg_bits[0][5+j]),
     354                                .hst_good((ana_good[j]) & (cnt_good[j])),
    335355                                .hst_data(ana_data[j]),
    336356                                .bus_ssel(bus_ssel[2+j]),
     
    341361                                .bus_busy(bus_busy[2+j]));
    342362
     363                        counter counter_unit (
     364                                .clock(sys_clock),
     365                                .frame((sys_frame) & (~ana_dead[j])),
     366                                .reset(cfg_bits[0][8+j]),
     367                                .cfg_data(cfg_bits[12+j]),
     368                                .bus_ssel(bus_ssel[5+j]),
     369                                .bus_wren(bus_wren),
     370                                .bus_addr(bus_addr[1:0]),
     371                                .bus_mosi(bus_mosi),
     372                                .bus_miso(bus_miso[5+j]),
     373                                .bus_busy(bus_busy[5+j]),
     374                                .cnt_good(cnt_good[j]));
     375
    343376                end
    344377        endgenerate
     
    357390                .i2c_scl(I2C_SDA),
    358391               
    359                 .bus_ssel(bus_ssel[5]),
     392                .bus_ssel(bus_ssel[8]),
    360393                .bus_wren(bus_wren),
    361394                .bus_mosi(bus_mosi),
    362                 .bus_busy(bus_busy[5]));
     395                .bus_busy(bus_busy[8]));
    363396
    364397        generate
    365                 for (j = 0; j < 5; j = j + 1)
     398                for (j = 0; j < 8; j = j + 1)
    366399                begin : BUS_OUTPUT
    367400                        assign int_bus_miso[j*16+15:j*16] = bus_miso[j];
     
    370403
    371404        lpm_mux #(
    372                 .lpm_size(5),
     405                .lpm_size(8),
    373406                .lpm_type("LPM_MUX"),
    374407                .lpm_width(16),
     
    379412
    380413        lpm_mux #(
    381                 .lpm_size(6),
     414                .lpm_size(9),
    382415                .lpm_type("LPM_MUX"),
    383416                .lpm_width(1),
    384                 .lpm_widths(3)) bus_busy_mux_unit (
    385                 .sel(bus_addr[30:28]),
     417                .lpm_widths(4)) bus_busy_mux_unit (
     418                .sel(bus_addr[31:28]),
    386419                .data(bus_busy),
    387420                .result(mrg_bus_busy));
     
    397430
    398431        lpm_decode #(
    399                 .lpm_decodes(8),
     432                .lpm_decodes(9),
    400433                .lpm_type("LPM_DECODE"),
    401                 .lpm_width(3)) lpm_decode_unit (
    402                 .data(bus_addr[30:28]),
     434                .lpm_width(4)) lpm_decode_unit (
     435                .data(bus_addr[31:28]),
    403436                .eq(bus_ssel),
    404437                .aclr(),
Note: See TracChangeset for help on using the changeset viewer.