6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Oct 07, 2024 8:19 am

All times are UTC




Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Sun Aug 11, 2013 6:27 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8417
Location: Midwestern USA
ElEctric_EyE wrote:
DMA would take precedence over FPU.

Although I haven't tried it, I think you could cobble together a single channel DMA controller with a CPLD or FPGA. I've entertained thoughts about it (DMA would speed up my POC's SCSI I/O loops by a factor of 8 at least), but am already monkeying with a lot of stuff.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 12, 2013 4:51 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
ElEctric_EyE wrote:
DMA would take precedence over FPU.

On an FPGA, DMA is a trivial exercise compared to an FPU :)


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 31, 2013 11:22 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
Having done a lot of low-level work with ARM chips, I have to say that I am not at all happy with the instruction set. While it's pretty entrenched at this point, it would not be that hard to compete on technical ground anyway. ARM instruction set is bloated and big, thumb is too limited (and still big), thumb2 is just crazy complicated and stupid. And newer chips have picked up additional instruction sets and co-processors not unlike x86. The whole thing is a big disaster. I'd love to see a 65xxx alternative, hopefully simple and at least a little less stupid than the ARM.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 6:16 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
I did lots of ARM assembly programming, and I liked it a lot. Only took a few days to get reasonably fluent in it. I also did some Thumb programming, but never liked it as much. Thumb-2 is even worse for a human programmer.

But you have to realize these instruction sets are not designed to be elegant or simple. They are designed to get the job done efficiently, and they are intended to be used with a compiler for a higher level language. Thumb-2 does a very good job of packing a lot of power in small space.


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 2:54 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
The original ARM instruction set is OK, but the new Cortex chips don't even support it. Thumb2 requires keeping track of too much state for my liking, as in the conditional bitmap that covers the next 4 instructions...

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 3:16 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
I agree, Thumb2 isn't pretty. But that was never the design goal. It was designed to be able to write programs in C, rather than assembly, and they've extended that even to reset handlers and interrupt routines, which can be written in straight C, without special compiler tricks or assembly helpers. On top of that, Thumb2 is fast and dense.

Of course, the result is hard to write for humans, but very few people ever need to do that, so it's a good trade off.


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 3:25 pm 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10949
Location: England
I wrote just a little Thumb2 for my a6502 emulator: it turns out I didn't use many predicated instructions, and when I did I only had a single one, so the 'ifthen' opcode only appears once, with a single suffix, right before the affected instruction. It wasn't tricky, just a bit of syntax.

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 4:27 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
I guess I am just a grouch.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 8:53 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8522
Location: Southern California
Quote:
It was designed to be able to write programs in C, rather than assembly

I don't have any problem with different processors being for different applications, and that the 32-bit 4GHz one is not always best.  I was just watching a YouTube video last night about a 32-bit 80MHz PIC32 where the man was demonstrating the speed, but he programmed it in C and a loop to flash an LED only got about a million flashes per second.  I thought, "Wow, in assembly, I could get that speed out of an 8-bit 20MHz PIC16!  In fact, with I/O in ZP, a 9MHz 6502 could do it, and the program is shorter than what he had in C, IIRC.  I maintain that one of the beauties of 6502/816 is the ease of writing in assembly.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 01, 2013 10:47 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
That probably doesn't have much to do with C vs assembler, but more with the way the hardware works (some hardware doesn't have fast access to I/O or runs from slow flash memory), or how the program was written.

On a recent project I did 250000 I/O switches per second, each switch setting one bit, and clearing another, using variable patterns read from a linked list. This was on a 112MHz ARM, written in C, using a timer interrupt. However, I had to move the interrupt handler to SRAM, because flash was too slow and too variable.


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 02, 2013 12:14 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
GARTHWILSON wrote:
I was just watching a YouTube video last night about a 32-bit 80MHz PIC32 where the man was demonstrating the speed, but he programmed it in C and a loop to flash an LED only got about a million flashes per second.

I think I found the video here. The guy isn't really making any sense. I tried it myself. The C code is just this:
Code:
while( 1 )
    PORTFINV = (1 << 3);

The PORTFINV register is the 'invert' register for PORT F, and writing a '1' inverts the corresponding bit. Despite the man's explanation that this is a C compiler, and writing to the port is translated to "a bunch of code", the C compiler turns this into minimal code:
Code:
9fc00114:   da80        sw  a0,0(v0)
9fc00116:   17fe        b   9fc00114

The reason this executes so slowly is probably because he used the default settings for the chip, which is to run with cache disabled, and 7 wait states on the flash. With cache enabled, speed is about 17M toggles/sec, including the loop overhead.

And if you unroll the loop, and use SET/CLR registers instead of INV, it will run at a full 80M changes/sec.


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 02, 2013 2:31 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Code:
9fc00114:   da80        sw  a0,0(v0)
9fc00116:   17fe        b   9fc00114

The core will be executing a nop after the branch so there are 3 instructions per loop plus the flash delay cycles.

With cache enabled and the code reorganized to
Code:
b $
sw a0,0(v0)

to put the invert in the delay slot it should be much faster.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 02, 2013 2:49 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Actually, in the MIPS16 ISA, there are no branch delay slots. Only MIPS32 has those.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC


Who is online

Users browsing this forum: handyandy and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: