Recent

Author Topic: FPC for SPARC v7  (Read 13362 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: FPC for SPARC v7
« Reply #15 on: March 29, 2022, 09:04:30 pm »
The V7 has an operation for step multiplication. I would think it would be pretty trivial to add that into the sparc compiler. I don't know how to do that....yet....because like I said, assembler escapes me.

Assembler
Syntax: mulscc regrs1, reg_or_imm, regrd
Description: The multiply step instruction can be used to generate the 64-bit product of two signed or unsigned
words.

I've seen discussion of division by reciprocal approximation in various places including https://hackaday.com/2021/12/09/apple-falling-division/

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #16 on: March 29, 2022, 11:30:02 pm »
I can't imagine it would be too hard to write a multiply function in assembler. It would be a slight performance hit, but I think that really only matters if you're writing demos, which is the only time I've used what little ASM I know  :)

Now y'all are going to make me learn assembler seriously  >:D

That's fine because I'm really enjoying this low-level stuff! Y'all are gonna have me writing my own OS in no time

PascalDragon

  • Hero Member
  • *****
  • Posts: 6395
  • Compiler Developer
Re: FPC for SPARC v7
« Reply #17 on: March 30, 2022, 09:19:18 am »
The RTL already contains software multiplication and division routines. You “just” need to enable them for the V7 (search for FPC_INCLUDE_SOFTWARE_MOD_DIV and FPC_INCLUDE_SOFTWARE_MUL in the rtl directory to see where they're defined) and then you need to adjust the SPARC generator to make use of these functions for V7 (search for fpc_mul, fpc_div and fpc_mod in the compiler directory to get example for other targets (e.g. AVR)).

Later on you can still provide assembly optimized versions, but as a first step these should work (and you need to adjust the compiler to call the functions anyway).

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #18 on: March 30, 2022, 09:03:59 pm »
Thanks PascalDragon!

That sounds easy and at my current skill set just to get it to work. I'm learning assembler on a raspberry pi, which is a much easier ISA and there are tons of helpful tutorials for it before I try adding in a assembler multiplier, and it's definitely a skill I'll need to reach my goal to have FPC running on an SGI :)

PascalDragon

  • Hero Member
  • *****
  • Posts: 6395
  • Compiler Developer
Re: FPC for SPARC v7
« Reply #19 on: March 31, 2022, 09:06:11 am »
I hope you're learning 64-bit ARM assembly and not the 32-bit one, cause the former is definitely nicer ;)

MathMan

  • Hero Member
  • *****
  • Posts: 504
Re: FPC for SPARC v7
« Reply #20 on: March 31, 2022, 10:18:54 am »
..<snip>

I've seen discussion of division by reciprocal approximation in various places including https://hackaday.com/2021/12/09/apple-falling-division/

MarkMLl

@MarkMLI, @praetor - I do have something like that (based on Möller, Granlund) implemented in Pascal and it is quite fast actually (on x86-64 it is about 1-2x the respective DIV instruction). Don't have it at hands reach now, cause I'm in office but can place it here tomorrow if there is any interest.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: FPC for SPARC v7
« Reply #21 on: March 31, 2022, 10:36:15 am »
@MarkMLI, @praetor - I do have something like that (based on Möller, Granlund) implemented in Pascal and it is quite fast actually (on x86-64 it is about 1-2x the respective DIV instruction). Don't have it at hands reach now, cause I'm in office but can place it here tomorrow if there is any interest.

I'm sure it's worth getting into the record :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #22 on: March 31, 2022, 05:12:19 pm »
I hope you're learning 64-bit ARM assembly and not the 32-bit one, cause the former is definitely nicer ;)

No. 32bit because right now the only Pis I have available for tinkering is my Pi Zeros. My Pi3 is busy running my DNS/NIS server and the last thing I want to do is screw around with interrupts and take down my NIS server :p

I'm enjoying it though since a lot of the assembler tutorials for the pi are easy to digest. I have pretty bad anxiety and I'm finding assembler is pretty relaxing because you have to slow down and really think about what you're doing.
« Last Edit: March 31, 2022, 05:15:46 pm by praetor »

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #23 on: March 31, 2022, 05:13:49 pm »
..<snip>

I've seen discussion of division by reciprocal approximation in various places including https://hackaday.com/2021/12/09/apple-falling-division/

MarkMLl

@MarkMLI, @praetor - I do have something like that (based on Möller, Granlund) implemented in Pascal and it is quite fast actually (on x86-64 it is about 1-2x the respective DIV instruction). Don't have it at hands reach now, cause I'm in office but can place it here tomorrow if there is any interest.

I  agree with MarkMLI. Seeing something like that would be very helpful!

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: FPC for SPARC v7
« Reply #24 on: March 31, 2022, 05:47:27 pm »
I'd add https://www.chrisfenton.com/homebrew-cray-1a/ for general interest, which is where I first saw mention of this style of refinement.

The chap does some interesting stuff, and it was interesting to see his opinion of Turbo Pascal http://www.chrisfenton.com/dd9-kaypro-edition/ It was even more interesting to see him build a custom system for it using a massive FPGA junked from work http://www.chrisfenton.com/the-zedripper-part-1/

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #25 on: March 31, 2022, 07:01:23 pm »
I'd add https://www.chrisfenton.com/homebrew-cray-1a/ for general interest, which is where I first saw mention of this style of refinement.

The chap does some interesting stuff, and it was interesting to see his opinion of Turbo Pascal http://www.chrisfenton.com/dd9-kaypro-edition/ It was even more interesting to see him build a custom system for it using a massive FPGA junked from work http://www.chrisfenton.com/the-zedripper-part-1/

MarkMLl

I love this guy! He's on hackaday a lot for his wild projects. A mini Cray-1! Your average phone has more power but what fun!

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: FPC for SPARC v7
« Reply #26 on: March 31, 2022, 09:55:18 pm »
I love this guy! He's on hackaday a lot for his wild projects. A mini Cray-1! Your average phone has more power but what fun!

Hackaday is a remarkably useful resource: I'm "a little" behind in my reading, but have just reached January 1st 2021 :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

praetor

  • New Member
  • *
  • Posts: 15
Re: FPC for SPARC v7
« Reply #27 on: March 31, 2022, 10:03:47 pm »
I love this guy! He's on hackaday a lot for his wild projects. A mini Cray-1! Your average phone has more power but what fun!

Hackaday is a remarkably useful resource: I'm "a little" behind in my reading, but have just reached January 1st 2021 :-)

MarkMLl

Except it makes you spend money :p This is my latest "I saw this on hackaday and HAD TO HAVE IT" purchase. It's a kewt little kitty thermal printer. Right now it's driven by Python, but I think I'm going to reimplement it in Pascal :D

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: FPC for SPARC v7
« Reply #28 on: March 31, 2022, 10:50:21 pm »
Except it makes you spend money :p This is my latest "I saw this on hackaday and HAD TO HAVE IT" purchase. It's a kewt little kitty thermal printer. Right now it's driven by Python, but I think I'm going to reimplement it in Pascal :D

I've written some code which so far supports a thermal-transfer ribbon printer and a Dymo. I suspect it would support those with a bit of fettling, but I've had no immediate need to investigate. Input from a .pbm file, typically prepared using Inkscape with a .png as an intermediate.

Later: I've checked and so far the support for a Dymo LabelManager is basically skeletal. I'll probably rework this to ensure that the hardware-specific bit can be loaded dynamically from a shared library.

MarkMLl
« Last Edit: April 01, 2022, 09:46:19 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MathMan

  • Hero Member
  • *****
  • Posts: 504
Re: FPC for SPARC v7
« Reply #29 on: April 01, 2022, 01:03:11 pm »
..<snip>

I've seen discussion of division by reciprocal approximation in various places including https://hackaday.com/2021/12/09/apple-falling-division/

MarkMLl

@MarkMLI, @praetor - I do have something like that (based on Möller, Granlund) implemented in Pascal and it is quite fast actually (on x86-64 it is about 1-2x the respective DIV instruction). Don't have it at hands reach now, cause I'm in office but can place it here tomorrow if there is any interest.

I  agree with MarkMLI. Seeing something like that would be very helpful!

@praetor, @MarkMLI - I'm a bit behind on that one. Turned out to be more work than I estimated. All that stuff is deeply burried in my arbitrary precision package. It's a bit more work to bring it to the top, do the necessary re-factoring to specialise to the use case at hand etc. Pls bear with me - I should find the time during weekend.

Cheers,
MathMan

 

TinyPortal © 2005-2018