Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: rickman Newsgroups: comp.lang.forth Subject: Re: embedded forth Date: Thu, 9 Feb 2017 05:11:27 -0500 Organization: A noiseless patient Spider Lines: 83 Message-ID: References: <49b3566a-3842-4f9f-a47f-a66590625fef@googlegroups.com> <92d07db1-18b7-410e-a77c-d7ab4f6606d8@googlegroups.com> <87lgtu20wb.fsf@nightsong.com> <6415800d-9ed0-4eef-afcf-6291de9a1ef3@googlegroups.com> <453ff717-47e2-4b43-87e5-38d3b6d05f89@googlegroups.com> <473c8a9d-752c-40c1-ad66-0a6fd368de02@googlegroups.com> <8de550af-17ab-4b84-8238-a180ee59e324@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 9 Feb 2017 10:09:40 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="bf7aa1e9e72cdd44d87b58b445262e65"; logging-data="11363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sRk3RgsbVH6vJNqJ9nidy" User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 In-Reply-To: <8de550af-17ab-4b84-8238-a180ee59e324@googlegroups.com> Cancel-Lock: sha1:62n+az/zprMOdDsV4fjJeu/JWQ0= Xref: csiph.com comp.lang.forth:54743 On 2/9/2017 4:46 AM, Ilya Tarasov wrote: >> Somehow I missed this post. But your code is wrong in that it is >> directly implementing the literal trig equation without taking >> advantage of any of the simplifications. > > Of course it is 'wrong'! :) Not because I have errors in VHDL (indeed > I test in with logic simulator and check sinus wave from 0 to 90 > degrees). You told me about vector rotating, I point to existing > formula and write an RTL for you. It is from your words. You have > something else? Show me and let's compare results. I have been talking about the simplifications for some time now. Regardless, the code you produced shows how simple the design is when using the multipliers. >> The actual equation implemented is: >> >> sin(a+b) = sin(a) + cos(a)*(pi/2)*b, >> >> where a and b are msbs and lsbs of the phase word, each half. The >> LUT is indexed by (a) with each entry having a value for sin(a) and >> (pi/2)*cos(a). Or call it two tables, both indexed by (a). While >> sin(a) is of width N, (pi/2)cos(a) is only of width N/2. > > Can you show me the way to achieve this? I'm not sure what you are asking. I'm just saying that you created three tables when only two are needed. One is the full 32 bit width and the other is only 16 bit width since the upper bits of the 32 bit product will all be zero. >> The amount of memory should decrease to 3/2 N width and 2^(N/2) >> depth. I don't see memory in your utilization list unless it is the >> MUXF8 and MUXF7 items? I don't see anything else in your code that >> would cause multiplexers to be used. Perhaps you should invoke the >> block RAMs. Given the wide nature of the RAM required, there is no >> reason to use distributed memory. 256 x 16 fits nicely in a block >> RAM. > > Please don't copy my analysis. All of there I wrote in my previous > message. You told you don't need to know about FPGA and I show > results to you. Small memory size leads to distributed memory instead > of block RAM with default synthesizer options (and this is my point, > not you are revealing for me). Don't copy your analysis??? I don't know what you mean. Are you sure you wish to continue this discussion? >> For this calculation the multiply will only be an 8x8, so one >> multiplier. Even with a 32 bit sine word it will only use a single >> 18x18 bit multiplier. > > Hmm. Let's test it. > > 0xFE * 0xFE = 0xFC04 0xFE7F will rounds to 0xFE, so it should give us > the same result > > 0xFE7F * 0XFE7F = 0xFD004301. Discards lower bits and result is > 0xFD00 > > 0xFD00 <> 0xFC04 > > Comments? > > You still miss a very important thing from sin calculation in DSP. It > is very important and not so clear. Where we need to have 16 bits > instead of 8? :) > >> Regardless, I think you can see even from your data above the >> savings in real estate that will result from using the hard IP of >> block RAMs and multipliers. That's why they are there. > > Ok, show me :) You have the numbers. What more do you need? -- Rick C