Posts

Showing posts from January, 2024

ESP32-S3 SIMD Minimal Example

In my recent blog post , I described the ESP32-S3 SIMD instructions and how I figured out how to use them. This post is to provide the simplest working example to serve as a starting point for your own projects. The code was designed for the Arduino IDE, but will work similarly on Espressif's ESP-IDF. To add assembly language files (.S) to your Arduino project, just place them in the same folder as the .ino file. Here are the 2 files needed for this project, along with the output on the serial terminal of the results when you run it. Simply create an empty project and copy/paste this code into it: The Arduino sketch // // ESP32-S3 minimal SIMD example // Written by Larry Bank // Copyright (c) 2024 BitBank Software, Inc. // // The purpose of this example is to show how to make use of ESP32-S3 SIMD instructions // in your Arduino or ESP-IDF projects. The code is not comprehensive and just provides // a starting point for someone wanting to learn how to use them. I wrote this because ...

Has RISC-V finally made the 8051 obsolete?

8051 (MCS-51) You can probably tell from the tone of the title that I'm no fan of the 8051. The 8051 is an 8-bit MCU created by Intel in 1980. It has a very simple (aka wimpy) instruction set that was designed to minimize the amount of silicon required. This and the fact that the IP of the 8051 was released as free to the public, made it a popular choice as the CPU core of MCUs from a variety of vendors. Taken from a purely hardware point of view, the 8051 seems like a great way to make low cost MCUs, but from a software developers POV (e.g. mine), it's a productivity killing choice. The reasons I feel this way are: The HW architecture has so many odd quirks and limitations that your code ends up being a specialized mess that has no hope of portability to any other architecture 8-bit ops mean that your code becomes very bulky to do actual work besides blinking some LEDs What you save in HW cost, you pay dearly for in SW cost The available SW tools are very limited (e.g. SDCC - ...

Surprise! ESP32-S3 has (a few) SIMD instructions

Intro Espressif Systems released their ESP32-S3 SoC a few years ago, but only recently have they released more documentation and support of its full capabilities. Without any changes to your code, the S3 runs about 15% faster than older ESP32 CPUs at the same clock speed. It has a 'hidden' capability that's more difficult to use, but can be worth the effort if you need more speed. This article is aimed at programmers who are already familiar with SIMD instructions on other platforms. I've been optimizing code with SIMD for more than 15 years on Intel, Arm and DSPs (even Cadence's), so when I heard that the S3 had SIMD instructions, I immediately went searching for documentation. When the S3 became available to buy, there was only a promise of documentation and support. In the 2+ years since then, not much has changed. At the end of 2023, Espressif released a document describing the new instructions: S3 Technical Reference Manual The document has a decent level of d...