diff options
Diffstat (limited to 'src/board_memory.zig')
| -rw-r--r-- | src/board_memory.zig | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/board_memory.zig b/src/board_memory.zig index 79a9a2cf..ac567b34 100644 --- a/src/board_memory.zig +++ b/src/board_memory.zig @@ -7,7 +7,7 @@ //! some of them would be lying about where it is running. Under an OS the same words would be either //! a segfault or a syscall stub, so they are absent from those builds entirely rather than present //! and refusing. Absent means not compiled, not hidden: nothing below is analysed for a build whose -//! platform is not `p4`. +//! platform is not `esp32p4`. //! //! Everything here goes through `*allowzero volatile` pointers. A peripheral //! register is not memory: reading UART_STATUS twice is two reads and must not @@ -24,8 +24,9 @@ const builtin = @import("builtin"); const pardes = @import("pardes.zig"); const Pardes = pardes.Pardes; const output_pane = @import("output_pane.zig"); +const limits = @import("limits.zig"); -/// THE ONE GATE, and it names the p4 build, so `Peek`, `Poke`, `Hexdump` and `Gpio` are analysed +/// THE ONE GATE, and it names the esp32p4 build, so `Peek`, `Poke`, `Hexdump` and `Gpio` are analysed /// and emitted for that build and for no other. Nothing in this file reaches any other target's /// binary: not the volatile accessors, not the JP1 pinout, not the parsers. /// @@ -41,11 +42,11 @@ const output_pane = @import("output_pane.zig"); /// The old predicate's real work was excluding wasm, which is `freestanding` too - inside the /// browser's sandbox an address is an offset into a linear memory the engine owns, so a `Peek` /// would read a number that means nothing about any machine and a `Poke` would corrupt the heap -/// this same editor runs out of. Naming `p4` excludes it by construction rather than by a term +/// this same editor runs out of. Naming `esp32p4` excludes it by construction rather than by a term /// somebody has to keep remembering. -pub const enabled = pardes.platform == .p4; +pub const enabled = pardes.platform == .esp32p4; -// The target is now the WITNESS rather than the gate: whatever else `p4` means, it has to still be +// The target is now the WITNESS rather than the gate: whatever else `esp32p4` means, it has to still be // a machine whose addresses are the bus's, and a hosted or wasm build reaching this line means the // platform and the target disagree about what the firmware is. comptime { @@ -261,7 +262,7 @@ test "every literal is hex, with or without the prefix" { // grid the board is actually built with, and the alignment is asserted against the column the pin // numbers are supposed to share. test "the pinout fits the board's own grid, in two aligned columns" { - const cols: usize = @import("pardes_config").p4_cols; + const cols: usize = @import("pardes_config").esp32p4_cols; // Seven columns of the shell's grid go to the line-number gutter before a pane's text starts. const usable = cols - 7; @@ -427,23 +428,10 @@ pub fn gpio(p: *Pardes, id: usize, argument: []const u8) !void { p.setMessage(id, std.fmt.bufPrint(&buf, "GPIO {d}: {d}->{d}", .{ pin, was, now }) catch unreachable); } -/// Bytes per dumped row, and it is a different number on the board. -/// -/// `hexdump -C`'s sixteen is the layout everyone can already read, and it needs 79 columns: ten for -/// the address, forty-eight for the hex, a gap, and the eighteen-column ASCII gutter. The P4 drives -/// a 56-column grid of which seven go to the line-number gutter, so a sixteen-byte row wraps onto a -/// second display line and the columns stop lining up - which is the entire value of the layout. -/// -/// Eight fits in 46 and keeps every property that matters: address on the left, fixed-width hex -/// columns, ASCII on the right, and a gap at the halfway mark because the eye counts in fours and -/// eights rather than in sixteens. -/// -/// NO `0x` ON WHAT THESE WORDS PRINT, which is where two of those columns came from. It reads no -/// worse - every number here is hex, there is no other kind, and the words refuse a decimal one - and -/// it buys something better than the width: an address in a dump can now be typed straight back into -/// a `Peek` without editing it, because bare hex is exactly what the parser wants. Output that is -/// valid input is worth more than a prefix restating what the whole file already says. -const row_bytes: u32 = if (pardes.platform == .p4) 8 else 16; +/// Bytes per dumped row, and it is a different number on the board — see +/// `limits.hexdump_row_bytes`, which is where that number and its reasoning +/// live now. +const row_bytes: u32 = limits.hexdump_row_bytes; /// `Hexdump <addr> [len]` — len bytes, `row_bytes` to a row, hex columns and an ASCII gutter, in /// `hexdump -C`'s layout because that is the one everyone can already read. BYTE reads, so a partial |
