Is it worth it to learn 8051 architecture now? - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: September 12, 2016, 04:17:57 pm
content: Despite my primary choice of microcontrollers being something between AVR8, PIC8 and ARM, is it worth it to revisit the 8051 architecture now? Being in China, STC makes some ridiculously cheap 8051 MCUs on the low end. And universities still teach those. I do own a few 8051 chips though, a STC15L2K60S2, two STC89C51RC and two AT89C51RC.I don't use those 8051 in my own projects though as I currently have no way debugging it. I have equipment to debug all my commonly used architectures, being AVR8 (Atmel ICE, a recent purchase,) PIC8 (PICkit 3) or ARM (J-link clone, also a recent purchase.) I do consider debugging somewhat important as I am a software perfectionist (I am professionally trained in software engineer after all, as that is my bachelor degree instead of electronics engineering) and I have a long history of battling heisenbugs that cannot be found by inserting printf's using debuggers.

author: wraper
author_rank: Unknown
timestamp: September 12, 2016, 04:31:25 pm
content: QuoteYesQuoteDon't bother with old chips. Use modern MCUs with modern 8051 instruction set compatible but order of magnitude faster core, Like EFM8 from Silicon labs which have good IDE and easy to program and debug. There are 8051 chips which are faster and more advanced than any AVR or 8 bit PIC, and much cheaper at the same time.

author: technix
author_rank: Super Contributor
timestamp: September 12, 2016, 04:35:57 pm
content: Quote from: wraper on September 12, 2016, 04:31:25 pmThanks.Quote from: wraper on September 12, 2016, 04:31:25 pmThat STC15L2K60S2 implements such a new core. Older chips are cheaper though as I can buy decades-old NOS (I have tools to scrape the oxide off the pins very quickly.)

author: nctnico
author_rank: Super Contributor
timestamp: September 12, 2016, 04:43:18 pm
content: Whether it is usefull to learnt the 8051 core depends on whether you are into high volume consumer products or might be involved in supporting legacy products. For the latter I wouldn't pay too much attentions because work will get less over time. 8051 may be interesting for consumer products but the archaic core will require much more development effort than a 16 bit (MSP430) or 32 bit (ARM) MCU. There are a lot of things in C (let alone C++) which don't work well on the 8051 core and need a compiler which can emulate these in software.

author: wraper
author_rank: Unknown
timestamp: September 12, 2016, 04:46:00 pm
content: Quote from: technix on September 12, 2016, 04:35:57 pmThat's why I didn't quote it. When talking about cheap, you can buy Silicon Labs MCU with 17 kB flash, 2 kB RAM, decent 12 bit ADC, built in USB which do not require any crystal, internal 3.3V vreg which can supply up to 100mA and power external circuit, for less than 1 EUR at quantity of 1. And this is from Farnell, not some Chinese shithole (no offense). 8 kB version is even cheaper.

author: ataradov
author_rank: Super Contributor
timestamp: September 12, 2016, 04:50:28 pm
content: Why not learn ARM? And once you are really comfortable with that, it takes like a day to figure out 8051, in case you actually need it.

