title: CPU frequency and rising edge count
body: <p>I am confused about CPU clock speed.</p>
  <p>I thought I had a solid understanding of after watching this <a href="https://www.youtube.com/watch?v=K49alUpbtz8" rel="nofollow noreferrer">YouTube video</a>, and reading <a href="https://web.archive.org/web/20170328172331/http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Overall/clock.html" rel="nofollow noreferrer">this web page</a>, but when I returned to a VHDL tutorial on Pluralsight (link not given as it is not free) that talks about clock speed, I am not sure.</p>
  <p>Please consider the following code which is designed to be a very simple timer:</p>
  <pre><code>entity boardio is
    port (
      clock_50: in bit;
       hex0 : out bit_vector(0 to 6);
       hex1 : out bit_vector(0 to 6);
       hex2 : out bit_vector(0 to 6);
       hex3 : out bit_vector(0 to 6);
       key : in bit_vector(0 to 3);
       sw: bit_vector(0 to 9);
       ledr: buffer bit_vector (0 to 9)
    );
  end boardio;
  
  architecture arch of boardio is
  signal count : integer := 1; -- not a variable!
  signal clock_1hz : bit := '0';
  signal mins, secs : integer range 0 to 59 := 0;
  
  function hex_digit(x:integer; constant hide_zero:boolean := false) return bit_vector is
  begin
      case x is
          when 0 =&gt; 
              if hide_zero then
                  return &quot;1111111&quot;;
              else
                  return &quot;0000001&quot;;
              end if;
          when 1 =&gt; return &quot;1001111&quot;;
          when 2 =&gt; return &quot;0010010&quot;;
          when 3 =&gt; return &quot;0000110&quot;;
          when 4 =&gt; return &quot;1001100&quot;;
          when 5 =&gt; return &quot;0100100&quot;;
          when 6 =&gt; return &quot;0100000&quot;;
          when 7 =&gt; return &quot;0001111&quot;;
          when 8 =&gt; return &quot;0000000&quot;;
          when 9 =&gt; return &quot;0000100&quot;;
          when others =&gt; return &quot;1111111&quot;;
      end case;
  end function;
  
  begin
  
  -- 1hz clock
  -- ****************************************************
  process(clock_50)
  begin
      if (clock_50'event and clock_50 = '1') then
          count &lt;= count + 1;
          if (count = 25000000) then -- half the rate
              clock_1hz &lt;= not clock_1hz;
              count &lt;= 1;
          end if;
      end if;
  end process;
  -- ****************************************************
  process(clock_1hz, key)
  begin
      -- update # of seconds
      if (clock_1hz'event and clock_1hz = '1') then
          if (key(0) = '0') then
              secs &lt;= 0;
              mins &lt;= 0;
          else
              if (secs = 59) then
                  mins &lt;= (mins + 1) rem 60;
              end if;
              secs &lt;= (secs + 1) rem 60;
          end if;
      end if;
  end process;
  
  process(clock_1hz)
  begin
          hex0 &lt;= hex_digit(secs rem 10);
          hex1 &lt;= hex_digit(secs / 10, true);
          hex2 &lt;= hex_digit(mins rem 10, mins = 0);
          hex3 &lt;= hex_digit(mins / 10, true);
  end process;
  
  end arch;
  </code></pre>
  <p>I have posted all the code so everyone has the full context, but the bit I'm really interested in is the <code>1hz clock</code> process I've indicated with asterisks.</p>
  <p>It suggests that in one second of a 50MHz clock there will be 250,000,000 rising edges in one second.  However, the video and web page I linked to suggest that for a 1hz clock there will be one rising edge and one falling edge in one second, so it follows that there would be 500,000,000 of each for a 50Mhz clock.</p>
  <p>Can someone please clarify what CPU frequency actually means in terms of rising edges and falling edges please, along with 'tick' ?  Diagrams would be much appreciated, as I'm no longer sure the ones on my link are correct...</p>