Changeset 183
- Timestamp:
- Jan 24, 2014, 3:33:37 PM (11 years ago)
- Location:
- trunk/3DEES
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/3DEES/Paella.v
r182 r183 88 88 wire trg_flag; 89 89 90 wire [ 4*12-1:0] int_mux_data [N-1:0];90 wire [5*12-1:0] int_mux_data [N-1:0]; 91 91 92 92 wire [1:0] amp_flag [3*N-1:0]; … … 121 121 122 122 assign tmp_data = 12'd0; 123 /* 123 124 assign sys_clock = CLK_100MHz; 124 /* 125 */ 125 126 sys_pll sys_pll_unit( 126 127 .inclk0(CLK_100MHz), 127 128 .c0(sys_clock)); 128 */ 129 129 130 /* 130 131 sys_pll sys_pll_unit( … … 152 153 .adc_frame(sys_frame), 153 154 .adc_data({ 154 adc_data[5], adc_data[3], adc_data[ 2], // D3, D1, S2155 adc_data[ 4], adc_data[1], adc_data[0]})); // D2, S1_S, S1_F155 adc_data[5], adc_data[3], adc_data[4], // D3, D1, D2 156 adc_data[2], adc_data[1], adc_data[0]})); // S2, S1_S, S1_F 156 157 157 158 wire [15:0] cfg_bits [63:0]; … … 198 199 begin : MUX_DATA 199 200 assign int_mux_data[j] = { 200 // {6'd0, cls_data},201 201 // {4'd0, cls_flag, 7'd0}, 202 {6'd0, cls_data}, 202 203 {4'd0, amp_flag[j][0], 7'd0}, 203 204 amp_data[j][11:0], … … 211 212 212 213 lpm_mux #( 213 .lpm_size( 4*6),214 .lpm_size(5*6), 214 215 .lpm_type("LPM_MUX"), 215 216 .lpm_width(12), … … 226 227 227 228 lpm_mux #( 228 .lpm_size( 4*6),229 .lpm_size(5*6), 229 230 .lpm_type("LPM_MUX"), 230 231 .lpm_width(12), -
trunk/3DEES/UserInterface.tcl
r182 r183 96 96 variable inpCodes 97 97 array set inpCodes { 98 0 {r} 99 1 {c} 100 2 {a} 101 3 {f} 98 0 {rs} 99 1 {cs} 100 2 {av} 101 3 {af} 102 4 {bn} 102 103 } 103 104 … … 504 505 trace add variable [myvar polar] write [myproc polar_update] 505 506 506 $config(1).chan_ 0_1 select507 $config(2).chan_ 0_2 select508 $config(3).chan_ 0_3 select509 $config(4).chan_ 0_4 select510 $config(5).chan_ 0_5 select511 $config(6).chan_2_ 1select507 $config(1).chan_1_1 select 508 $config(2).chan_1_2 select 509 $config(3).chan_1_3 select 510 $config(4).chan_1_4 select 511 $config(5).chan_1_5 select 512 $config(6).chan_2_4 select 512 513 513 514 foreach {ch dummy} [array get adcCodes] { … … 536 537 foreach {osc title} $oscList { 537 538 set config($osc) [labelframe ${mux}.$osc -borderwidth 1 -relief sunken -text $title] 538 set column 1539 539 foreach {code input} $inpList { 540 set column [expr {$code + 1}] 540 541 label $config($osc).input_${input} -text " ${input}" 541 542 grid $config($osc).input_${input} -row 0 -column ${column} -sticky w 542 incr column543 543 } 544 544 foreach {ch id} $adcList { … … 552 552 } 553 553 } 554 set column [expr {($osc - 1) % 6}]555 set row [expr {($osc - 1) / 6}]554 set column [expr {($osc - 1) % 3}] 555 set row [expr {($osc - 1) / 3}] 556 556 grid $config($osc) -row ${row} -column ${column} -sticky news -padx 10 557 557 } … … 559 559 set config(key) [labelframe ${key}.frame -borderwidth 1 -relief sunken -text {legend}] 560 560 561 label $config(key).r -text "r - raw signal" 562 grid $config(key).r -row 0 -column 0 -sticky news 563 564 label $config(key).f -text "c - filtered and clipped signal" 565 grid $config(key).f -row 0 -column 1 -sticky news 566 567 label $config(key).d -text "a - amplitude" 568 grid $config(key).d -row 0 -column 2 -sticky news 569 570 label $config(key).c -text "f - amplitude flag" 571 grid $config(key).c -row 0 -column 3 -sticky news 561 label $config(key).rs -text "rs - raw signal" 562 grid $config(key).rs -row 0 -column 0 -sticky news 563 564 label $config(key).cs -text "cs - filtered and clipped signal" 565 grid $config(key).cs -row 0 -column 1 -sticky news 566 567 label $config(key).av -text "av - amplitude value" 568 grid $config(key).av -row 0 -column 2 -sticky news 569 570 label $config(key).af -text "af - amplitude flag" 571 grid $config(key).af -row 0 -column 3 -sticky news 572 573 label $config(key).bn -text "bn - bin number" 574 grid $config(key).bn -row 0 -column 4 -sticky news 575 576 label $config(key).bf -text "bf - bin flag" 577 grid $config(key).bf -row 0 -column 5 -sticky news 572 578 573 579 grid $config(key) -row 0 -column 0 -sticky news -padx 10 … … 603 609 grid columnconfigure $config(key) 2 -weight 1 604 610 grid columnconfigure $config(key) 3 -weight 1 611 grid columnconfigure $config(key) 4 -weight 1 612 grid columnconfigure $config(key) 5 -weight 1 605 613 606 614 … … 608 616 grid columnconfigure ${mux} 1 -weight 1 609 617 grid columnconfigure ${mux} 2 -weight 1 610 grid columnconfigure ${mux} 3 -weight 1611 grid columnconfigure ${mux} 4 -weight 1612 grid columnconfigure ${mux} 5 -weight 1613 618 } 614 619 … … 981 986 982 987 ${config}.thrs_check select 983 ${config}.thrs_field set 30988 ${config}.thrs_field set 60 984 989 } 985 990 -
trunk/3DEES/classifier.v
r181 r183 12 12 ); 13 13 14 reg out_flag_reg , out_flag_next;15 reg [5:0] out_data_reg , out_data_next;14 reg out_flag_reg [2:0], out_flag_next [2:0]; 15 reg [5:0] out_data_reg [2:0], out_data_next [2:0]; 16 16 reg [5:0] inp_flag_reg, inp_flag_next; 17 17 reg [width-1:0] inp_data_reg [5:0], inp_data_next [5:0]; 18 reg [15:0] int_pipe_reg [19:0], int_pipe_next [19:0]; 18 reg [15:0] int_pipe_reg [19:0], int_pipe_next [19:0]; 19 19 reg [1:0] int_data_reg [3:0], int_data_next [3:0]; 20 20 reg [4:0] int_temp_reg [1:0], int_temp_next [1:0]; … … 42 42 assign int_comp_wire[j*3+1+2] = (inp_data_reg[j+2] > cfg_data[(j*3+1+2)*width+width-1:(j*3+1+2)*width]); 43 43 assign int_comp_wire[j*3+2+2] = (inp_data_reg[j+2] > cfg_data[(j*3+2+2)*width+width-1:(j*3+2+2)*width]); 44 end 44 end 45 45 endgenerate 46 46 47 47 generate 48 48 for (j = 0; j < 4; j = j + 1) … … 56 56 end 57 57 endgenerate 58 58 59 59 always @(posedge clock) 60 60 begin … … 62 62 begin 63 63 inp_flag_reg <= {(6){1'b0}}; 64 out_data_reg <= {(6){1'b0}}; 65 out_flag_reg <= 1'b0; 64 for (i = 0; i < 3; i = i + 1) 65 begin 66 out_data_reg[i] <= {(6){1'b0}}; 67 out_flag_reg[i] <= 1'b0; 68 end 66 69 for (i = 0; i < 6; i = i + 1) 67 70 begin … … 84 87 begin 85 88 inp_flag_reg <= inp_flag_next; 86 out_data_reg <= out_data_next; 87 out_flag_reg <= out_flag_next; 89 for (i = 0; i < 3; i = i + 1) 90 begin 91 out_data_reg[i] <= out_data_next[i]; 92 out_flag_reg[i] <= out_flag_next[i]; 93 end 88 94 for (i = 0; i < 6; i = i + 1) 89 95 begin … … 104 110 end 105 111 end 106 112 107 113 always @* 108 114 begin 109 115 inp_flag_next = inp_flag_reg; 110 out_data_next = out_data_reg; 111 out_flag_next = out_flag_reg; 116 for (i = 0; i < 3; i = i + 1) 117 begin 118 out_data_next[i] = out_data_reg[i]; 119 out_flag_next[i] = out_flag_reg[i]; 120 end 112 121 for (i = 0; i < 6; i = i + 1) 113 122 begin … … 134 143 inp_data_next[i] = inp_data_wire[i]; 135 144 end 136 137 if (out_flag_reg) 138 begin 139 out_flag_next = 1'b0; 145 146 if (out_flag_reg[2]) 147 begin 148 for (i = 0; i < 3; i = i + 1) 149 begin 150 out_data_next[i] = {(6){1'b0}}; 151 out_flag_next[i] = 1'b0; 152 end 140 153 for (i = 0; i < 20; i = i + 1) 141 154 begin … … 144 157 int_temp_next[0] = {(5){1'b0}}; 145 158 int_temp_next[1] = {(5){1'b0}}; 146 out_data_next = {(6){1'b0}};147 159 end 148 160 else 149 161 begin 150 out_flag_next = 1'b1; 162 out_data_next[0] = {(6){1'b0}}; 163 out_data_next[1] = out_data_reg[0]; 164 out_data_next[2] = out_data_reg[1]; 165 166 out_flag_next[0] = 1'b1; 167 out_flag_next[1] = out_flag_reg[0]; 168 out_flag_next[2] = out_flag_reg[1] & (out_data_reg[1] > out_data_reg[0]); 169 151 170 int_pipe_next[0] = {int_pipe_reg[0][14:0], int_comp_wire[0]}; 152 171 int_pipe_next[1] = {int_pipe_reg[1][14:0], int_comp_wire[1]}; … … 170 189 endcase 171 190 end 172 191 173 192 int_temp_next[0] = {int_pipe_wire[1], int_pipe_wire[0][3]^int_pipe_wire[0][2]}; 174 193 int_temp_next[1] = {1'b0, int_pipe_wire[0]}; 175 194 176 195 case (int_temp_reg[0][4:0]) 177 5'b00011: out_data_next[ 3:0] = {2'd0, int_data_next[0]};178 5'b00111: out_data_next[ 3:0] = {2'd1, int_data_next[1]};179 5'b01111: out_data_next[ 3:0] = {2'd2, int_data_next[2]};180 5'b11111: out_data_next[ 3:0] = {2'd3, int_data_next[3]};181 default: out_flag_next = 1'b0;196 5'b00011: out_data_next[0][3:0] = {2'd0, int_data_next[0]}; 197 5'b00111: out_data_next[0][3:0] = {2'd1, int_data_next[1]}; 198 5'b01111: out_data_next[0][3:0] = {2'd2, int_data_next[2]}; 199 5'b11111: out_data_next[0][3:0] = {2'd3, int_data_next[3]}; 200 default: out_flag_next[0] = 1'b0; 182 201 endcase 183 202 184 203 case (int_temp_reg[1][3:0]) 185 204 // S1_F, electron 186 4'b0100: out_data_next[ 5:4] = 2'd0;187 205 4'b0100: out_data_next[0][5:4] = 2'd0; 206 188 207 // S1_F, proton 189 4'b0101: out_data_next[ 5:4] = 2'd1;190 208 4'b0101: out_data_next[0][5:4] = 2'd1; 209 191 210 // S1_S, electron 192 4'b1000: out_data_next[ 5:4] = 2'd2;193 211 4'b1000: out_data_next[0][5:4] = 2'd2; 212 194 213 // S1_S, proton 195 4'b1010: out_data_next[ 5:4] = 2'd3;196 197 default: out_flag_next = 1'b0;214 4'b1010: out_data_next[0][5:4] = 2'd3; 215 216 default: out_flag_next[0] = 1'b0; 198 217 endcase 199 218 end … … 204 223 // assign out_data = {1'd0, int_comp_wire[0], int_temp_reg[1][3:0]}; 205 224 // assign out_data = {1'd0, int_temp_reg[0][4:0]}; 206 assign out_data = out_data_reg ;207 assign out_flag = out_flag_reg ;225 assign out_data = out_data_reg[2]; 226 assign out_flag = out_flag_reg[2]; 208 227 209 228 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.