author: technix
author_rank: Super Contributor
timestamp: September 12, 2016, 04:52:33 pm
content: Quote from: nctnico on September 12, 2016, 04:43:18 pmEven among the 8-bit cores 8051 is more problematic than PIC18 from a C programmer's perspective (I always try to minimize assembler) and AVR8 is the simplest to code.Quote from: wraper on September 12, 2016, 04:46:00 pmSTC15L2K60S2 costs less than 0.1 EUR at quantity of 1, and no STC don't sell parts to distributors, they distribute parts themselves directly. By the way, I am from China and the STC company have an office in my city right where I usually shop for parts (and the company itself is 4 hours' drive north of my city, while the silicon itself is manufactured and packaged in TSMC facility right in the city.)Quote from: ataradov on September 12, 2016, 04:50:28 pmI am trying to. I am still trying to get the USART driver not to throw out Usage Errors when called through stdio though. It is no more different from AVR8 or PIC8 really, although the clock system always get on my nerves

author: Kalvin
author_rank: Super Contributor
timestamp: September 12, 2016, 05:15:47 pm
content: You do not really need a debugger. If you can get the chip programmed and running, you can use a lightweight printf() for the debugging purposes. For really hard problems, use an oscilloscope and make some I/O-pins wiggle. That's the way it was done 20 - 25 years ago.

author: technix
author_rank: Super Contributor
timestamp: September 12, 2016, 05:47:23 pm
content: Quote from: Kalvin on September 12, 2016, 05:15:47 pmI have run into occasions where printf() gives me more issue than benefit (remember that I mentioned above that on my ARM board the printf function crashes the processor?) and it can throw off timing and cause heisenbugs (I have tracked down more than 20 such timing-caused race condition bugs on microcontrollers and computers alike before. Those bugs are hard to catch as it roots in timing and even a single nop instruction can throw the timing off enough to cause the bug to manifest differently)

author: ataradov
author_rank: Super Contributor
timestamp: September 12, 2016, 05:50:17 pm
content: Quote from: technix on September 12, 2016, 05:47:23 pmDebuggers can be intrusive as well. You always need to think what is best for a specific case anyway.printf() should not crash anything, and since you are learning, it is a great learning opportunity to figure out what is wrong and fix it.

author: technix
author_rank: Super Contributor
timestamp: September 12, 2016, 05:54:32 pm
content: Quote from: ataradov on September 12, 2016, 05:50:17 pmDepend on what kind of debugger you are talking about. However unlike a good debugger that does not intrude too much to throw off timings to the point that I cannot even find the bugs in question, printf() almost always guarantees timings being thrown off.I tracked the printf() buf on my ARM board to some code supplied by AC6 (in binary form)so that is a no-go for me.

author: Kalvin
author_rank: Super Contributor
timestamp: September 12, 2016, 06:02:10 pm
content: You should be able to write a simple printf() yourself. Take a look at this as a starting point, and modify it for your purposes:http://www.sparetimelabs.com/printfrevisited/printfrevisited.phphttp://www.sparetimelabs.com/tinyprintf/tinyprintf.php

author: rstofer
author_rank: Super Contributor
timestamp: September 12, 2016, 06:06:04 pm
content: Quote from: ataradov on September 12, 2016, 05:50:17 pmI am pretty down on implementations of printf() and anything in the strings library that use the heap. I write my own little USART send/receive code and a few conversion routines from "The C Programming Language" (Kernighan & Ritchey) to get around these issues. In any event, I would still have to write the putc() routine even if I did use a library version of printf().But printf() will always be my favorite way to debug just about anything. Single stepping code is a monumental waste of time!

author: tggzzz
author_rank: Super Contributor
timestamp: September 12, 2016, 06:08:40 pm
content: You should never learn any single device's architecture, unless someone is paying you to do it as part of a job.Instead you should learn common architectural principles that will (1) last a lifetime, and (2) enable you to pick up any single device's architecture within a day or so.Example: what I learned in the 70s about 8080/6802/1802/etc was instantly relevant when I started programming Arduino-class machines. I was surprised and disappointed that so little had changed in 35 years (except cost and size, of course).

author: nctnico
author_rank: Super Contributor
timestamp: September 12, 2016, 07:45:32 pm
content: Quote from: technix on September 12, 2016, 05:47:23 pmIf you have these kind of timing problems then you should seriously revise your programming and design methods!

author: ebclr
author_rank: Super Contributor
timestamp: September 12, 2016, 07:52:05 pm
content: 8051 is used in several applications, and also the last generation of 8051 have incredibile performance take a look on Silabs site.Several IOT and GSM modules use 8051 architecture, same for a lot of usb interface chips like Cypress, It's totally worth the time. But this must be complemented with Arm . Today Arm is HOT 8051 is usefull legacy. And PIC is shit expensive legacy

author: wraper
author_rank: Unknown
timestamp: September 12, 2016, 10:02:04 pm
content: Quote from: technix on September 12, 2016, 04:52:33 pmDunno, STC has price list in their datasheet, price for STC15L2K60S2 is RMB 5.5 = $ 0.82 (for 200k units order if I understand it right). Page 16:http://www.stcmicro.com/datasheet/STC15F2K60S2-cn.pdf

author: nctnico
author_rank: Super Contributor
timestamp: September 12, 2016, 10:51:03 pm
content: IMHO the biggest mistake is to look at the price of a part unless you are into high volume products. Archaic architectures are a PITA to program need expensive tools and thus get a beginner nowhere. If you are well versed on ARM you can pick up 8051 easely. The other way around is just a waste of time.

author: wraper
author_rank: Unknown
timestamp: September 12, 2016, 11:27:54 pm
content: Quote from: nctnico on September 12, 2016, 10:51:03 pmSilabs eclipse based IDE (simplicity studio) is free, and comes with free full Keil compiler licence, has graphical HW configurator which is good for beginners. All you need is EUR 30 dev board with built in Segger J-link which can program/debug external devices too, including ARM MCUs. Or (original) standalone debugger/programmer which costs about the same EUR 30, or even cheaper toolstick. Then there are cheap Chinese clones too. The same IDE is used for ARM MCUs too.Quote

author: amyk
author_rank: Super Contributor
timestamp: September 13, 2016, 01:37:25 am
content: Quote from: nctnico on September 12, 2016, 10:51:03 pmI'd say it's the other way around. ARM and AVR are boring if you know 8051 or PIC. PIC and 8051 are frustrating if you started with ARM or AVR.

author: Keicar
author_rank: Regular Contributor
timestamp: September 13, 2016, 02:19:02 am
content: Wandering off topic somewhat, but I do recall occasions when adding a printf() made a problem (apparently) go away entirely - best not to tell your manager lest they decide to "leave it in there & call it fixed"...

author: technix
author_rank: Super Contributor
timestamp: September 13, 2016, 03:14:00 am
content: Quote from: Keicar on September 13, 2016, 02:19:02 amThat is what I call heisenbug. That printf() fixed the timing.

author: Jeroen3
author_rank: Super Contributor
timestamp: September 13, 2016, 06:09:19 am
content: QuoteDepends where you work.If you're working to develop some consumer products for millions a year for cheap. Yes. (think, chip-on-board)If you're working to develop some industrial controller board for a few thousand units a year for industrial price. No, you'll waste engineering resources.If you're working tosupportsome industrial controller board for a few thousand units a year for industrial price. Yes, it'll run some legacy almost EOL 8051 controller.

author: nctnico
author_rank: Super Contributor
timestamp: September 13, 2016, 08:36:00 am
content: Quote from: blueskull on September 13, 2016, 01:53:57 amIn that case you never did anything serious. On architectures like the 8051 it it very hard to use pointers because of the many memory types it has. You always end up with some weird usage of C (pragmas to put variables into a certain memory, all variables global for example) and the compiler needs to emulate a lot of things like a stack. Nowadays programming is all about re-using code.

author: wraper
author_rank: Unknown
timestamp: September 13, 2016, 09:13:39 am
content: Quote from: nctnico on September 13, 2016, 08:36:00 amNot so difficulthttp://www.keil.com/support/man/docs/c51/c51_le_memtypes.htmhttp://www.keil.com/support/man/docs/c51/c51_le_ptrs.htmand generic pointers can be used as well (slower).Code:char data var1;char code text[] = "ENTER PARAMETER:";unsigned long xdata array;float idata x,y,z;unsigned int pdata dimension;unsigned char xdata vector;char bdata flags;

author: westfw
author_rank: Super Contributor
timestamp: September 13, 2016, 09:20:55 am
content: I have a double-think problem with 8051. Part of me wants to build a "classic" 8051 board with external RAM and program memory (perhaps in the same chip), to use all those "found" and cheap chips (and the ones I have lying around from "somewhere.") The rest of me is shouting loudly that I should leap to the more modern chips and buy one the reasonably-priced development kits that the vendors provide (SI Labs, Analog Devices, etc. Or at least one of the 8051 variants with SPI flash...) Sigh. (but I HAVE 80C51s. And EPROMs. And bytewide nonvolatile ram chips...)(has anyone seen a "Classic 8051" (40pin 51, 2*28pin memory, etc) PCB around in "modern formats"? (Open source EAGLE PCB or something?) I've found some old pre-CAD versions, some post-40pin versions (sort of), and some minimal (no external memory) versions, and I've made some attempts of my own, but I'd prefer to have something proven...)As a hobbyist computer ... no one does 8051 any more. Professionally, there are 8051 cores inside a lot of SoC (MP3 players, USB and ethernet hubs, etc, etc) devices. And the SILabs and Analog Devices and various other players have done good things with analog subsystems...)

author: Kalvin
author_rank: Super Contributor
timestamp: September 13, 2016, 10:26:45 am
content: Quote from: wraper on September 13, 2016, 09:13:39 amHave you checked the code size and execution time? The 8051 is quite horrible when it comes to accessing variables and arrays in the xdata memory as the original 8051 architecture has only one xdata pointer register. The enhanced variants may have two or more xdata pointer registers available but requires compiler support for that.The 8051 was simple enough to be programmed with "a pen and paper" writing down the assembly to paper and then converting it manually into hex code next to the assembly mnemonics. The technique required some discipline, modular and iterative design as you didn't want to rewrite/relocate the whole stuff again if you needed some code fixes or new functionality. Typically there was a small function jump table providing access to common functions instead of calling the function directly: Should the function be moved to some other location, only one entry in the jump table needed a fix instead of fixing all call addresses within the code.

author: ebclr
author_rank: Super Contributor
timestamp: September 13, 2016, 10:47:58 am
content: 8051 and Pascal is a nice marriage, Don't try to use 8051 you don't need more than 256 bytes of ram to do 80% of the application for a 8 bit microprocessor, for the other 20% you can use a 32 bit ARM.Use ARM on ARM arena, and 8051 on 8051 arena, We still have legacy products with 80C31 inside, Of course ARM is better but don't shade the 8051 usability.

author: Kalvin
author_rank: Super Contributor
timestamp: September 13, 2016, 10:48:55 am
content: Quote from: westfw on September 13, 2016, 09:20:55 amIt really doesn't require much to get the 8051 up and running. If you have a part with internal EPROM/Flash program memory, you just need to add a xtal and a simple reset circuitry to make it run. Of course you need some kind of programmer in order to be able to program the on-chip EPROM/Flash.You can build a simple CPU with external RAM/EPROM onto a VERO-board with a wire-wrap wire in few hours. Here is a typical design with a xtal, reset circuit, serial port and external RAM / EPROM:Here is a simplified variant of the external RAM / EPROM without then address decoder which makes the design somewhat easier to build because you do not need the address decoder if you have only one EPROM and one RAM device:http://obrazki.elektroda.pl/6888829400_1328034735.jpg

author: wraper
author_rank: Unknown
timestamp: September 13, 2016, 10:51:50 am
content: Quote from: Kalvin on September 13, 2016, 10:26:45 amYes, the code grows significantly, and execution slows down. XDATA should be avoided for time sensitive things.

author: Kalvin
author_rank: Super Contributor
timestamp: September 13, 2016, 11:02:09 am
content: Quote from: ebclr on September 13, 2016, 10:47:58 amThe external xdata memory is very useful when you need to store and access large amount of data, but it is a good habit of trying to fit the core algorithm data structures inside the 128 or 256 byte iram. The first 128 bytes of iram can be accessed directly by the architecture which produces efficient code. The upper 128 bytes of the 256 byte iram need indirect accessing which requires using R0 or R1 as a pointer.The first compiler I used with the 8051was a Pascal compiler from the Scientific Engineering Labs**. It created pretty decent code, although it lacked support for the floats. However, getting around this lack of floats forced me to learn to use fixed point arithmetics, approximation of the functions and create some math libraries. This learning experience has proven to be priceless.** The compiler seemed to be implemented in Lisp (muLisp, if I remember correctly). There were few bugs which made the compiler to crash and print some debug messages to screen revealing the Lisp inside.

author: amyk
author_rank: Super Contributor
timestamp: September 13, 2016, 11:05:21 am
content: Quote from: westfw on September 13, 2016, 09:20:55 amYour best bet would probably be the various Chinese MCU forums... there's quite a bit of 8051 activity there, from what I've come across when searching for miscellaneous information.

author: jesuscf
author_rank: Frequent Contributor
timestamp: September 13, 2016, 10:58:29 pm
content: Quote from: westfw on September 13, 2016, 09:20:55 amNot so much a board, but modern 40-pin dips with "Classic 8051" pin outs are available, and probably can be used in older boards without too much trouble. Or you can breadboard it! Atmel carries the 89LP family: AT89LP51, AT89LP52, AT89LP6440, AT89LP3240, AT89LP51Rx2, and some other ICs I don't remember which support the external Address/Data bus. I don't know if it would make sense to add external memory though. Nowadays these modern 8051s come already loaded with Flash, RAM, ADCs, etc. so why bother, unless of course, you want to do it for fun!

author: jesuscf
author_rank: Frequent Contributor
timestamp: September 13, 2016, 11:17:51 pm
content: Quote from: blueskull on September 13, 2016, 01:53:57 amTotally agree. Quite often the peripherals are more important than the core. Also, the manuals/data-sheets! Often I like/dislike a particular product based more on its documentation that the IC itself.

author: westfw
author_rank: Super Contributor
timestamp: September 14, 2016, 01:32:54 am
content: QuotePeople get hung up on the fact that architecture can have a dramatic effect on speed. But the fact is that speed frequently doesn't matter. Those 12-clock per instruction 8051s running at only ~10MHz, using interpreted BASIC doing most of the calculations slowly in floating point were "fast enough" to solve a lot of problems. So were those BASIC Stamps running at 4clocks/ins and interpreting bytecodes that had to be read serial from EEPROM for each byte. A modern 1-clock 8051 running compiled C is going to be plenty fast for all of those things, even if the underlying code is starting to look a bit ugly.It's something I have trouble remembering myself (and it applies to things like bloated vendor libraries too.) Fast enough, small enough, and working. Is enough.QuoteHuh. It's missing the usual SSI logic that implements PSEN|RD (or whatever); can you actually get away with that?

author: Kalvin
author_rank: Super Contributor
timestamp: September 14, 2016, 06:12:57 am
content: Quote from: westfw on September 14, 2016, 01:32:54 amIt will work when you have only one EPROM/Flash device for the program memory and only one RAM device for external data memory:- The /PSEN will go low only when the program memory is accessed. The RAM device's /WR and /RD will be high, so the RAM device will not be accessed.- The /RD will go low only when the external RAM is read. The program memory /PSEN will be high so the Flash/EPROM will not be accessed.- The /WR will go low only when the external RAM is written. The program memory /PSEN will be high so the Flash/EPROM will not be accessed.The /CS signals of the Flash/EPROM and the RAM can thus be tied to ground permanently without any problem. Only problem might be a slight increase of the power consumption if the memory devices go to low power mode when the /CS is high. That is a neat trick to save some logic gates. If you have more than one Flash/EPROM or RAM devices, you typically need an address decoder like 74HCT138 or similar.

author: nctnico
author_rank: Super Contributor
timestamp: September 14, 2016, 09:49:39 am
content: Quote from: westfw on September 14, 2016, 01:32:54 amNo you can't. On some 8051 cores the RD and WR will glitch during that period because they are undefined. I have seen this cause RAM corruption and a great deal of grieve because it was a hard problem to tackle.

author: danadak
author_rank: Super Contributor
timestamp: September 14, 2016, 10:26:54 am
content: Tackle a PSOC -1) Free and very effective gui tools2) ARM or 8051 core, focus on ARM first3) Low cost boards, proto tools. Even Arduino layout boards for bluetooth or lowend4) Chip allows you to route signals internally and to pins5) DMA, DSP, 12 bits SAR, 20 bit DelSig, OpAmps, Muxes, Comparator, onchip .1% reference,large library of gui components with APIs.6) Digital can be customized with Verilog7) Tons of COMCustom component editor and DSP ASM wizard tool (DSP has a GUI tool where noASM written)See attached component list and a simple exampleRegards, Dana.

