Changeset 91 for trunk/MultiChannelUSB
- Timestamp:
- Feb 28, 2010, 11:35:16 PM (15 years ago)
- Location:
- trunk/MultiChannelUSB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/configuration.v
r90 r91 15 15 wire [15:0] int_ssel_wire; 16 16 wire [15:0] int_miso_wire; 17 reg [15:0] int_miso_reg [3:0];17 reg [15:0] int_miso_reg; 18 18 19 19 wire [15:0] int_q_wire [15:0]; … … 69 69 if (reset) 70 70 begin 71 for(i = 0; i <= 3; i = i + 1) 72 begin 73 int_miso_reg[i] <= 16'd0; 74 end 71 int_miso_reg <= 16'd0; 75 72 end 76 73 else 77 74 begin 78 for(i = 0; i < 3; i = i + 1) 79 begin 80 int_miso_reg[i+1] <= int_miso_reg[i]; 81 end 82 int_miso_reg[0] <= int_miso_wire; 75 int_miso_reg <= int_miso_wire; 83 76 end 84 77 end 85 78 86 79 // output logic 87 assign bus_miso = int_miso_reg [3];80 assign bus_miso = int_miso_reg; 88 81 assign bus_busy = 1'b0; 89 82 assign cfg_bits = int_bits_wire; -
trunk/MultiChannelUSB/control.v
r90 r91 183 183 buffer[1] <= 8'd0; 184 184 int_bus_cntr <= 32'd0; 185 state <= 5'd7;186 185 end 187 186 else 188 187 begin 189 buffer[0] <= 8'd 2;188 buffer[0] <= 8'd0; 190 189 buffer[1] <= 8'd0; 191 state <= 5'd6;192 end190 end 191 state <= 5'd7; 193 192 end 194 193 … … 197 196 buffer[0] <= bus_miso[7:0]; 198 197 buffer[1] <= bus_miso[15:8]; 198 int_bus_addr <= int_bus_addr + 32'd1; 199 int_bus_cntr <= int_bus_cntr - 32'd1; 199 200 state <= 5'd6; 200 201 end … … 202 203 6: 203 204 begin 204 int_bus_addr <= int_bus_addr + 32'd1;205 205 state <= 5'd7; 206 206 end … … 208 208 7: 209 209 begin 210 int_data <= buffer[0]; 211 int_wrreq <= 1'b1; 212 state <= 5'd8; 213 end 214 215 8: 216 begin 210 217 if (~tx_full) 211 218 begin 212 int_data <= buffer[0]; 213 int_wrreq <= 1'b1; 214 state <= 5'd8; 215 end 216 end 217 218 8: 219 begin 220 int_data <= buffer[1]; 221 state <= 5'd9; 219 int_data <= buffer[1]; 220 state <= 5'd9; 221 end 222 222 end 223 223 … … 227 227 begin 228 228 int_wrreq <= 1'b0; 229 if (|int_bus_cntr) 230 begin 231 state <= 5'd5; 232 int_bus_cntr <= int_bus_cntr - 32'd1; 233 end 234 else 235 begin 236 state <= 5'd0; 237 end 229 state <= 5'd10; 230 end 231 end 232 233 10: 234 begin 235 if (|int_bus_cntr) 236 begin 237 state <= 5'd5; 238 end 239 else 240 begin 241 state <= 5'd0; 238 242 end 239 243 end -
trunk/MultiChannelUSB/oscilloscope.v
r90 r91 24 24 reg [47:0] osc_data_reg, osc_data_next; 25 25 26 reg [19:0] cfg_cntr_max_reg, cfg_cntr_max_next;27 reg [19:0] cfg_cntr_mid_reg, cfg_cntr_mid_next;28 29 26 reg [2:0] int_case_reg, int_case_next; 30 27 31 28 reg int_trig_reg, int_trig_next; 32 29 reg [19:0] int_trig_addr_reg, int_trig_addr_next; 33 reg [19:0] int_cntr_reg, int_cntr_next; 30 31 reg [19:0] int_cntr_reg [1:0]; 32 reg [19:0] int_cntr_next [1:0]; 34 33 35 34 reg [15:0] bus_mosi_reg [2:0]; … … 71 70 bus_busy_reg <= 1'b0; 72 71 int_case_reg <= 5'd0; 73 int_cntr_reg <= 20'd0; 72 int_cntr_reg[0] <= 20'd0; 73 int_cntr_reg[1] <= 20'd0; 74 74 int_trig_reg <= 1'b0; 75 75 int_trig_addr_reg <= 20'd0; 76 cfg_cntr_max_reg <= 20'd0;77 cfg_cntr_mid_reg <= 20'd0;78 76 79 77 for(i = 0; i <= 2; i = i + 1) … … 91 89 bus_busy_reg <= bus_busy_next; 92 90 int_case_reg <= int_case_next; 93 int_cntr_reg <= int_cntr_next; 91 int_cntr_reg[0] <= int_cntr_next[0]; 92 int_cntr_reg[1] <= int_cntr_next[1]; 94 93 int_trig_reg <= int_trig_next; 95 94 int_trig_addr_reg <= int_trig_addr_next; 96 cfg_cntr_max_reg <= cfg_cntr_max_next;97 cfg_cntr_mid_reg <= cfg_cntr_mid_next;98 95 99 96 for(i = 0; i <= 2; i = i + 1) … … 104 101 end 105 102 end 106 107 103 108 104 always @* … … 115 111 bus_busy_next = bus_busy_reg; 116 112 int_case_next = int_case_reg; 117 int_cntr_next = int_cntr_reg; 113 int_cntr_next[0] = int_cntr_reg[0]; 114 int_cntr_next[1] = int_cntr_reg[1]; 118 115 int_trig_next = int_trig_reg; 119 116 int_trig_addr_next = int_trig_addr_reg; 120 cfg_cntr_max_next = cfg_cntr_max_reg;121 cfg_cntr_mid_next = cfg_cntr_mid_reg;122 117 123 118 for(i = 0; i < 2; i = i + 1) … … 135 130 ram_addr_next = 20'd0; 136 131 bus_busy_next = 1'b0; 137 int_cntr_next = 20'd0; 132 int_cntr_next[0] = 20'd0; 133 int_cntr_next[1] = 20'd0; 138 134 int_trig_next = 1'b0; 139 135 … … 162 158 int_case_next = 3'd1; 163 159 int_trig_addr_next = 20'd0; 164 cfg_cntr_max_next= {cfg_data[7:0], 10'd0};165 cfg_cntr_mid_next= {cfg_data[15:8], 10'd0};160 int_cntr_next[0] = {cfg_data[7:0], 10'd0}; 161 int_cntr_next[1] = {cfg_data[15:8], 10'd0}; 166 162 end 167 163 … … 178 174 int_case_next = 3'd2; 179 175 180 if ((~int_trig_reg) & (trg_flag) & 181 (int_cntr_reg == cfg_cntr_mid_reg)) 176 if ((~int_trig_reg) & (trg_flag) & (int_cntr_reg[1] == 0)) 182 177 begin 183 178 int_trig_next = 1'b1; … … 185 180 end 186 181 187 if (int_trig_reg | (int_cntr_reg < cfg_cntr_mid_reg)) 188 begin 189 int_cntr_next = int_cntr_reg + 20'd1; 182 if ((int_trig_reg) & (|int_cntr_reg[0])) 183 begin 184 int_cntr_next[0] = int_cntr_reg[0] - 20'd1; 185 end 186 187 if ((|int_cntr_reg[1])) 188 begin 189 int_cntr_next[1] = int_cntr_reg[1] - 20'd1; 190 190 end 191 191 end … … 213 213 ram_data_next = {osc_data_reg[47:40], 1'b0, osc_data_reg[39:32], 1'b0}; 214 214 int_case_next = 3'd1; 215 if (int_cntr_reg >= cfg_cntr_max_reg)215 if (int_cntr_reg[0] == 0) 216 216 begin 217 217 ram_wren_next[0] = 1'b0;
Note:
See TracChangeset
for help on using the changeset viewer.