From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HXLGz-0006Ke-9Q for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:52:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HXLGy-0006KR-1t for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:52:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HXLGx-0006KO-US for qemu-devel@nongnu.org; Fri, 30 Mar 2007 12:52:23 -0500 Received: from an-out-0708.google.com ([209.85.132.244]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HXLEF-0005EB-1G for qemu-devel@nongnu.org; Fri, 30 Mar 2007 13:49:35 -0400 Received: by an-out-0708.google.com with SMTP id d40so1214616and for ; Fri, 30 Mar 2007 10:49:34 -0700 (PDT) Message-ID: Date: Fri, 30 Mar 2007 10:49:34 -0700 From: "Jonathan Kalbfeld" Subject: Re: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile In-Reply-To: <200703301828.56471.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_58992_30248815.1175276974356" References: <460D3F4D.10400@windriver.com> <200703301828.56471.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_58992_30248815.1175276974356 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline If you're ok you can shift it left 4 bits, then add half that result then shift right 10 bits. Of course, you'll only get 23.4Mhz that way :-) jonathan On 3/30/07, Paul Brook wrote: > > > + uint64_t now = qemu_get_clock(vm_clock); > > + return (uint32_t)(now*.024); > > We should be able to do this without resorting to floating point > arithmetic. > > Paul > > > -- -- Jonathan Kalbfeld +1 323 620 6682 ------=_Part_58992_30248815.1175276974356 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline If you're ok you can shift it left 4 bits, then add half that result then shift right 10 bits.

Of course, you'll only get 23.4Mhz that way :-)

jonathan

On 3/30/07, Paul Brook <paul@codesourcery.com> wrote:
> + uint64_t now = qemu_get_clock(vm_clock);
> + return (uint32_t)(now*.024);

We should be able to do this without resorting to floating point arithmetic.

Paul





--
--
Jonathan Kalbfeld
+1 323 620 6682 ------=_Part_58992_30248815.1175276974356--