author: Kalvin
author_rank: Super Contributor
timestamp: September 14, 2016, 10:50:39 am
content: Quote from: nctnico on September 14, 2016, 09:49:39 amGood point. It it always a good practice to check the actual data sheet. I have been able to use the trick in hand-made wire-wrap prototypes with the legacy 8051 devices (12 clock cycles per instruction) without any problems, though. The newer 8051 variants may have more stringent timing requirements which require proper address decoding and proper /RD and /WR logic.

author: nctnico
author_rank: Super Contributor
timestamp: September 14, 2016, 04:10:22 pm
content: Stuff like this isn't in the datasheet. Because RD and WR are undefined they can be whatever the chip designer likes them to be. IOW: you always have to use the extra logic ports. If a 8051 works it is due to pure luck and even then it may fail in subtile ways.

author: Kalvin
author_rank: Super Contributor
timestamp: September 14, 2016, 04:23:40 pm
content: Quote from: nctnico on September 14, 2016, 04:10:22 pmAccording to Intel's 8051 datasheet the /RD and /WR are well defined. See page 3-9 (pdf page 117) and pages 3-35 - 3-35 (pdf pages 142-143):http://web.mit.edu/6.115/www/document/8051.pdfThe extra logic will not hurt, though.Ps. If the system has 64KB Flash/EPROM and 64KB RAM, the address decoder will always enable the /CS of both chips, and effectively only the /PSEN, /RD and /WR will provide the read and write strobing and the address decoder will be unnecessary: Thus the /RD and /WR can be wired directly to RAM if there is only one RAM device. The 8051 bus interface doesn't have any other way of telling when the read or write bus cycle is active.

author: nctnico
author_rank: Super Contributor
timestamp: September 14, 2016, 06:20:13 pm
content: Quote from: Kalvin on September 14, 2016, 04:23:40 pmThe extra logic is necessary. This is the grey area where datasheets can be inaccurate and there can be difference between the various manufacturers. Again: I've seen this go horribly wrong (with an NXP 8051).

author: legacy
author_rank: Super Contributor
timestamp: September 14, 2016, 07:36:09 pm
content: Quote from: nctnico on September 12, 2016, 04:43:18 pmcan you give me an example, please?

author: nctnico
author_rank: Super Contributor
timestamp: September 14, 2016, 08:34:56 pm
content: Quote from: legacy on September 14, 2016, 07:36:09 pmStack, function parameters, constant function pointers, pointers in general (with 3 different memories software has to figure out which memory a pointer is pointing to).

author: legacy
author_rank: Super Contributor
timestamp: September 15, 2016, 02:51:26 am
content: *java(v1)* on i51?possible, already done by Dalsemi(1)it was called "tini java" project(2)around 2001-2004 a few kits existedat that time for ~50 USDthe core was an DS80C390 chipwhich is an i51 under steroidswhereas DS80C400-ish... comes with SDCC C support(1) Dallas Semiconductor, acquired by Maxim Integrated Products in 2001(2) Tini JavaTM Platform, v 1.16

