Author Topic: Seems there is Hardware divide on Ch32v003?  (Read 2499 times)

0 Members and 1 Guest are viewing this topic.

Offline HeindalTopic starter

  • Contributor
  • !
  • Posts: 16
  • Country: us
Seems there is Hardware divide on Ch32v003?
« on: December 12, 2024, 04:46:40 pm »
Was testing ch32v003  Integer performance and i noticed the divide works as if there is a hardware divider even though ch32v003 doesnt have the "M" extension which supports divide and multiply. Just curious, could Wch have included a hardware divider even though the core is RV32EC
Duplicate account of "keikai"" and "shiro007".
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12494
  • Country: us
    • Personal site
Re: Seems there is Hardware divide on Ch32v003?
« Reply #1 on: December 12, 2024, 05:35:44 pm »
What do you mean by " as if there is a hardware divider"? If there is a hardware divider, there would be a corresponding instruction in the disassembly. Look in the disassembly and see what is there. You won't see one, since compiler will not issue it if you don't specify M extension in the build options.
« Last Edit: December 12, 2024, 05:57:28 pm by ataradov »
Alex
 

Offline HeindalTopic starter

  • Contributor
  • !
  • Posts: 16
  • Country: us
Re: Seems there is Hardware divide on Ch32v003?
« Reply #2 on: December 12, 2024, 06:37:54 pm »
it seemed like it has one because while i was getting low multiply performance , the division was a different case. It could be the compiler optimizing the code using  right shift if the number is a power of 2. Changed the code to using only numbers that arent powers of 2 and its back to expected behavior from 6 MIops to 1 MIops.
Duplicate account of "keikai"" and "shiro007".
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17822
  • Country: fr
Re: Seems there is Hardware divide on Ch32v003?
« Reply #3 on: December 12, 2024, 10:24:37 pm »
Yes dividing unsigned ints by powers of two are always optimized as right shifts by any reasonable compiler.

The CH32V003 has a QingKe RISC-V2A core, which is RV32EC: it has only 16 registers and *not even a hardware multiplier*, as far as the docs tell anyway.

Just FYI, the V2C core supports the "m" extension (hardware multiplier but no hardware divider, equivalent to Zmmul), but apparently the MCUs with such a core are these:
https://github.com/openwch/ch32v002_004_005_006_007

CH32V002, CH32V004, CH32V006 and CH32V007.

They don't seem to be listed on WCH's website directly (although, no offense, but I think it's a bit of a mess), but you can find docs by directly looking up the references, like this:
https://www.wch-ic.com/downloads/CH32V004DS0_PDF.html
They don't seem to be available at LCSC.
 

Offline HeindalTopic starter

  • Contributor
  • !
  • Posts: 16
  • Country: us
Re: Seems there is Hardware divide on Ch32v003?
« Reply #4 on: December 15, 2024, 12:08:40 am »
Yeh.  i was kind of looking to buy ch32v007 and other ones but havent seen anything
Duplicate account of "keikai"" and "shiro007".
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6464
  • Country: nz
Re: Seems there is Hardware divide on Ch32v003?
« Reply #5 on: December 15, 2024, 02:23:55 am »
Have you pinged @patrick_riscv on X?
 

Online HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1931
  • Country: gb
Re: Seems there is Hardware divide on Ch32v003?
« Reply #6 on: December 15, 2024, 01:56:12 pm »
I'm confused about what WCH are doing with the '002/4/5/6/7. I looked to get some last month, but nothing to be found anywhere. Nothing on AliExpress, LCSC, even TaoBao (albeit the international site).

It seems they aren't selling them outside of China? Even their actual existence is only mentioned on the Chinese website. But they have, and continue to update, English documentation.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17822
  • Country: fr
Re: Seems there is Hardware divide on Ch32v003?
« Reply #7 on: December 16, 2024, 12:14:47 am »
Similarly with the CH32V317 (which I talk about in another thread). But as Bruce said, if you're really interested in those models, just contact Patrick from WCH.
 

Offline Chicane

  • Contributor
  • Posts: 39
  • Country: us
Re: Seems there is Hardware divide on Ch32v003?
« Reply #8 on: December 16, 2024, 01:48:43 pm »
I'm confused about what WCH are doing with the '002/4/5/6/7. I looked to get some last month, but nothing to be found anywhere. Nothing on AliExpress, LCSC, even TaoBao (albeit the international site).

It seems they aren't selling them outside of China? Even their actual existence is only mentioned on the Chinese website. But they have, and continue to update, English documentation.

They are still available on Aliexpress. I bought a full kit 2 months ago for cheap and it came to US in 8-9 days.
https://www.aliexpress.us/item/3256804882924346.html
 

Online HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1931
  • Country: gb
Re: Seems there is Hardware divide on Ch32v003?
« Reply #9 on: December 16, 2024, 02:19:34 pm »
They are still available on Aliexpress. I bought a full kit 2 months ago for cheap and it came to US in 8-9 days.
https://www.aliexpress.us/item/3256804882924346.html

That's for the '003 (and '203). I was specifically talking about the '002/4/5/6/7. They are not the same.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->