[video member=pervognsen stream_platform=twitch project=bitwise title="More Simulator Features" vod_platform=youtube id=RPs-QLExKm0 annotator=Miblo] [0:09][Recap and set the stage for the day][:speech] [0:52][Review the work on expression evaluation, in parse_expr() and related functions][:asm :language :parsing :research] [7:05][Show the dummy examples of expression evaluation][:asm :language :parsing :research] [7:46][:Run the simulator to show the expression evaluation in action][:asm :language :parsing] [8:03][Review the addition of the magic token '$' to denote the current address, and the .print instruction][:asm :language :parsing :research] [10:26][:Run the simulator to show our address printouts][:asm :language :parsing] [10:36][On the utility of subtracting the current address '$' from that of a label][:asm :language :parsing :research] [12:40][Review the addition of named variables][:asm :language :parsing :research] [13:37][Note that we were in-progress with "if" and the ability to .include files][:asm :language :parsing :research] [14:27][Q&A][:speech] [14:50][@elavid][I notice there is no short circuiting for those && and || operators, though that might be a pretty rare need][:asm :language] [16:23][@metatlas][Can .print print registers as well?][:asm :language] [17:00][Outline the next features to add to the simulator, including better debugability and exception handling][:asm :emulation :language :speech] [20:41][Determine to implement breakpoints][:asm :emulation :language :speech] [22:12][Instruction breakpoints][:asm :emulation :language :speech] [24:14][Dive into instruction breakpoints, introducing a Breakpoint struct for Hart to contain and step() to handle][:asm :emulation :hardware] [30:22][:Run the simulator to see that it still works][:asm :emulation :hardware] [31:10][Introduce cmd_loop() and breakpoint_callback() to demo a trick for integrating callbacks without inverting control][:asm :emulation :language] [34:25][Explain the thought behind this breakpoint callback integration trick][:asm :emulation :language :speech] [38:21][Implement cmd_loop() and breakpoint_callback()][:asm :emulation :language] [42:39][Add a breakpoint to asm_test()][:asm :emulation :language] [43:14][:Run it, successfully hit our breakpoint, and take a look at our call stack][:asm :emulation :language] [45:33][Install emacs][:admin] [45:48][Thoughts on using callbacks as a poor man's coroutine][:asm :emulation :language :speech] [47:30][Issues with breakpoint handling, restarting execution][:asm :emulation :language :speech] [50:49][Trace points][:asm :emulation :language :speech] [51:55][Implement trace points, augmenting the Hart with a trace_load_callback for the load_*() functions to use][:asm :emulation :language] [56:34][Introduce getline() and begin to enable cmd_loop() to handle and print trace point information][:asm :emulation :language] [1:00:54][:Run the simulator to see that it still works][:asm :emulation :language] [1:01:15][Enable cmd_loop() to handle unknown commands][:asm :emulation :language] [1:01:23][:Run it to see that it catches unknown commands][:asm :emulation :language] [1:01:50][Enable cmd_loop() to handle break point toggling][:asm :emulation :language] [1:03:37][:Run it to try out our breakpoint handling][:asm :emulation :language] [1:04:46][Finish enabling cmd_loop() to handle trace points][:asm :emulation :language] [1:06:05][:Run it and try toggling trace points][:asm :emulation :language] [1:06:15][Introduce trace_load_callback() and trace_store_callback()][:asm :emulation :language] [1:08:07][:Run it to see our trace points working][:asm :emulation :language] [1:08:57][Dive into visual disassembly, introducing print_instruction()][:asm :emulation] [1:26:02][:Run it to see our instruction disassembly][:asm :emulation] [1:27:01][Enable print_instruction() to handle the JAL and JALR instructions][:asm :emulation] [1:28:06][:Run it to see that our instruction disassembly works][:asm :emulation] [1:29:06][Enable print_instruction() to take and display a pc (program counter)][:asm :emulation] [1:30:38][:Run it to see our program counter along with the disassembled instructions][:asm :emulation] [1:31:57][Fix the AUIPC case in print_instruction()][:asm :emulation] [1:32:17][:Run it to see that the AUIPC, along with all else, now looks reasonable][:asm :emulation] [1:33:41][Stop now with a glimpse into introspection][:asm :emulation :speech] [1:34:51][Make print_instruction() consistently print \[ and \]][:asm :emulation] [1:35:07][:Run it and consider fuller breakpoint handling][:asm :emulation] [1:35:52][Q&A][:speech] [1:36:02][@elavid][Oh, snprintf() returns the number of characters it wanted to print, so "buf +=" can make "buf" be past "end" and cause an overflow if you print again] [1:36:58][Change print_instruction() to use sprintf() rather than snprint()] [1:38:16][:Run it to see that it's okay] [1:38:24][Call it a day with a glimpse into event handling and control flow][:asm :emulation :speech] [/video]