From 2643504eb5ed95555c4efa6576e15fc52385ef68 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:05 -0300 Subject: [PATCH] chore: relocate barrel_shifter zig file --- src/cpu.zig | 1 - src/cpu/arm/data_processing.zig | 2 +- src/cpu/arm/single_data_transfer.zig | 10 +++++----- src/cpu/{arm => }/barrel_shifter.zig | 4 ++-- src/cpu/thumb/format1.zig | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) rename src/cpu/{arm => }/barrel_shifter.zig (98%) diff --git a/src/cpu.zig b/src/cpu.zig index 8876bbe..260008b 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -1,7 +1,6 @@ const std = @import("std"); const util = @import("util.zig"); -const BarrelShifter = @import("cpu/arm/barrel_shifter.zig"); const Bus = @import("Bus.zig"); const Bit = @import("bitfield").Bit; const Bitfield = @import("bitfield").Bitfield; diff --git a/src/cpu/arm/data_processing.zig b/src/cpu/arm/data_processing.zig index 2ff8497..0ab6b7f 100644 --- a/src/cpu/arm/data_processing.zig +++ b/src/cpu/arm/data_processing.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const shifter = @import("barrel_shifter.zig"); +const shifter = @import("../barrel_shifter.zig"); const Bus = @import("../../Bus.zig"); const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi; const InstrFn = @import("../../cpu.zig").ArmInstrFn; diff --git a/src/cpu/arm/single_data_transfer.zig b/src/cpu/arm/single_data_transfer.zig index 3fabd6d..c2c98be 100644 --- a/src/cpu/arm/single_data_transfer.zig +++ b/src/cpu/arm/single_data_transfer.zig @@ -1,7 +1,7 @@ const std = @import("std"); const util = @import("../../util.zig"); -const BarrelShifter = @import("barrel_shifter.zig"); +const shifter = @import("../barrel_shifter.zig"); const Bus = @import("../../Bus.zig"); const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi; const InstrFn = @import("../../cpu.zig").ArmInstrFn; @@ -58,9 +58,9 @@ fn registerOffset(cpu: *Arm7tdmi, opcode: u32) u32 { const rm = cpu.r[opcode & 0xF]; return switch (@truncate(u2, opcode >> 5)) { - 0b00 => BarrelShifter.logicalLeft(false, &cpu.cpsr, rm, amount), - 0b01 => BarrelShifter.logicalRight(false, &cpu.cpsr, rm, amount), - 0b10 => BarrelShifter.arithmeticRight(false, &cpu.cpsr, rm, amount), - 0b11 => BarrelShifter.rotateRight(false, &cpu.cpsr, rm, amount), + 0b00 => shifter.logicalLeft(false, &cpu.cpsr, rm, amount), + 0b01 => shifter.logicalRight(false, &cpu.cpsr, rm, amount), + 0b10 => shifter.arithmeticRight(false, &cpu.cpsr, rm, amount), + 0b11 => shifter.rotateRight(false, &cpu.cpsr, rm, amount), }; } diff --git a/src/cpu/arm/barrel_shifter.zig b/src/cpu/barrel_shifter.zig similarity index 98% rename from src/cpu/arm/barrel_shifter.zig rename to src/cpu/barrel_shifter.zig index 22b5f6d..0cc7838 100644 --- a/src/cpu/arm/barrel_shifter.zig +++ b/src/cpu/barrel_shifter.zig @@ -1,7 +1,7 @@ const std = @import("std"); -const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi; -const CPSR = @import("../../cpu.zig").PSR; +const Arm7tdmi = @import("../cpu.zig").Arm7tdmi; +const CPSR = @import("../cpu.zig").PSR; pub fn execute(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 { var result: u32 = undefined; diff --git a/src/cpu/thumb/format1.zig b/src/cpu/thumb/format1.zig index dbcb78c..8ff6b0e 100644 --- a/src/cpu/thumb/format1.zig +++ b/src/cpu/thumb/format1.zig @@ -3,7 +3,7 @@ const std = @import("std"); const Bus = @import("../../Bus.zig"); const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi; const InstrFn = @import("../../cpu.zig").ThumbInstrFn; -const shifter = @import("../arm/barrel_shifter.zig"); +const shifter = @import("../barrel_shifter.zig"); pub fn format1(comptime op: u2, comptime offset: u5) InstrFn { return struct {