Post Reply 
Books about CAS
01-31-2020, 06:44 AM (This post was last modified: 01-31-2020 06:47 AM by Nad.)
Post: #14
RE: Books about CAS
Hello!

Thanks, it's a pretty exciting project Smile

Looking through the Bignum source code I'm not sure if assembly code for the inner loops has been written for the Cortex-M family. There are generic C functions that aren't as fast - this is perhaps what the Cortex-M4 implementation mentioned above is using.

For this reason I may go with my original plan of writing my own mixed C/assembly routines for multiple-precision integers and rationals. Hopefully it won't be too difficult. I will first do addition, followed by multiplication, then GCD. Subtraction and division then follow pretty easily. I'll need to brush up on GNU syntax assembly, as the MCUXpresso IDE uses the GNU ARM toolchain.

But before that I need to determine the data types to use. A rational can be represented by a struct consisting of 2 multiple precision integers, which is what I think Bignum does.

Structs and creating new data types is new territory for me. Here is an overview of the steps I'll take to add two multiple-precision integers:

1) Choose precision. Bignum calls the words "limbs' and I'll use the same terminology. Start with say 4 limbs to make debugging easier (i.e. four 32-bit words) and create new data type "mpz" (as in Bignum). Convert string entered by user to value and use malloc() to push onto stack. Same for second argument.

2) Pressing "+" calls assembly routine to add with carry corresponding words, then use free() to remove second argument from stack and write sum to memory occupied by first argument.

3) Convert result to string for display. The only way I know to do that is to subtract multiples of powers of 10, keeping count as you go, until you reach zero.

I'll try this in a simulator and report back. Dan said he is aiming to upload the open-source firmware to GitHub by March so hopefully I'll have something to try on the real thing soon Smile

Nad

P.S. Talking about data types and memory representation, how are things like "x", pi, sqrt(2), "x^3 +y" etc. stored in memory in a CAS?

Everything will be alright in the end. If it's not alright, then it's not the end.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Books about CAS - compsystems - 10-26-2019, 01:38 PM
RE: Books about CAS - Nad - 12-02-2019, 07:10 AM
RE: Books about CAS - Jonathan Busby - 01-10-2020, 09:55 PM
RE: Books about CAS - Nad - 01-12-2020, 06:26 AM
RE: Books about CAS - Jonathan Busby - 01-14-2020, 08:56 PM
RE: Books about CAS - Nad - 01-18-2020, 11:03 PM
RE: Books about CAS - Jonathan Busby - 01-19-2020, 04:38 PM
RE: Books about CAS - johanw - 05-02-2020, 09:45 PM
RE: Books about CAS - BruceH - 05-03-2020, 12:09 PM
RE: Books about CAS - Eddie W. Shore - 01-22-2020, 03:00 AM
RE: Books about CAS - Eddie W. Shore - 01-22-2020, 03:05 AM
RE: Books about CAS - Jonathan Busby - 01-23-2020, 04:29 PM
RE: Books about CAS - rprosperi - 01-23-2020, 09:51 PM
RE: Books about CAS - Nad - 01-24-2020, 12:13 AM
RE: Books about CAS - Jonathan Busby - 01-24-2020, 03:53 PM
RE: Books about CAS - Nad - 01-31-2020 06:44 AM
RE: Books about CAS - Jonathan Busby - 01-31-2020, 06:39 PM
RE: Books about CAS - Jonathan Busby - 01-31-2020, 07:52 PM
RE: Books about CAS - Nad - 02-01-2020, 05:20 AM
RE: Books about CAS - Jonathan Busby - 02-01-2020, 03:51 PM
RE: Books about CAS - Nad - 02-09-2020, 05:24 AM
RE: Books about CAS - F-73P - 05-01-2020, 02:42 AM
RE: Books about CAS - Nad - 05-06-2020, 05:08 AM
RE: Books about CAS - F-73P - 05-11-2020, 08:20 AM
RE: Books about CAS - compsystems - 05-06-2020, 05:39 PM
RE: Books about CAS - Jonathan Busby - 05-06-2020, 06:31 PM
RE: Books about CAS - Nad - 05-07-2020, 10:38 AM
RE: Books about CAS - jonmoore - 05-07-2020, 10:31 AM
RE: Books about CAS - Nad - 05-15-2020, 09:06 AM
RE: Books about CAS - John Keith - 05-15-2020, 06:13 PM
RE: Books about CAS - F-73P - 05-27-2020, 04:07 AM
RE: Books about CAS - Jonathan Busby - 05-27-2020, 07:00 PM
RE: Books about CAS - Nad - 05-17-2020, 07:12 AM
RE: Books about CAS - John Keith - 05-17-2020, 09:11 PM
RE: Books about CAS - Nad - 05-18-2020, 02:57 AM
RE: Books about CAS - F-73P - 06-03-2020, 05:14 AM



User(s) browsing this thread: 1 Guest(s)