diff --git a/nubus-to-ztex-gateware/blit_goblin.c b/nubus-to-ztex-gateware/blit_goblin.c index 79a0be5..e8fd0cf 100644 --- a/nubus-to-ztex-gateware/blit_goblin.c +++ b/nubus-to-ztex-gateware/blit_goblin.c @@ -9,13 +9,21 @@ #warning "Using default BASE_FB" #endif +#if defined(GOBLIN_NUBUS) #define BASE_ROM 0xF0910000 // FIXME : should be generated ; 4-64 KiB of Wishbone ROM ? ; also in the LDS file ; also in the Vex config - #define BASE_RAM 0xF0902000 // FIXME : should be generated : 4-64 KiB of Wishbone SRAM ? ; also in _start #define BASE_RAM_SIZE 0x00001000 // FIXME : should be generated : 4-64 KiB of Wishbone SRAM ? ; also in _start - #define BASE_BT_REGS 0xF0900000 #define BASE_ACCEL_REGS 0xF0901000 +#elif defined(GOBLIN_SBUS) +#define BASE_ROM 0x00410000 // FIXME : should be generated ; 4-64 KiB of Wishbone ROM ? ; also in the LDS file ; also in the Vex config +#define BASE_RAM 0x00420000 // FIXME : should be generated : 4-64 KiB of Wishbone SRAM ? ; also in _start +#define BASE_RAM_SIZE 0x00001000 // FIXME : should be generated : 4-64 KiB of Wishbone SRAM ? ; also in _start +#define BASE_BT_REGS 0x00200000 +#define BASE_ACCEL_REGS 0x000c0000 +#else +#error "Must define GOBLIN_NUBUS or GOBLIN_SBUS" +#endif //typedef void (*boot_t)(void); //typedef void (*start_t)(unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short); @@ -173,7 +181,13 @@ asm(".global _start\n" //"slli a0,a0,12\n" // 0x00001000, BASE_RAM_SIZE //"add sp,sp,a0\n" // SP at the end of the SRAM "nop\n" +#if defined(GOBLIN_NUBUS) "li sp, 0xF0902ffc\n" // SP at the end of the SRAM +#elif defined(GOBLIN_SBUS) + "li sp, 0x00420ffc\n" // SP at the end of the SRAM +#else +#error "Must define GOBLIN_NUBUS or GOBLIN_SBUS" +#endif //"li a0, 0x00700968\n" // @ of r5_cmd //"li a1, 0x00C0FFEE\n" //"sw a1, 0(a0)\n" diff --git a/nubus-to-ztex-gateware/blit_goblin.sh b/nubus-to-ztex-gateware/blit_goblin.sh index c783a5f..06ea28c 100755 --- a/nubus-to-ztex-gateware/blit_goblin.sh +++ b/nubus-to-ztex-gateware/blit_goblin.sh @@ -18,7 +18,7 @@ OBJCOPY=${GCCDIR}/bin/${GCCPFX}objcopy OPT=-O3 #-fno-inline ARCH=rv32im_zba_zbb_zbt -PARAM="-DBASE_FB=${BASE_FB}" +PARAM="-DBASE_FB=${BASE_FB} -DGOBLIN_NUBUS" if test "x$1" != "xASM"; then $GCC $OPT -S -o blit_goblin.s $PARAM -march=$ARCH -mabi=ilp32 -mstrict-align -fno-builtin-memset -nostdlib -ffreestanding -nostartfiles blit_goblin.c diff --git a/nubus-to-ztex-gateware/goblin_fb.py b/nubus-to-ztex-gateware/goblin_fb.py index a6e9927..0234cd7 100644 --- a/nubus-to-ztex-gateware/goblin_fb.py +++ b/nubus-to-ztex-gateware/goblin_fb.py @@ -27,12 +27,12 @@ omap_layout = [ ("data", 8), ] -def goblin_rounded_size(hres, vres): +def goblin_rounded_size(hres, vres, bus="NuBus"): mib = int(ceil(((hres * vres) + 0) / 1048576)) - if (mib > 0 and mib < 8): # FIXME : NuBus + if (mib > 0 and mib < 8 and (bus == "NuBus")): # FIXME : NuBus mib = 8 - #if (mib > 0 and mib < 16): # FIXME : SBus - # mib = 16 + if (mib > 0 and mib < 16 and (bus == "SBus")): # FIXME : SBus + mib = 16 if (mib > 16 or mib < 1): print(f"{mib} mebibytes framebuffer not supported") assert(False) @@ -438,6 +438,9 @@ class goblin(Module, AutoCSR): soc.add_constant("VIDEO_FRAMEBUFFER_HRES", hres) soc.add_constant("VIDEO_FRAMEBUFFER_VRES", vres) + # Wishbone + self.bus = bus = wishbone.Interface() + # HW Cursor if (hwcursor): @@ -451,8 +454,6 @@ class goblin(Module, AutoCSR): else: handle_hwcursor = [ ] - self.bus = bus = wishbone.Interface() - # current cmap logic for the goblin, similar to the cg6, minus the HW cursor bt_mode = Signal(8, reset = 0x3) # bit depth is 2^x ; 0x10 is direct mode (32 bits)