bcm_rod_dp_updown_counter.bcm_rod_dp_updown_counter_arc Architecture Reference

up-down counter More...

Inheritance diagram for bcm_rod_dp_updown_counter.bcm_rod_dp_updown_counter_arc:

Inheritance graph
[legend]
Collaboration diagram for bcm_rod_dp_updown_counter.bcm_rod_dp_updown_counter_arc:

Collaboration graph
[legend]

List of all members.


Processes

ram_fill_counter  ( CLK_2X )

Signals

dp_ram_updown_counter  std_logic_vector ( 8 downto 0 ) := ( others = > ' 0 ' )


Detailed Description

up-down counter

Definition at line 55 of file bcm_rod_dp_updown_counter.vhd.


Member Function Documentation

[Process]
ram_fill_counter ( CLK_2X )

counter for RAM fill pointer; 5 modes:

  • count up
  • count up, counter full
  • count down
  • count down, counter empty
  • no count or up & down in same cycle

Definition at line 67 of file bcm_rod_dp_updown_counter.vhd.

00067   ram_fill_counter : process(CLK_2X)
00068   begin
00069     if (CLK_2X'event and CLK_2X = '1') then
00070       if (SCLR = '1') then              -- synchronous clear (reset)
00071         dp_ram_updown_counter <= (others => '0');
00072         busy                  <= '0';
00073         data_available        <= '0';
00074         write_error           <= '0';
00075         read_error            <= '0';
00076       else
00077         if ((count_up = '1' and count_down = '0') or (count_up = '1' and count_down = '1' and CLK = '0')) then  -- only counting up
00078           if (dp_ram_updown_counter = "111111111") then  -- counter full - data could not be stored in RAM
00079             dp_ram_updown_counter <= dp_ram_updown_counter;
00080             write_error           <= '1';
00081             busy                  <= '1';
00082           else              -- counter not full - data could be stored in RAM
00083             dp_ram_updown_counter <= (dp_ram_updown_counter + "01");
00084             write_error           <= '0';
00085             if (dp_ram_updown_counter >= "111111101") then
00086               busy <= '1';
00087             else
00088               busy <= '0';
00089             end if;
00090           end if;
00091           data_available <= '1';
00092           read_error     <= '0';
00093         elsif (count_up = '0' and count_down = '1' and CLK = '1') then  -- only counting down
00094           if (dp_ram_updown_counter = "000000000") then  -- counter full - data could not be stored in RAM
00095             dp_ram_updown_counter <= dp_ram_updown_counter;
00096             read_error            <= '1';
00097             data_available        <= '0';
00098           else              -- counter not full - data could be stored in RAM
00099             dp_ram_updown_counter     <= (dp_ram_updown_counter - "01"); 
00100             read_error                <= '0';
00101             if (dp_ram_updown_counter <= "000000001") then
00102               data_available <= '0';
00103             else
00104               data_available <= '1';
00105             end if;
00106           end if;
00107           write_error <= '0';
00108           busy        <= '0';
00109         else                -- counting up and down or no counting at all
00110           dp_ram_updown_counter <= dp_ram_updown_counter;
00111           if (count_down = '0') then
00112             read_error <= '0';
00113           end if;
00114           if (dp_ram_updown_counter = "000000000") then
00115             data_available <= '0';
00116           else
00117             data_available <= '1';
00118           end if;
00119           if (dp_ram_updown_counter >= "111111110") then
00120             busy <= '1';
00121           else
00122             busy <= '0';
00123           end if;
00124           write_error <= '0';
00125         end if;
00126       end if;
00127     end if;
00128   end process;


The documentation for this class was generated from the following file:

Author: M.Niegl
Generated on Tue Nov 4 00:48:46 2008 for BCM-AAA by doxygen 1.5.7.1-20081012