[video member=miotatsu stream_platform=twitch project=riscy title="__wrap_write" vod_platform=youtube id=uG-72R7jhec annotator=Miblo]
[0:00][Recap and set the stage for the day]
[0:15][Consult Bruce's reply regarding the measure_cpu_freq() computation[ref
    site="SiFive Forums"
    page="The Big RISCY BUSINESS Question Thread"
    url=https://forums.sifive.com/t/the-big-riscy-business-question-thread/531]]
[1:47][@riskyfive][Hey]
[1:53][Determine to figure out how we could force measure_cpu_freq() to cause an integer overflow]
[5:21][Calculating the maximum value of delta_mcycle][:blackboard]
[5:51][@riskyfive][32768 is a power of 2, so just subtract log2(32768) bits from 32 bits?]
[6:18][Continuing that maximum delta_mcycle calculation][:blackboard]
[6:45][@riskyfive][log2(x) is how many bits are needed to represent x]
[7:06][Continuing that maximum delta_mcycle calculation]
[9:56][@riskyfive][Notice that 131072 is also a power of two]
[10:06][Convert our calculated value to hex]
[12:22][@riskyfive][Google does log2]
[12:34][Perform log2 on our hex value, and then try @RiskyFive's original computation]
[15:26][Calculating the maximum number of ticks we can support][:blackboard]
[17:25][@riskyfive][If your max representation is 10,000,000, and you are thinking how many times you can fit 1000, you just subtract log10(1000)=3 from log10(10,000,000)=7; 7-3=4; 10^4 = 10,000. You can fit 1000 10,000 times in 10,000,000]
[18:37][@riskyfive][Yay for decimal]
[18:43][Continue calculating the maximum ticks our proposed code would support][:blackboard]
[22:43][Reflect on the relative robustness of the official code, and give Bruce a like[ref
    site="SiFive Forums"
    page="The Big RISCY BUSINESS Question Thread"
    url=https://forums.sifive.com/t/the-big-riscy-business-question-thread/531]]
[23:38][Continue studying __wrap_write()]
[27:50][Study the loops in __wrap_write(), in conjunction with the Transmit Data Register documentation[ref
    site="SiFive Developers"
    page="Freedom E300 Platform Reference Manual"
    url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]]
[32:42][Marry up the defined UART_REG_TXFIFO with the documentation[ref
    site="SiFive Developers"
    page="Freedom E300 Platform Reference Manual"
    url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/] and determine that we fully understand write][:hardware]
[34:00][:Research if there is a new line standard for UART[ref
    site=Wikipedia
    page="Universal asynchronous receiver/transmitter"
    url=https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter]][:hardware]
[36:18][@riskyfive][The concept of new lines is not defined at the UART level][:hardware]
[36:48][@riskyfive][It's higher level. They probably use CR LF because many terminals (Putty, etc.) use that by default]
[37:52][Read about UART Data framing[ref
    site=Wikipedia
    page="Universal asynchronous receiver/transmitter"
    url=https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter]][:hardware :research]
[40:12][@riskyfive][In my FPGA app I just sent \\n \[sic\] without doing that conversion. Then I changed the Putty config when I used it with Windows]
[40:49][@riskyfive][I just sent slash n, it doesn't print \\ n here]
[41:45][:Research multiple stop bits in UART][:hardware]
[44:27][@riskyfive][I think two stop bits also helps resynchronization]
[44:54][@riskyfive][If you open your serial terminal at mid-transmission what can happen is that you start decoding what you think is a start bit but it's actually data. After that you may never recover unless you have more than one stop bits]
[47:04][Shout out to [@nothings Sean T. Barrett]'s publication of Jeff Roberts' printf[ref
    site=GitHub
    page="stb/stb_sprintf.h"
    url=https://github.com/nothings/stb/blob/master/stb_sprintf.h]]
[48:40][Consult our TODO list][:blackboard]
[49:38][Consider checking out the other demos]
[51:32][Plan what to study from the table of contents in the Privileged ISA Specification,[ref
    site="RISC-V"
    page="Draft Privileged ISA Specification v1.9.1"
    url=https://riscv.org/specifications/privileged-isa/] note that the User-Level ISA Specification[ref
    site=RISC-V
    page="User-Level ISA Specification v2.1"
    url=https://riscv.org/specifications] will be more of a reference source for us, and plan what's left from the E3 Coreplex Manual[ref
    site="SiFive Developers"
    page="E3 Coreplex Manual"
    url=https://static.dev.sifive.com/pdfjs/web/viewer.html?file=https://static.dev.sifive.com/SiFive-E3-Coreplex-v1.2.pdf]]
[56:26][Scan through led_fade.c to determine that we understand everything in it][:research]
[1:02:01][Plan][:blackboard]
[1:03:21][We're done for today]
[/video]
