I love your series the most comprehensive on RISC-V. I am programming in bare-metal assembler for the ESP32c3 chip using the esp32-c3 technical reference manual and managed to blink an led with no RTOS now trying to get a button setup for input but am a bit lost. I wish there was a series on ESP32c3 including input including interrupt button input, and UART that would be incredible but I know you have other things but wanted to ask. Thank you for your time John.
Thanks! I've never used an ESP32c3. But the manual looks promising. www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
That what I have been using to write a blinky so far so good but struggling beyond that for input I see the registers but something I am missing I am sure I will figure it out as I wrote an all assembler book on the STM32F401@@JohnsBasement
Thanks for the clear explanation, saved me a lot of wasted time. lui faff around with 20 bit - I get why they did it now, but it's put me off bothering.
It seems inelegant, but it sure looks really nice from a CPU design perspective. In the end, it just turns into two instructions that the assembler fixes up the math for you. Would really only get complicated if you wanted to do self modifying code, which usually isn't an excellent idea these days. The compilers don't really care either, just simple math. Plus an architectural implementation can actually take those two operations and fuse them into one single op if transistor count/performance makes it sensible to do so.
All immediate operands are sign extended. You don't want to use ORI to set the low bits after a LUI... Because if the high immediate but is set you'd end up with all 1s in the high bits!
I'm still confused. I'm using the pseudo assembler rv. I can run "li 0xffffffff", I cannot see how that expands, it just works. Trying to assemble "lui a0, 0xfffff" followed by "addi a0,a0, 0xfff" does not work. Using "addi a0,a0, 0x7ff" works, but leaves a 7 nibble in the result. Adding one to 0xfffff does not seem to be useful.
This is so well explained, very impressive John!
Thank you for such a kind review!
FINALLY THE VIDEO I WAS LOOKING FOR!! You are so talented at teaching things in an easy way to understand! Thanks alot!!
Thanks! I'm glad you like it.
Oh... make sure that you grab a new copy of RVALP. I can see that I have updated some of the figures based on some student feedback.
This series continues to be excellent
Thanks! Many of these comments are excellent as well! 😇
I love your series the most comprehensive on RISC-V. I am programming in bare-metal assembler for the ESP32c3 chip using the esp32-c3 technical reference manual and managed to blink an led with no RTOS now trying to get a button setup for input but am a bit lost. I wish there was a series on ESP32c3 including input including interrupt button input, and UART that would be incredible but I know you have other things but wanted to ask. Thank you for your time John.
Thanks! I've never used an ESP32c3. But the manual looks promising. www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
That what I have been using to write a blinky so far so good but struggling beyond that for input I see the registers but something I am missing I am sure I will figure it out as I wrote an all assembler book on the STM32F401@@JohnsBasement
If I were to ever see you in a bar, I would pay for all of your drinks.
🤣
Thanks for the clear explanation, saved me a lot of wasted time. lui faff around with 20 bit - I get why they did it now, but it's put me off bothering.
I'm glad I could help!
@@JohnsBasement I'll be focusing on ARM I think.
It seems inelegant, but it sure looks really nice from a CPU design perspective. In the end, it just turns into two instructions that the assembler fixes up the math for you. Would really only get complicated if you wanted to do self modifying code, which usually isn't an excellent idea these days. The compilers don't really care either, just simple math. Plus an architectural implementation can actually take those two operations and fuse them into one single op if transistor count/performance makes it sensible to do so.
Great effort Sir.
Thanks for your explanation. It is very clear and helpful.
You're welcome! Glad it helped!
Dear John,
Is it possible to obtain a copy of the PDF document / book you use in your videos?
Btw your way of explaining has helped me immensely
Read the description. Link in there.
wouldn't (constant >>U 12)+(constant & 0x00000800 ? 1 : 0) be better represented as ((constant + 0x00000800)>>U 12) ? it's more compact and contains no conditional arithmetic.
🤣 I was JUST talking to my students of making that EXACT change! I believe it would indeed!
It is on my todo list.
Very good stuff to learn ,Just writing CPU project and your book explain almost everything in green card.
Thanks!
so li would be expanded into LUI+ORI but that la and far mem access needs really that addi -4 substraction, right?
All immediate operands are sign extended. You don't want to use ORI to set the low bits after a LUI... Because if the high immediate but is set you'd end up with all 1s in the high bits!
I'm still confused. I'm using the pseudo assembler rv. I can run "li 0xffffffff", I cannot see how that expands, it just works. Trying to assemble "lui a0, 0xfffff" followed by "addi a0,a0, 0xfff" does not work. Using "addi a0,a0, 0x7ff" works, but leaves a 7 nibble in the result. Adding one to 0xfffff does not seem to be useful.
That's because it expands to addi a0,zero,0xfff
If you want to lui first then do: lui a0,0; addi a0,a0,0xfff
@@JohnsBasement I see it now. Thanks!