author: jesuscf
author_rank: Frequent Contributor
timestamp: September 15, 2016, 07:02:17 am
content: Quote from: blueskull on September 14, 2016, 07:44:56 pmThe same happens to every other processor for some size variables. Even for some 32 bit processors 32-bit assignments may not be atomic. For example I have seen this kind of immediate assignments in a mips architecture (please correct me if I am wrong, as I don't have a lot experience with mips)://Load s0 with 0xa0000100lui s0, 0xa000ori s0, 0x0100Granted, access of non-atomic variables is a pain in the 8051, but it is probably a pain in every other 8-bit processor. On the other hand, atomic bit variables in the 8051 are quite handy to deal with this problem without even disabling interrupts:volatile bit mybitflag;volatile unsigned long ISR32bitvar;// Inside the ISRmybitflag=1; // in assembly: setb _mybitflagISR32bitvar++;// Outside the ISRunsigned long Work32bitvar;do{mybitflag=0; // in assembly: clr _mybitflagWork32bitvar=ISR32bitvar;} while (mybitflag); // in assembly: jb _mybitflag, do_loopprintf("ISR32bitvar=%ld\n", Work32bitvar);If the compiler is smart enough it may even use the the jbc instruction which makes the code a bit more efficient.

author: legacy
author_rank: Super Contributor
timestamp: September 15, 2016, 11:44:46 am
content: Quote from: jesuscf on September 15, 2016, 07:02:17 amI am afraid you are not wrongdue to the pipeline strict constraints in their designMIPS machines happened to have fix the fetch length always equal to 32bittherefore if you want to load a constant of 32bit you need to decompose itinto two sub constants of 16 bit each"lui" stands for "load upper immediate"it loads a constant and it shifts on the left by 16here we go with the high-address (bits from 31 to 16)so you can bitwiseOr the high-address with the low-address (bits from 15 to 0)and you get the final addressthose two instructions can be interrupted and there is a probability of disasterbut well, tricks are availablesomething like protecting the address_set by disabling interruptor like keeping the high-address already stored in ramtherefore you only need to load the low-address, which is atomic somehowother tricks ?the proof that it actually works, anyhow, it that SGI sold a lot of IRIX machinesIRIX was a very big hit unix-like, running on MIPS machines, from R4400 to R16000that's a shit, no doubt about, but those tricks have saved us(about MIPS, those tricks are known as "voodoo programming")p.s.I have developed my own ISA for an hobby softcore called "Arise-v2"and I wanted to relax the fixed length constrainttherefore I can load a constant of 32bit atomicallyit's not a problem for my design, it's just 1 clock tick stall in the pipeline

author: nctnico
author_rank: Super Contributor
timestamp: September 15, 2016, 03:52:55 pm
content: On ARM loading a constant into a register is usually done by putting the constant near a function (before, after or in between) and the use PC+offset to load the constant into a register by indexed addressing. I'm pretty sure you can do the same on MIPS and it would make loading a 32 bit constant atomic (again).

author: legacy
author_rank: Super Contributor
timestamp: September 15, 2016, 09:30:18 pm
content: MIPS,load32

author: legacy
author_rank: Super Contributor
timestamp: September 15, 2016, 09:35:27 pm
content: do you meanload-link, store-conditional?MIPS has LL/SC

author: nctnico
author_rank: Super Contributor
timestamp: September 15, 2016, 09:54:34 pm
content: No the LW instruction. See:http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html

author: westfw
author_rank: Super Contributor
timestamp: September 15, 2016, 11:53:49 pm
content: Loading a register with a 32bit constant doesn't need to be atomic... (perhaps "shouldn't"? Surely you're not going to write an ISR that messes with register contents?!)

author: CatalinaWOW
author_rank: Super Contributor
timestamp: September 16, 2016, 12:07:50 am
content: So much angst about an architecture. There are only two. Dartmouth and Harvard. In many flavors. Once you have learned one of each kind it isn't that difficult to pick up the next one.Many of the answers here aren't responding to the question - is it worth learning 8051, they are argueing about what the best architecture is. Which doesn't have a singular answer. Depends on your application, your customer, your tools, your background and a few other things. Anwers given above are generally correct - for part of the question.Is it worth learning 8051? I would say there are two things which might make the answer yes - at least for a basic skill level. Becoming a guru requires even better reasons. One, if you haven't used something of that class before it is good to expand your knowledge base. Two, if you have some particular hardware reason (a freight car load of chips, an application with full code available, a repair or upgrade on a legacy system or any number of similar things.)

author: legacy
author_rank: Super Contributor
timestamp: September 16, 2016, 12:16:59 am
content: Quote from: nctnico on September 15, 2016, 09:54:34 pmso you bypass the problem through the load/store unitwhich actually does a load/store of 32bit one-shotand stalls the whole pipeline until conclusionyes, it works

author: legacy
author_rank: Super Contributor
timestamp: September 16, 2016, 12:27:01 am
content: Quote from: westfw on September 15, 2016, 11:53:49 pmhere we go, e.g. a software debugger is called in kernel space, sometimes beyond an ISR,and it needs to access the register (or the context) contentsand in this case address must be completedtherefore you must assure the load-affective-address has completed before being interrupted-> good practice and good habit

author: westfw
author_rank: Super Contributor
timestamp: October 11, 2016, 12:43:11 am
content: QuoteDoes anyone want to do a design/schematic/pcb review of such a board?8051 + 32pin JEDEC device + FTDI connector + I2C serial EEPROM (maybe, for "serial download to EEPROM and bootloader into RAM.") 100x50mm for cheap fab...

author: technix
author_rank: Super Contributor
timestamp: October 11, 2016, 02:16:57 am
content: Quote from: westfw on October 11, 2016, 12:43:11 amI have cooked up a design:* AT89C51RC @ 24MHz (any 8031 or 8032 would work though, but chips with flash allows the internal ROM being used as a boot loader)* I-bus and D-bus fused on the board (so the XRAM and XROM are really the same bus, effectively a Princeton architecture)* GAL16V8 as bus matrix controller, reads A15..11, RD, WR and PSEN, emits OE, WE and 6 chip selects* 3x AT28C64 (or FM16W08) for 24kB NVRAM at 0x0000-0x5fff* IS61C256 for 32kB SRAM at 0x8000-0xffff* HD44780-compatible LCD at 0x7800-0x7fff (0x7800-7bff goes to IREG, 0x7c00-0x7fff goes to DREG* External bus interface at 0x6000-0x77ff and one chip select* Port 1 and port 3 broken out as-is, except UART pins* ATtiny2313A @ 12MHz for USB to Serial adapter, 8051 POR and entering boot loader mode* 100% through hole construction

author: westfw
author_rank: Super Contributor
timestamp: October 14, 2016, 11:26:18 am
content: QuoteSigh. That's about what I figured. Once you go to multiple chips, everybody has different ideas about what they want/need.(as it happens, I have SO much 32pin EPROM, RAM, and NVRAM, I'm not really interested in anything that decodes for 8kbyte chips.)

author: legacy
author_rank: Super Contributor
timestamp: October 14, 2016, 12:11:28 pm
content: Quote from: westfw on October 11, 2016, 12:43:11 amsure

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2016, 12:37:06 pm
content: Quote from: westfw on October 14, 2016, 11:26:18 amThe posts about the boards do take me back a couple of decades. I designed several boards like that for various purposes and with different microcontrollers as well. Good old times -sigh-. Where is the man-with-grey-beard emoticon?

author: technix
author_rank: Super Contributor
timestamp: October 15, 2016, 07:45:45 pm
content: Quote from: westfw on October 14, 2016, 11:26:18 amI am running 8051 in Princeton architecture, with XRAM and XROM pointing to the same location. That is a major change in system architecture implemented on the board level. I gave it 24kB NVRAM (notice I am not calling it ROM here, instead it is called NVRAM) and 32kB SRAM so the programmer can have adequate code and data space, as you can put code into the NVRAM (or SRAM) and jump right into it.The IROM on the AT89C51RC is being used as a bootloader, only being used to upload data into the NVRAM. If I breaks the self-imposed limit on using only through-hole parts I would even throw in an FT245 as the USB interface chip instead of ATtiny2313 + V-USB.

author: legacy
author_rank: Super Contributor
timestamp: October 15, 2016, 08:06:50 pm
content: Quote from: technix on October 15, 2016, 07:45:45 pmPSEN mixed with WR ?

author: legacy
author_rank: Super Contributor
timestamp: October 15, 2016, 08:10:17 pm
content: guys, so,pascal 51actually exists

author: technix
author_rank: Super Contributor
timestamp: October 16, 2016, 02:29:10 am
content: Quote from: legacy on October 15, 2016, 08:06:50 pmPSEN (Read/Execute) mixed with RD. Yeah that is the point.