Re: problem in different clock speed when reading and writing from ram

Discussion in 'VHDL' started by Chris Pruett, Aug 14, 2003.

  1. Chris Pruett

    Chris Pruett Guest

    Sarah,

    You need to generate a signal from the 10 MHz domain that is long
    enough for the logic in the uart clock domain to capture. A rule of
    thumb for two totally asynchronous clocks is that it must be at least
    two of the destination clock cycles in length. What you do then is
    synchronize the signal in the target clock domain and then edge-detect.
    The edge-detection pulse is the signal to the UART to start.

    A possible implementation:

    process (clk_10, reset_10) is
    begin
    if (reset_10 = '1') then
    toggle <= '0';
    elseif (clk_10'event and clk_10='1') then
    if (start_tx = '1') then
    toggle <= not toggle;
    end if;
    end process;


    process (clk_uart, reset_uart) is
    begin
    if (reset_uart = '1') then
    toggle_meta <= '0';
    toggle_sync <= '0';
    toggle_delay <= '0';
    uart_start_tx <= '0';
    elseif (clk_uart'event and clk_uart='1') then
    toggle_meta <= toggle; -- metastable
    toggle_sync <= toggle_meta; -- synchronized
    toggle_delay <= toggle_sync; -- delayed
    uart_start_tx <= toggle_sync xor toggle_delay; -- edge
    end if;
    end process;

    Then uart_start_tx can be used by the UART logic.

    CP


    In article <>, sarah
    <> wrote:

    > Hi,
    >
    > I have a clock problem when implementing reading and wrting data from
    > ram in FPGA.
    >
    > First, write data to ram. The write clock is 10 Mhz. Then after
    > finishing writing, read data from ram and send them to UART. The
    > problem is here, the reading clock is the same as UART_clock, much
    > slower than 10 Mhz. In the UART, the transmitter block is controlled
    > by the signal: start_tx. It means when start_Tx is '1', the data can
    > be trasmitted. But this signal is triggered by the high speed clock,
    > 10 mhz. The transmitter block can work under the uart-clock. So, i
    > need to keep the signal : start_tx longer until the rising endge of
    > Uart_clcok.
    >
    > Does anyboday know how to slove this problem? Which logic should be
    > used?
    >
    > Thank you very much.
    >
    > sarah
    Chris Pruett, Aug 14, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pieter Hulshoff
    Replies:
    0
    Views:
    1,032
    Pieter Hulshoff
    Aug 13, 2003
  2. Robert Posey
    Replies:
    0
    Views:
    665
    Robert Posey
    Nov 26, 2003
  3. ashu
    Replies:
    1
    Views:
    445
  4. ashu
    Replies:
    2
    Views:
    598
    mysticlol
    Nov 6, 2006
  5. himassk
    Replies:
    1
    Views:
    1,214
    Paul Uiterlinden
    May 16, 2007
Loading...

Share This Page