You can't directly use 10MHz clock to reset the 100MHz counter.
Why not? 10 MHz will be a reset signal, not another counting signal.
The important bit of the OP's question is:
...and have the rising edge of the 10MHz clock reset a counter ...
That implies this VHDL:
if rising_edge(a) then
if rising_edge(b) then
count_out <= counter;
counter <= (others =>'0');
else
counter <= counter + 1;
end if;
end if;
You can look at it a few different ways:
- Outside of simulation, two different clocks cannot be guaranteed to rise at exactly the same time, so something like this can't be guaranteed to work.
- In FPGA fabrics (and in general), the flip-flops have a single clock input. So you can't physically wire both signals to the same flipflop,so code like this can't be made implemented in such a fabric (unless 'a' and 'b' are aliases of the same signal):
if rising_edge(a) then
if rising_edge(b) then
....
end if;
end if;
- If you connect signals to the async resets of the flipflops then it is level sensitive, not edge sensitive, which is not what the OP wants.
I can't see why you would want to do this, but the best way I see would be something like this:
-- Might need to be 10 bits long
-- simulate to double check!
signal shift_reg : std_logic_vector(8 downto 0) := (others => '0');
signal toggle : std_logic := '0';
process(clk10Mhz)
begin
if rising_edge(clk10MHz) then
-- toggle a single flip-flop so the the fast domain can sync with the 10MHz clock
toggle <= not toggle;
end if;
end process;
process(clk100Mhz)
begin
if rising_edge(clk100MHz) then
-- Detect a clock edge in the 10MHz domain 9 cycles ago.
if shift_reg(shift_reg'high) XOR shift_reg(shift_reg'high-1) ='1' then
--------------------------------------
-- Detected the cycle where the 10MHz
-- domain's clock edge will be aligned
-- with the rising edge of the 100MHz clock
-----------------------------------------
.... do the tricky stuff that needs to be aligned in both domains.....
end if;
shift_reg <= shiftreg(shift_reg'high-1 downto 0) & toggle;
end if;
end process;
It will give the impression of the tricky stuff happening on both edges.
However, I can see almost no reason WHY you would want to do this - why not just use the 100MHz clock with a 1-in-10 clock enable for the 10MHz logic. The only reason I can see is to maybe allow the fast domain to have its clock gated off when not is use, reducing power.