The RTF65002 Core
Re: The RTF65002 Core
The RTF65002 core has been updated to add 65c816 backwards compatibility. It's currently untested, but synthesizes. The core size increased by about 20% and slowed down to 40MHz.
Code is on Github.
Code is on Github.
Re: The RTF65002 Core
Wow, nice work - could this be the first HDL core with '816 operation?
Here's the link: https://github.com/robfinch/Cores/tree/ ... 5002/trunk
What's the license Rob?
Cheers
Ed
Here's the link: https://github.com/robfinch/Cores/tree/ ... 5002/trunk
What's the license Rob?
Cheers
Ed
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: The RTF65002 Core
BigEd wrote:
Wow, nice work - could this be the first HDL core with '816 operation?...
Cheers
Ed
Cheers
Ed
Re: The RTF65002 Core
BigEd wrote:
What's the license Rob?
I've found and fixed several bugs in the core over the last couple of days. The '02 and 32 bit modes seem to work still as I can run my test system, but I really need some '816 code for testing.
Re: The RTF65002 Core
> LGPL
Great - thanks!
Here's a short 65816 program:
viewtopic.php?p=15531#p15531
It might not be terribly suitable as a test...
Here's a pointer to a C compiler: viewtopic.php?p=8321#p8321
I wonder if rigging up an Apple IIGS type environment would be useful, and then running the ROMs for that machine, as a test?
Great - thanks!
Here's a short 65816 program:
viewtopic.php?p=15531#p15531
It might not be terribly suitable as a test...
Here's a pointer to a C compiler: viewtopic.php?p=8321#p8321
I wonder if rigging up an Apple IIGS type environment would be useful, and then running the ROMs for that machine, as a test?
Re: The RTF65002 Core
BigEd wrote:
Here's a short 65816 program:
viewtopic.php?p=15531#p15531
It might not be terribly suitable as a test...
viewtopic.php?p=15531#p15531
It might not be terribly suitable as a test...
I managed to fix several "hardware" bugs while trying to run this program.
BigEd wrote:
I wonder if rigging up an Apple IIGS type environment would be useful, and then running the ROMs for that machine, as a test?
I have an real IIe sitting at home with an 65C802 cpu in it.
Re: The RTF65002 Core
(It should print the digits of pi - 314 zeros would be forgivable, or even 360, but preferably the first digit should be 3.)
Re: The RTF65002 Core
I haven't figured it out yet. There must be an instruction that's failing. When I dump the P array it's all zeros. So candidates are a store that stores zero, (sta P-1,x) or perhaps a shift/rotates fails when doing multiplication or division. It's slow going debugging at the moment because it take 1 1/2 hours place and route. It does seem to iterate properly.
I repost the PI calc code in case I copied it wrong somewhere.
I repost the PI calc code in case I copied it wrong somewhere.
Code: Select all
P EQU 2
Q EQU 1193*2 + 2
R EQU Q + 2
SSS EQU R + 2Code: Select all
Test816:
clc
xce
cpu W65C816S
rep #$30 ; acc,ndx = 16 bit
mem 16
ndx 16
lda #$1800 ; setup stack pointer
tas
jsr INITSUB
ldx #359
ldy #1193
L1S:
phy
pha
phx
stz Q
; txa
; ldx #5
; wdm
; xce
; cpu RTF65002
; jsr PRTNUM
; clc
; xce
; cpu W65C816S
; rep #$30
; plx
; phx
tya
tax
L2S:
txa
jsr MULSUB
sta SSS
lda #10
sta Q
jsr ADJ1SUB
lda P-1,x
jsr UNADJ1SUB
jsr MULSUB
clc
adc SSS
sta Q
txa
asl
dea
jsr DIVSUB
jsr ADJ1SUB
sta P-1,x
jsr UNADJ1SUB
dex
bne L2S
lda #10
jsr DIVSUB
sta P
plx
pla
ldy Q
cpy #10
bcc L3S
ldy #0
ina
L3S:
cpx #358
bcc L4S
bne L5S
jsr OUTPUTSUB
lda #46
L4S:
jsr OUTPUTSUB
L5S:
tya
eor #48
ply
cpx #358
bcs L6S
dey
dey
dey
L6S:
dex
beq L7S
jmp L1S
L7S:
jsr OUTPUTSUB
wdm
xce
cpu RTF65002
rts
cpu W65C816S
INITSUB:
lda #2
ldx #1192
IS1:
jsr ADJSUB
sta P,x
lda P,x
eor #48
jsr OUTPUTSUB
eor #48
jsr UNADJSUB
dex
bpl IS1
rts
MULSUB:
sta R
ldy #16
M1S: asl
asl Q
bcc M2S
clc
adc R
M2S: dey
bne M1S
rts
DIVSUB:
sta R
ldy #16
lda #0
asl Q
D1S: rol
cmp R
bcc D2S
sbc R
D2S: rol Q
dey
bne D1S
rts
ADJSUB:
pha
txa
asl
tax
pla
rts
UNADJSUB:
pha
txa
lsr
tax
pla
rts
ADJ1SUB:
pha
txa
asl
tax
pla
dex
rts
UNADJ1SUB:
pha
txa
lsr
tax
pla
inx
rts
OUTPUTSUB:
wdm ; switch to 32 bit mode
xce
cpu RTF65002
jsr DisplayChar
clc ; switch back to 816 mode
xce
cpu W65C816S
rep #$30 ; acc,ndx = 16 bit
rts
Re: The RTF65002 Core
As you have a 65802 system, can you add some instrumentation to the code and debug the difference that way? Going around a 90m P+R loop does sound arduous!
Cheers
Ed
Cheers
Ed
Re: The RTF65002 Core
BigEd wrote:
As you have a 65802 system, can you add some instrumentation to the code and debug the difference that way? Going around a 90m P+R loop does sound arduous!
But, phew! I finally fixed the bug and now it works ! It displays the digits of PI. The bug was in storing 16 bit data, it would place the same data for both the first and second write cycles. It didn't matter with eight bit data.
Re: The RTF65002 Core
That's great! And you got a quick-build option out of it too...
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: The RTF65002 Core
Rob Finch wrote:
...90m P+R isn't really acceptable to me, so I tweaked the core a little bit and reduced the time to 10m. It's amazing how the slightest change can cause the P+R time to vary by a lot. It's because the core is complex so a slight change in routing makes/breaks it...
Re: The RTF65002 Core
ElEctric_EyE wrote:
What are the spec's of your desktop machine Rob? That is a terrible time to wait! Also, what version of ISE are you using?
I can easily do other things on my desktop (like browsing the internet or working on the software) while waiting. It's just the turn-around time for testing a bug fix can be annoying sometimes.
One issue with using a larger FPGA is the undoutbedly longer P+R times.
Re: The RTF65002 Core
RTF65002 now incorporates a spinlock (SPL) instruction. This instruction continuously polls a memory location until the contents of the memory location are non-zero.
The memory must be set to non-zero by another processor OR by an interrupt routine. (The SPL instruction is interruptible).
The instructions replaces spinlock code that looks like:
The code becomes just:
The idea is to use the instruction in conjuction with hardware semaphoric memory. Note the new code is two bytes shorter and several cycles faster as a branch has been eliminated.
The memory must be set to non-zero by another processor OR by an interrupt routine. (The SPL instruction is interruptible).
The instructions replaces spinlock code that looks like:
Code: Select all
j1:
lda semaphore+1
beq j1
Code: Select all
spl semaphore+1
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA