Skip to content

Commit

Permalink
mov to rx working
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather committed Dec 20, 2024
1 parent 648c840 commit d0a6bb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions port/raspberrypi/rp2xxx/src/hal/pio/assembler/encoder.zig
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@ pub fn Encoder(comptime cpu: CPU, comptime options: Options) type {
// NOTE: These instructions values only exist for RP2350
.movtorx => |mov| .{
.movtorx = .{
.idxl = mov.idxl,
.idx = mov.idx,
.idxl = @intFromBool(mov.idxl),
},
},
.movfromrx => |mov| .{
.movfromrx = .{
.idxl = mov.idxl,
.idx = mov.idx,
.idxl = @intFromBool(mov.idxl),
},
},
.irq => |irq| blk: {
Expand Down Expand Up @@ -656,14 +656,14 @@ pub fn Instruction(comptime cpu: CPU) type {

// RP2350 only, but we need them for the switch case
pub const MovToRx = packed struct(u8) {
_reserved0: u4 = 1,
idxl: bool,
idx: u3,
idxl: u1,
_reserved0: u4 = 1,
};
pub const MovFromRx = packed struct(u8) {
_reserved0: u4 = 0,
idxl: bool,
idx: u3,
idxl: u1,
_reserved0: u4 = 0,
};

pub const Set = packed struct(u8) {
Expand Down
10 changes: 7 additions & 3 deletions port/raspberrypi/rp2xxx/src/hal/pio/assembler/tokenizer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -808,12 +808,16 @@ pub fn Tokenizer(cpu: CPU) type {
};
} else if (std.mem.startsWith(u8, dest_lower.slice(), "rxfifo")) {
// MOV (to RX)
// TODO: Parse out the index
const idx = 0;
// -- Parse out the index
const dest_index = dest_lower.slice()["rxfifo".len - 0 ..];
const value = try std.fmt.parseInt(u8, dest_index, 11);
if (value > 3) {
return error.InvalidDestination;
}
return Token(cpu).Instruction.Payload{
.movtorx = .{
.idxl = false,
.idx = idx,
.idx = @intCast(value),
},
};
} else if (std.mem.eql(u8, dest_lower.slice(), "osr")) {
Expand Down

0 comments on commit d0a6bb0

Please sign in to comment.