- Timestamp:
- 11/10/10 16:21:52 (14 years ago)
- Location:
- firmware/FTU
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FTU/FTU_control.vhd
r10050 r10051 201 201 ram_dia_sig <= (others => '0'); 202 202 FTU_control_State <= INIT_RAM; 203 --elsif (ram_ada_cntr = (NO_OF_ENABLE*RAM_ADDR_RATIO + NO_OF_COUNTER*RAM_ADDR_RATIO*RAM_CEF + (NO_OF_DAC - NO_OF_DAC_NOT_USED)*RAM_ADDR_RATIO) + 2) then -- default CRC errors204 --ram_dia_sig <= (others => '0');205 --FTU_control_State <= INIT_RAM;206 203 elsif (ram_ada_cntr < 2**RAM_ADDR_WIDTH_A) then -- empty RAM cells 207 204 ram_dia_sig <= (others => '0'); … … 276 273 end if; 277 274 278 when CONFIG_COUNTER => 275 when CONFIG_COUNTER => -- set prescaling value for counters 279 276 wait_cntr <= wait_cntr + 1; 280 277 new_rates_busy <= '1'; … … 296 293 end if; 297 294 298 when CONFIG_ENABLE => 295 when CONFIG_ENABLE => -- set enable patterns for sum trigger stage 299 296 ram_enable_cntr <= ram_enable_cntr + 1; 300 297 new_rates_busy <= '1'; … … 302 299 ram_adb_sig <= conv_std_logic_vector(ram_enable_cntr + 1, RAM_ADDR_WIDTH_B); 303 300 FTU_control_State <= CONFIG_ENABLE; 304 --elsif (ram_enable_cntr > 0 and ram_enable_cntr < NO_OF_ENABLE + 1) then305 --ram_adb_sig <= conv_std_logic_vector(ram_enable_cntr + 1, RAM_ADDR_WIDTH_B);306 --enable_array_sig(ram_enable_cntr - 1) <= ram_dob;307 --enables_ready <= '1';308 --FTU_control_State <= CONFIG_ENABLE;309 301 elsif (ram_enable_cntr < NO_OF_ENABLE) then 310 302 ram_adb_sig <= conv_std_logic_vector(ram_enable_cntr + 1, RAM_ADDR_WIDTH_B); … … 327 319 end if; 328 320 329 when CONFIG_DAC => 321 when CONFIG_DAC => -- start to set thresholds for sum trigger patches 330 322 new_rates_busy <= '1'; 331 323 ram_dac_cntr <= ram_dac_cntr + 1; … … 354 346 end if; 355 347 356 when CONFIG_DAC_WAIT => 348 when CONFIG_DAC_WAIT => -- wait until setting of thresholds has finished 357 349 if (config_ready = '1') then 358 350 new_DACs_in_RAM <= '0'; … … 591 583 end if; 592 584 593 when DO_PING_PONG => -- just answer to FTM585 when DO_PING_PONG => -- answer to FTM and send DNA 594 586 wait_cntr <= wait_cntr + 1; 595 587 if (wait_cntr = 0) then … … 605 597 end if; 606 598 end process FTU_control_FSM; 607 608 --detect_new_rates: process(new_rates, new_rates_busy)609 --begin610 --if(new_rates_busy = '1') then611 --new_rates_sig <= '0';612 --elsif rising_edge(new_rates) then613 --new_rates_sig <= '1';614 --end if;615 --end process detect_new_rates;616 599 617 600 detect_new_rates: process(clk_50MHz) -
firmware/FTU/FTU_top.vhd
r10037 r10051 58 58 sck : OUT STD_LOGIC; -- serial clock to DAC 59 59 mosi : OUT STD_LOGIC; -- serial data to DAC, master-out-slave-in 60 clr : OUT STD_LOGIC; -- clear signal to DAC 60 clr : OUT STD_LOGIC; -- clear signal to DAC, not used 61 61 cs_ld : OUT STD_LOGIC; -- chip select or load to DAC 62 62 -
firmware/FTU/ftu_definitions.vhd
r10050 r10051 60 60 constant CNTR_FREQ_DIVIDER : integer := 25000; -- for simulation, should normally be 1 61 61 62 -- 32byte dual-port RAM, port A: 8byte, port B: 16byte62 --64byte dual-port RAM, port A: 8byte, port B: 16byte 63 63 constant RAM_ADDR_WIDTH_A : integer := 6; 64 64 constant RAM_ADDR_WIDTH_B : integer := 5; -
firmware/FTU/rs485/FTU_rs485_control.vhd
r10050 r10051 247 247 case FTU_rs485_control_State is 248 248 249 when INIT => 249 when INIT => -- reset CRC register 250 250 reset_crc_sig <= '1'; 251 251 FTU_rs485_control_State <= RECEIVE; … … 373 373 end if; 374 374 375 when SET_DAC_WAIT_2 => 375 when SET_DAC_WAIT_2 => -- wait one cycle for CRC calculation 376 376 crc_enable_sig <= '0'; 377 377 FTU_rs485_control_State <= SET_DAC_TRANSMIT; … … 396 396 end if; 397 397 398 when SET_ENABLE_WAIT_2 => 398 when SET_ENABLE_WAIT_2 => -- wait one cycle for CRC calculation 399 399 crc_enable_sig <= '0'; 400 400 FTU_rs485_control_State <= SET_ENABLE_TRANSMIT; … … 417 417 end if; 418 418 419 when SET_PRESCALING_WAIT_2 => 419 when SET_PRESCALING_WAIT_2 => -- wait one cycle for CRC calculation 420 420 crc_enable_sig <= '0'; 421 421 FTU_rs485_control_State <= SET_PRESCALING_TRANSMIT; … … 444 444 end if; 445 445 446 when READ_RATES_WAIT_2 => 446 when READ_RATES_WAIT_2 => -- wait one cycle for CRC calculation 447 447 crc_enable_sig <= '0'; 448 448 FTU_rs485_control_State <= READ_RATES_TRANSMIT; … … 468 468 end if; 469 469 470 when READ_DAC_WAIT_2 => 470 when READ_DAC_WAIT_2 => -- wait one cycle for CRC calculation 471 471 crc_enable_sig <= '0'; 472 472 FTU_rs485_control_State <= READ_DAC_TRANSMIT; … … 491 491 end if; 492 492 493 when READ_ENABLE_WAIT_2 => 493 when READ_ENABLE_WAIT_2 => -- wait one cycle for CRC calculation 494 494 crc_enable_sig <= '0'; 495 495 FTU_rs485_control_State <= READ_ENABLE_TRANSMIT; … … 512 512 end if; 513 513 514 when READ_PRESCALING_WAIT_2 => 514 when READ_PRESCALING_WAIT_2 => -- wait one cycle for CRC calculation 515 515 crc_enable_sig <= '0'; 516 516 FTU_rs485_control_State <= READ_PRESCALING_TRANSMIT; … … 532 532 end if; 533 533 534 when PING_PONG_WAIT_2 => 534 when PING_PONG_WAIT_2 => -- wait one cycle for CRC calculation 535 535 crc_enable_sig <= '0'; 536 536 FTU_rs485_control_State <= PING_PONG_TRANSMIT; -
firmware/FTU/rs485/FTU_rs485_interpreter.vhd
r10050 r10051 110 110 case FTU_rs485_interpreter_State is 111 111 112 when INIT => 112 when INIT => -- reset CRC register 113 113 reset_crc_sig <= '1'; 114 114 FTU_rs485_interpreter_State <= WAIT_FOR_DATA; … … 134 134 reset_crc_sig <= '0'; 135 135 136 when WAIT_CRC => 136 when WAIT_CRC => -- wait one cycle for CRC calculation 137 137 crc_enable_sig <= '0'; 138 138 FTU_rs485_interpreter_State <= CHECK_CRC; 139 139 140 when CHECK_CRC => 140 when CHECK_CRC => -- check whether CRC matches 141 141 reset_crc_sig <= '1'; 142 142 if (crc_match_sig = '1') then
Note:
See TracChangeset
for help on using the changeset viewer.