[video member=pervognsen stream_platform=twitch project=bitwise title="Domain-Specific Languages In Python, Part 2" vod_platform=youtube id=-PkSiUqhly0 annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:33][Review off-stream work factoring out the interpreter's dispatch logic, including the Visitor class][:"data structure" :parsing :research]
[6:10][Review use of the Visitor by Copier][:memory :parsing :research]
[7:50][Review use of the Visitor by Linearizer][:"data structure" :parsing :research]
[11:06][Print out the result of a linearize() call][:parsing]
[11:30][:Run it to see the result of this linearize() call][:parsing]
[13:02][Review the new compile() function][:"code generation" :research]
[14:49][Run compile() on our test expression][:"code generation"]
[15:31][:Run it to see the result of compile()][:"code generation"]
[17:37][Review the Measurer class][:research :timing]
[26:44][Q&A][:speech]
[27:05][Introduce XorRemover class and remove_xors() to transform instances of XOR to AND / OR][:"code generation"]
[31:58][Test remove_xors()][:"code generation" :programming :run]
[34:51][Demonstrate that both occurrences of (x & \~z) are not independent copies][:"code generation" :run]
[36:01][Targeting different languages easily with this XOR removing approach][:"code generation" :language]
[36:45][Determine to work on the final versions of ideas next time][:speech]
[37:14][Set up to do some :metaprogramming][:speech]
[37:51][Review full_adder() with a view to making an n-bit adder][:mathematics :research]
[39:23][Introduce make_adder() to make an n-bit adder through :metaprogramming][:mathematics]
[44:02][Test make_adder() on various bit-lengths][:mathematics :metaprogramming :programming :run]
[45:42][Compile an 8-bit adder][:"code generation" :mathematics :metaprogramming]
[46:32][:Run it to see our compiled 8-bit adder][:mathematics :metaprogramming]
[47:06][Introduce compile_adder() including an adder() front-end][:mathematics :metaprogramming]
[52:17][Test compile_adder()][:"code generation" :mathematics :metaprogramming :programming :run]
[53:06][Tabulate the resulting calculations of our generated adders][:mathematics :metaprogramming]
[53:53][:Run it to see that the 1-bit adder seems good, but the 2-bit adder doesn't, and investigate why][:mathematics :metaprogramming]
[55:36][@elavid][Maybe do `range(n+1)` on line 339 so we can see the full n+1 bits of z]
[55:39][Enable adder() to output every last bit][:mathematics :metaprogramming]
[56:01][@elavid][Yeah, it was printing 1+1=0 earlier because it didn't see the carry.]
[56:25][Check out our generated adder code][:mathematics :metaprogramming :research]
[58:00][Hardcode c to 0 in make_adder() and continue to investigate ][:mathematics :metaprogramming]
[1:00:40][@elavid][Ohh, the bits in your lists are LSb first, but isn't that loop treating them as MSb first?]
[1:01:10][Fix adder() to treat the bits as most-significant bit first][:mathematics :metaprogramming]
[1:01:44][:Run it to see that it looks correct][:mathematics :metaprogramming]
[1:01:58][Test compile_adder() on an 8-bit adder][:mathematics :metaprogramming :run]
[1:04:40][That's probably it for today, with a glimpse into the future diving into the HDL proper][:speech]
[/video]
