Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #28224
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: $0.03 microcontroller |
| Date | 2018-10-14 14:37 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <ppvd9i$ro$1@dont-email.me> (permalink) |
| References | (5 earlier) <db074a68-df45-4b56-8ae4-80ebc451eaeb@googlegroups.com> <ppsido$59m$1@dont-email.me> <7205434a-abd7-4b95-b4c7-d25d90cc6071@googlegroups.com> <ppt62r$daj$1@dont-email.me> <6a3fffa2-6190-4b37-ad81-88ad2bb7b218@googlegroups.com> |
On 14/10/18 03:32, gnuarm.deletethisbit@gmail.com wrote: > On Saturday, October 13, 2018 at 12:21:51 PM UTC-4, David Brown wrote: >> On 13/10/18 14:06, gnuarm.deletethisbit@gmail.com wrote: >>> On Saturday, October 13, 2018 at 6:46:20 AM UTC-4, David Brown >>> wrote: >>>> On 12/10/18 18:11, gnuarm.deletethisbit@gmail.com wrote: >>>>> On Friday, October 12, 2018 at 2:50:53 AM UTC-4, Philipp Klaus >>>>> Krause wrote: >>>>>> Am 12.10.2018 um 01:08 schrieb Paul Rubin: >>>>>>> upsidedown@downunder.com writes: >>>>>>>> There is a lot of operations that will update memory >>>>>>>> locations, so why would you need a lot of CPU registers. >>>>>>> >>>>>>> Being able to (say) add register to register saves traffic >>>>>>> through the accumulator and therefore instructions. >>>>>>> >>>>>>>> 1 KiB = 0.5 KiW is quite a lot, it is about 10-15 pages of >>>>>>>> commented assembly program listing. >>>>>>> >>>>>>> It would be nice to have a C compiler, and registers help >>>>>>> with that. >>>>>>> >>>>>> >>>>>> Looking at the instruction set, it should be possible to make a >>>>>> backend for this in SDCC; the architecture looks more >>>>>> C-friendly than the existing pic14 and pic16 backends. But it >>>>>> surely isn't as nice as stm8 or z80. reentrant functions will >>>>>> be inefficent: No registers, and no sp-relative adressing mode. >>>>>> On would want to reserve a few memory locations as >>>>>> pseudo-registers to help with that, but that only goes so far. >>>>> >>>>> CPUs like this (and others that aren't like this) should be >>>>> programmed in Forth. It's a great tool for small MCUs and many >>>>> times can be hosted on the target although not likely in this >>>>> case. Still, you can bring enough functionality onto the MCU to >>>>> allow direct downloads and many debugging features without an >>>>> ICE. >>>>> >>>>> Rick C. >>>>> >>>> >>>> Forth is a good language for very small devices, but there are >>>> details that can make a huge difference in how efficient it is. To >>>> make Forth work well on a small chip you need a Forth-specific >>>> instruction set to target the stack processing. For example, >>>> adding two numbers in this chip is two instructions - load >>>> accumulator from memory X, add accumulator to memory Y. In a Forth >>>> cpu, you'd have a single instruction that does "pop two numbers, >>>> add them, push the result". That gives a very efficient and compact >>>> instruction set. But it is hard to get the same results from a >>>> chip that doesn't have this kind of stack-based instruction set. >>> >>> Your point is what exactly? You are comparing running forth on some >>> other chip to running forth on this chip. How is that useful? There >>> are many other chips that run very fast. So? >> >> My point is that /this/ CPU is not a good match for Forth, though many >> other very cheap CPUs are. Whether or not you think that matches "CPUs >> like this should be programmed in Forth" depends on what you mean by >> "CPUs like this", and what you think the benefits of Forth are. >> >>> >>> I believe others have said the instruction set is memory oriented >>> with no registers. I think that means in general the CPU will be >>> slow compared to a register based design. That actually means it is >>> easier to have a fast Forth implementation compared to other >>> compilers since there won't be a significant penalty for using a >>> stack. >>> >> >> It has a single register, not unlike the "W" register in small PIC >> devices. Yes, I expect it is going to be slower than you would get from >> having a few more registers. But it is missing (AFAICS) auto-increment >> and decrement modes, and has only load/store operations with indirect >> access. >> >> So if you have two 8-bit bytes x and y, then adding them as "x += y;" is: >> >> mov a, y; // 1 clock >> add x, a; // 1 clock > > Keep the TOS in the accumulator and I think you end up with > > add a, x; // 1 clock > inc DSTKPTR; // adjust stack pointer - 1 clock? > > Does that work? Reading below, I guess not. > > >> If you have a data stack pointer "dsp", and want a standard Forth "+" >> operation, you have: >> >> idxm a, dsp; // 2 clock >> mov temp, a; // 1 clock >> dec dsp; // 1 clock >> idxm a, dsp; // 2 clock >> add a, temp; // 1 clock >> idxm dsp, a; // 2 clock >> >> That is 9 clocks, instead of 2, and 6 instructions instead of 3. > > What does idxm do? Looks like an indirect load? Can this address > mode be combined with any operations? Are operations limited in the > addressing modes? This seems like a very, very simple CPU, but for the > money, I guess I get it. "idxm" is an indirect load or store (depending on the order of the operands). No, there are no other operations that can be combined with indirect accesses. If you want to keep the TOS in the accumulator, then Forth "+" becomes: mov temp, a; // 1 clock dec dsp; // 1 clock idxm a, dsp; // 2 clock add a, temp; // 1 clock 5 clocks is a good deal better than 9 clocks, but still a good deal worse than 2 clocks. > > >> Of course you could make a Forth compiler for the device - but you would >> have to make an optimising Forth compiler that avoids needing a data >> stack, just as you do on many other small microcontollers (and just as a >> C compiler would do). This is /not/ a processor that fits well with >> Forth or that would give a clear translation from Forth to assembly, as >> is the case on some very small microcontrollers. > > OK > A stack-based system is often a good choice for very small cpus - it is certainly popular for 4-bit microcontrollers. But it seems that the designers of this device simply haven't considered support for Forth-style coding to be important.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
$0.03 microcontroller Clifford Heath <no.spam@please.net> - 2018-10-10 12:05 +1100
Re: $0.03 microcontroller lasselangwadtchristensen@gmail.com - 2018-10-10 16:12 -0700
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-10 17:51 -0700
Re: $0.03 microcontroller lasselangwadtchristensen@gmail.com - 2018-10-10 18:56 -0700
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-10 19:29 -0700
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-11 11:39 +0300
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-11 16:08 -0700
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-12 08:50 +0200
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-12 09:44 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-12 21:30 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-12 22:06 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-12 23:45 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-13 21:47 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-14 11:58 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-15 08:14 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-11 09:27 +0100
Re: $0.03 microcontroller Klaus Kragelund <klauskvik@hotmail.com> - 2018-12-26 02:23 -0800
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-15 10:44 +0200
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-15 07:29 -0700
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-16 09:19 +0200
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-16 13:48 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-15 21:34 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-16 09:29 +0200
Re: $0.03 microcontroller Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-10-15 21:22 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-16 10:00 +0200
Re: $0.03 microcontroller Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-10-16 22:52 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-16 14:01 -0700
Re: $0.03 microcontroller Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-10-17 00:03 +0200
Re: $0.03 microcontroller Clifford Heath <no.spam@please.net> - 2018-10-17 09:22 +1100
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-16 15:29 -0700
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-17 00:46 +0200
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-17 09:35 +0300
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-17 09:31 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-17 07:08 -0700
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-17 18:37 +0300
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-17 10:04 -0700
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-17 23:07 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-17 08:23 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-17 19:43 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-17 20:24 +0200
Re: $0.03 microcontroller George Neuner <gneuner2@comcast.net> - 2018-10-17 11:31 -0400
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-05 12:41 +0100
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-12 09:11 -0700
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-13 12:46 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-13 05:06 -0700
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-13 18:00 +0300
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-13 18:27 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-13 20:50 +0300
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-14 14:26 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-13 18:20 -0700
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-14 08:53 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-14 08:55 +0200
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-14 14:32 +0200
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-13 18:21 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-13 18:32 -0700
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-13 19:02 -0700
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-14 14:37 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-14 14:59 +0200
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-13 11:06 -0700
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-13 18:31 +0300
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-13 19:46 +0300
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-13 19:59 +0300
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-13 21:31 +0300
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-13 22:19 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-13 21:24 +0200
Re: $0.03 microcontroller Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-10-13 22:50 +0300
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-14 14:39 +0200
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-15 05:11 -0700
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-13 21:03 +0300
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-13 18:25 -0700
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-15 14:20 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-21 16:27 +0300
Re: $0.03 microcontroller jim.brakefield@ieee.org - 2018-10-21 07:47 -0700
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-21 08:08 -0700
Re: $0.03 microcontroller jim.brakefield@ieee.org - 2018-10-21 09:31 -0700
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-21 10:51 -0700
Re: $0.03 microcontroller jim.brakefield@ieee.org - 2018-10-21 12:44 -0700
Re: $0.03 microcontroller Brett <ggtgp@yahoo.com> - 2018-10-22 00:28 +0000
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-21 21:43 +0200
Re: $0.03 microcontroller Phil Martel <pomartel@comcast.net> - 2018-10-21 11:03 -0400
Re: $0.03 microcontroller George Neuner <gneuner2@comcast.net> - 2018-10-21 20:59 -0400
Re: $0.03 microcontroller Michael Kellett <mk@mkesc.co.uk> - 2018-10-11 14:04 +0100
Re: $0.03 microcontroller David Brown <david.brown@hesbynett.no> - 2018-10-11 15:56 +0200
Re: $0.03 microcontroller Michael Kellett <mk@mkesc.co.uk> - 2018-10-13 09:35 +0100
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-13 13:06 -0700
Re: $0.03 microcontroller Michael Kellett <mk@mkesc.co.uk> - 2018-10-14 11:30 +0100
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-12 10:18 +0200
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-10-12 21:39 +0300
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-08 13:53 +0100
Re: $0.03 microcontroller Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-11-08 15:08 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-08 14:34 +0100
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-11-08 21:52 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-08 21:56 +0100
Re: $0.03 microcontroller upsidedown@downunder.com - 2018-11-09 00:35 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-11-09 09:00 +0100
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-15 14:19 +0200
Re: $0.03 microcontroller Tim <cpldcpu+usenet@gmail.com> - 2018-10-14 01:46 +0200
Re: $0.03 microcontroller Theo <theom+news@chiark.greenend.org.uk> - 2018-10-14 10:55 +0100
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-24 15:57 +0200
Re: $0.03 microcontroller Philipp Klaus Krause <pkk@spth.de> - 2018-10-15 14:35 +0200
Re: $0.03 microcontroller raimond.dragomir@gmail.com - 2018-10-15 06:05 -0700
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-15 07:19 -0700
Re: $0.03 microcontroller Paul Rubin <no.email@nospam.invalid> - 2018-10-15 07:26 -0700
Re: $0.03 microcontroller gnuarm.deletethisbit@gmail.com - 2018-10-15 07:30 -0700
csiph-web