From 317f3136aa6d4fd1b0cc2112b282396cc70296ff Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 17 Feb 2022 18:03:45 +0800 Subject: [PATCH 1/2] emulation: complete initial emulation of spinor/flash Emulate both the SPINOR block as well as the OSPI flash attached to it. With this change, the PDDB can now be initialized and resets itself properly. Additionally, data persists across virtual reboots. Data does not persist across runs of the emulator. That will follow in an upcoming patch. Signed-off-by: Sean Cross --- emulation/peripherals/BetrustedSpinor.cs | 287 ++ emulation/peripherals/MXIC_MX66UM1G45G.cs | 717 ++++ emulation/peripherals/SPIConnector.cs | 130 - emulation/peripherals/keyrom.cs | 260 +- emulation/peripherals/vexriscv-aes.cs | 4262 +++++++++++++++++++++ emulation/soc/betrusted-soc.repl | 8 +- emulation/xous-release.resc | 12 +- svd2repl/src/generate.rs | 6 +- 8 files changed, 5536 insertions(+), 146 deletions(-) create mode 100644 emulation/peripherals/BetrustedSpinor.cs create mode 100644 emulation/peripherals/MXIC_MX66UM1G45G.cs delete mode 100644 emulation/peripherals/SPIConnector.cs create mode 100644 emulation/peripherals/vexriscv-aes.cs diff --git a/emulation/peripherals/BetrustedSpinor.cs b/emulation/peripherals/BetrustedSpinor.cs new file mode 100644 index 000000000..476bc9a0d --- /dev/null +++ b/emulation/peripherals/BetrustedSpinor.cs @@ -0,0 +1,287 @@ +// +// Copyright (c) 2010-2019 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// + +using System; +using System.Collections.Generic; +using Antmicro.Renode.Core; +using Antmicro.Renode.Core.Structure; +using Antmicro.Renode.Core.Structure.Registers; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Peripherals.Bus; +using Antmicro.Renode.Utilities; + +namespace Antmicro.Renode.Peripherals.SPI +{ + [AllowedTranslations(AllowedTranslation.ByteToDoubleWord | AllowedTranslation.WordToDoubleWord)] + public class BetrustedSpinor : NullRegistrationPointPeripheralContainer, IDoubleWordPeripheral, IKnownSize + { + public BetrustedSpinor(Machine machine) : base(machine) + { + // bbHelper = new BitBangHelper(8, loggingParent: this, outputMsbFirst: true); + txQueue = new Queue(256); + rxQueue = new Queue(256); + IRQ = new GPIO(); + + var registers = new Dictionary + { + {(long)Registers.Config, new DoubleWordRegister(this) + .WithValueField(0, 5, name: "dummy") + }, + {(long)Registers.DelayConfig, new DoubleWordRegister(this) + .WithValueField(0, 5, name: "d") + .WithFlag(5, name: "load") + }, + {(long)Registers.DelayStatus, new DoubleWordRegister(this) + .WithValueField(0, 5, name: "q") + }, + {(long)Registers.Command, new DoubleWordRegister(this) + .WithValueField(0, 32, FieldMode.Write, writeCallback: (_, data) => { + var wakeup = BitHelper.IsBitSet(data, 0); + var exec_cmd = BitHelper.IsBitSet(data, 1); + cmdCode = (byte)BitHelper.GetValue(data, 2, 8); + hasArg = BitHelper.IsBitSet(data, 10); + dummyCycles = (uint)BitHelper.GetValue(data, 11, 5); + dataWords = (uint)BitHelper.GetValue(data, 16, 8); + lockReads = BitHelper.IsBitSet(data, 24); + + if (exec_cmd) { + // Ensure the device is in OPI mode. This may change due to a system reset. + SwitchSpiToOpi(); + + this.Log(LogLevel.Noisy, "Executing command! cmdCode: {0:X2} hasArg? {1} ({6:X8}) dummyCycles: {2} dataWords: {3} txFifo.Count: {4} rxFifo.Count: {5}", + cmdCode, hasArg, dummyCycles, dataWords, txQueue.Count, rxQueue.Count, cmdArg.Value); + if (RegisteredPeripheral == null) { + this.Log(LogLevel.Error, "Unable to get SPI chip device!"); + return; + } + + // In OPI mode, send the command, followed by the inverse of the command + RegisteredPeripheral.Transmit(cmdCode); + RegisteredPeripheral.Transmit((byte)~cmdCode); + + if (dummyCycles == 0) { + if (hasArg) { + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 24)); + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 16)); + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 8)); + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 0)); + } + // Is Write + for (var i = 0; i < dataWords; i++) { + RegisteredPeripheral.Transmit((txQueue.Count > 0) ? txQueue.Dequeue() : (byte)0xff); + RegisteredPeripheral.Transmit((txQueue.Count > 0) ? txQueue.Dequeue() : (byte)0xff); + } + } else { + // Is Read + + // Transmit the dummy data + for (var i = 0; i < dummyCycles; i++) { + if (hasArg && (i == 0)) { + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 24)); + } else if (hasArg && (i == 1)) { + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 16)); + } else if (hasArg && (i == 2)) { + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 8)); + } else if (hasArg && (i == 3)) { + RegisteredPeripheral.Transmit((byte)(cmdArg.Value >> 0)); + } else { + RegisteredPeripheral.Transmit(0xff); + } + } + + // Receive data back, two transmissions per word since it's in + // units of 16 bits. + for (var i = 0; i < dataWords; i++) { + rxQueue.Enqueue((byte)(RegisteredPeripheral.Transmit(0xff))); + rxQueue.Enqueue((byte)(RegisteredPeripheral.Transmit(0xff) >> 8)); + } + } + + RegisteredPeripheral.FinishTransmission(); + } + }) + }, + {(long)Registers.CmdArg, new DoubleWordRegister(this) + .WithValueField(0, 32, out cmdArg, FieldMode.Read | FieldMode.Write, name: "cmd_arg") + }, + {(long)Registers.CmdRbkData, new DoubleWordRegister(this) + .WithValueField(0, 32, FieldMode.Read, valueProviderCallback: (_) => HandleRxFifoRead(), name: "cmd_rbk_data") + }, + {(long)Registers.Status, new DoubleWordRegister(this) + .WithFlag(0, name: "wip") + }, + {(long)Registers.WData, new DoubleWordRegister(this) + .WithValueField(0, 16, FieldMode.Write, writeCallback: (_, data) => HandleTxFifoWrite(data), name: "wdata") + }, + {(long)Registers.EvStatus, new DoubleWordRegister(this) + .WithFlag(0, name: "ecc_error") + }, + {(long)Registers.EvPending, new DoubleWordRegister(this) + .WithFlag(0, name: "ecc_error") + }, + {(long)Registers.EvEnable, new DoubleWordRegister(this) + .WithFlag(0, name: "ecc_error") + }, + {(long)Registers.EccAddress, new DoubleWordRegister(this) + .WithValueField(0, 32, name: "ecc_address") + }, + {(long)Registers.EccStatus, new DoubleWordRegister(this) + .WithFlag(0, name: "ecc_error") + .WithFlag(1, name: "ecc_overflow") + }, + }; + + registersCollection = new DoubleWordRegisterCollection(this, registers); + Reset(); + } + + public override void Reset() + { + registersCollection.Reset(); + if (RegisteredPeripheral != null) { + spiIsInOpiMode = false; + RegisteredPeripheral.Reset(); + } + } + + private void HandleTxFifoWrite(uint value) + { + txQueue.Enqueue((byte)(value)); + txQueue.Enqueue((byte)(value >> 8)); + } + + private uint HandleRxFifoRead() + { + uint ret = 0; + if (rxQueue.Count > 0) + { + ret |= (uint)rxQueue.Dequeue() << 0; + } + if (rxQueue.Count > 0) + { + ret |= (uint)rxQueue.Dequeue() << 8; + } + if (rxQueue.Count > 0) + { + ret |= (uint)rxQueue.Dequeue() << 16; + } + if (rxQueue.Count > 0) + { + ret |= (uint)rxQueue.Dequeue() << 24; + } + return ret; + } + + public uint ReadDoubleWord(long offset) + { + return registersCollection.Read(offset); + } + + [ConnectionRegionAttribute("xip")] + public uint XipReadDoubleWord(long offset) + { + return (RegisteredPeripheral as IDoubleWordPeripheral)?.ReadDoubleWord(offset) ?? 0; + } + + public void WriteDoubleWord(long offset, uint value) + { + registersCollection.Write(offset, value); + } + + [ConnectionRegionAttribute("xip")] + public void XipWriteDoubleWord(long offset, uint value) + { + (RegisteredPeripheral as IDoubleWordPeripheral)?.WriteDoubleWord(offset, value); + } + + public override void Register(ISPIPeripheral peripheral, NullRegistrationPoint registrationPoint) + { + peripheral.Reset(); + base.Register(peripheral, registrationPoint); + SwitchSpiToOpi(); + } + + private void SwitchSpiToOpi() + { + if (spiIsInOpiMode) { + return; + } + + // Wake up from deep sleep + byte[] wakeup = new byte[] { 0xab }; + + // WREN + byte[] wren = new byte[] { 0x06 }; + + // Set to 8 dummy cycles to run at 84 MHz + byte[] dummy_cycles_84 = new byte[6]; + dummy_cycles_84[0] = 0x72; + dummy_cycles_84[1] = 0x00; + dummy_cycles_84[2] = 0x00; + dummy_cycles_84[3] = 0x03; + dummy_cycles_84[4] = 0x00; + dummy_cycles_84[5] = 0x05; + + // Switch to DOPI + byte[] switch_to_ddr_opi = new byte[6]; + switch_to_ddr_opi[0] = 0x72; + switch_to_ddr_opi[1] = 0x00; + switch_to_ddr_opi[2] = 0x00; + switch_to_ddr_opi[3] = 0x00; + switch_to_ddr_opi[4] = 0x00; + switch_to_ddr_opi[5] = 0x02; + + + TransmitTransaction(wakeup); + TransmitTransaction(wren); + TransmitTransaction(dummy_cycles_84); + TransmitTransaction(wren); + TransmitTransaction(switch_to_ddr_opi); + + spiIsInOpiMode = true; + } + + private void TransmitTransaction(byte[] sequence) { + foreach (var b in sequence) { + RegisteredPeripheral.Transmit(b); + } + RegisteredPeripheral.FinishTransmission(); + } + + public long Size { get { return 4096; } } + public GPIO IRQ { get; private set; } + + private readonly Queue rxQueue; + private readonly Queue txQueue; + + private readonly DoubleWordRegisterCollection registersCollection; + private uint dataWords; + private uint dummyCycles; + private byte cmdCode; + bool spiIsInOpiMode = false; + private readonly IValueRegisterField cmdArg; + private bool hasArg; + private bool lockReads; + + private enum Registers + { + Config = 0x00, + DelayConfig = 0x04, + DelayStatus = 0x08, + Command = 0x0c, + CmdArg = 0x10, + CmdRbkData = 0x14, + Status = 0x18, + WData = 0x1c, + EvStatus = 0x20, + EvPending = 0x24, + EvEnable = 0x28, + EccAddress = 0x2c, + EccStatus = 0x30, + } + } +} diff --git a/emulation/peripherals/MXIC_MX66UM1G45G.cs b/emulation/peripherals/MXIC_MX66UM1G45G.cs new file mode 100644 index 000000000..ee4885ef0 --- /dev/null +++ b/emulation/peripherals/MXIC_MX66UM1G45G.cs @@ -0,0 +1,717 @@ +// +// Copyright (c) 2010-2022 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// +using System; +using Antmicro.Renode.Core.Structure.Registers; +using Antmicro.Renode.Exceptions; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Peripherals.Memory; +using Antmicro.Renode.Peripherals.SPI.NORFlash; +using Antmicro.Renode.Utilities; + +namespace Antmicro.Renode.Peripherals.SPI +{ + public class MXIC_MX66UM1G45G : ISPIPeripheral + { + public MXIC_MX66UM1G45G(MappedMemory underlyingMemory) + { + // original MT25Q supports capacity 8MB to 256MB, + // but we extended it down to 64KB + // to become compatible with N25Q line + if (underlyingMemory.Size < 64.KB() || underlyingMemory.Size > 256.MB() || !Misc.IsPowerOfTwo((ulong)underlyingMemory.Size)) + { + throw new ConstructionException("Size of the underlying memory must be a power of 2 value in range 64KB - 256MB"); + } + + volatileConfigurationRegister = new ByteRegister(this, 0xfb).WithFlag(3, name: "XIP"); + nonVolatileConfigurationRegister = new WordRegister(this, 0xffff).WithFlag(0, out numberOfAddressBytes, name: "addressWith3Bytes"); + enhancedVolatileConfigurationRegister = new ByteRegister(this, 0xff) + .WithValueField(0, 3, name: "Output driver strength") + .WithReservedBits(3, 1) + .WithTaggedFlag("Reset/hold", 4) + //these flags are intentionally not implemented, as they described physical details + .WithFlag(5, name: "Double transfer rate protocol") + .WithFlag(6, name: "Dual I/O protocol") + .WithFlag(7, name: "Quad I/O protocol"); + statusRegister = new ByteRegister(this).WithFlag(1, out enable, name: "writeEnableLatch"); + flagStatusRegister = new ByteRegister(this) + .WithFlag(0, FieldMode.Read, valueProviderCallback: _ => numberOfAddressBytes.Value, name: "Addressing") + //other bits indicate either protection errors (not implemented) or pending operations (they already finished) + .WithReservedBits(3, 1) + .WithFlag(7, FieldMode.Read, valueProviderCallback: _ => true, name: "ProgramOrErase"); + + this.underlyingMemory = underlyingMemory; + underlyingMemory.ResetByte = EmptySegment; + + deviceData = GetDeviceData(); + } + + public void FinishTransmission() + { + this.Log(LogLevel.Noisy, "Transmission finished"); + switch (currentOperation.State) + { + case DecodedOperation.OperationState.RecognizeOperation: + case DecodedOperation.OperationState.AccumulateCommandAddressBytes: + case DecodedOperation.OperationState.AccumulateNoDataCommandAddressBytes: + this.Log(LogLevel.Warning, "Transmission finished in the unexpected state: {0}", currentOperation.State); + break; + } + // If an operation has at least 1 data byte or more than 0 address bytes, + // we can clear the write enable flag only when we are finishing a transmission. + switch (currentOperation.Operation) + { + case DecodedOperation.OperationType.Program: + case DecodedOperation.OperationType.Erase: + case DecodedOperation.OperationType.WriteRegister: + //although the docs are not clear, it seems that all register writes should clear the flag + enable.Value = false; + break; + } + currentOperation.State = DecodedOperation.OperationState.RecognizeOperation; + currentOperation = default(DecodedOperation); + temporaryNonVolatileConfiguration = 0; + isFirstOpiByte = true; + } + + public void Reset() + { + this.Log(LogLevel.Noisy, "Resetting SPI flash device. Exiting OPI mode."); + opiMode = false; + isFirstOpiByte = true; + statusRegister.Reset(); + flagStatusRegister.Reset(); + volatileConfigurationRegister.Reset(); + nonVolatileConfigurationRegister.Reset(); + enhancedVolatileConfigurationRegister.Reset(); + currentOperation = default(DecodedOperation); + FinishTransmission(); + } + + public byte Transmit(byte data) + { + this.Log(LogLevel.Noisy, "Received data 0x{0:X}, current state: {1} OPI mode? {2}", data, currentOperation.State, opiMode); + // Eat the first byte when running in OPI mode. The second byte should be the inverse of the first byte. + if (opiMode) + { + if (isFirstOpiByte) + { + isFirstOpiByte = false; + firstOpiByte = data; + return 0xff; + } + else if (currentOperation.State == DecodedOperation.OperationState.RecognizeOperation) + { + if (data != (byte)~firstOpiByte) + { + this.Log(LogLevel.Error, "Was in OPI mode, but 2nd byte wasn't the inverse of the first byte! (data: {0:X2} first byte: {1:X2}", data, firstOpiByte); + } + data = firstOpiByte; + } + } + + switch (currentOperation.State) + { + case DecodedOperation.OperationState.RecognizeOperation: + // When the command is decoded, depending on the operation we will either start accumulating address bytes + // or immediately handle the command bytes + RecognizeOperation(data); + break; + case DecodedOperation.OperationState.AccumulateCommandAddressBytes: + AccumulateAddressBytes(data, DecodedOperation.OperationState.HandleCommand); + break; + case DecodedOperation.OperationState.AccumulateNoDataCommandAddressBytes: + AccumulateAddressBytes(data, DecodedOperation.OperationState.HandleNoDataCommand); + break; + case DecodedOperation.OperationState.HandleCommand: + // Process the remaining command bytes + return HandleCommand(data); + } + + // Warning: commands without data require immediate handling after the address was accumulated + if (currentOperation.State == DecodedOperation.OperationState.HandleNoDataCommand) + { + HandleNoDataCommand(); + } + return 0; + } + + public MappedMemory UnderlyingMemory => underlyingMemory; + + private void AccumulateAddressBytes(byte addressByte, DecodedOperation.OperationState nextState) + { + if (currentOperation.TryAccumulateAddress(addressByte)) + { + this.Log(LogLevel.Noisy, "Address accumulated: 0x{0:X}", currentOperation.ExecutionAddress); + currentOperation.State = nextState; + } + } + + private byte[] GetDeviceData() + { + var data = new byte[4]; + data[0] = ManufacturerID; + data[1] = MemoryType; + data[2] = MemoryDensity; + data[3] = 0; + return data; + } + + private void RecognizeOperation(byte firstByte) + { + currentOperation.Operation = DecodedOperation.OperationType.None; + // currentOperation.AddressLength = 0; + currentOperation.State = DecodedOperation.OperationState.HandleCommand; + switch (firstByte) + { + case (byte)Commands.ReadID: + currentOperation.Operation = DecodedOperation.OperationType.ReadID; + if (opiMode) + { + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + currentOperation.AddressLength = 4; + } + break; + case (byte)Commands.PageProgram4byte: + currentOperation.Operation = DecodedOperation.OperationType.Program; + currentOperation.AddressLength = 4; + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + break; + case (byte)Commands.WriteEnable: + this.Log(LogLevel.Noisy, "Setting write enable latch"); + currentOperation.Operation = DecodedOperation.OperationType.None; + enable.Value = true; + return; //return to prevent further logging + case (byte)Commands.WriteDisable: + this.Log(LogLevel.Noisy, "Unsetting write enable latch"); + currentOperation.Operation = DecodedOperation.OperationType.None; + enable.Value = false; + return; //return to prevent further logging + + case (byte)Commands.SubsectorErase4byte4kb: + currentOperation.Operation = DecodedOperation.OperationType.Erase; + currentOperation.EraseSize = DecodedOperation.OperationEraseSize.Subsector4K; + currentOperation.AddressLength = 4; + currentOperation.State = DecodedOperation.OperationState.AccumulateNoDataCommandAddressBytes; + break; + + case (byte)Commands.ReadStatusRegister: + currentOperation.Operation = DecodedOperation.OperationType.ReadRegister; + currentOperation.Register = (uint)Register.Status; + if (opiMode) + { + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + currentOperation.AddressLength = 4; + } + break; + case (byte)Commands.ReadSecurityRegister: + currentOperation.Operation = DecodedOperation.OperationType.ReadRegister; + currentOperation.Register = (uint)Register.SecurityRegister; + if (opiMode) + { + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + currentOperation.AddressLength = 4; + } + break; + case (byte)Commands.WriteStatusRegister: + currentOperation.Operation = DecodedOperation.OperationType.WriteRegister; + currentOperation.Register = (uint)Register.Status; + if (opiMode) + { + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + currentOperation.AddressLength = 4; + } + break; + case (byte)Commands.WriteSecurityRegister: + currentOperation.Operation = DecodedOperation.OperationType.WriteRegister; + currentOperation.Register = (uint)Register.SecurityRegister; + if (opiMode) + { + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + currentOperation.AddressLength = 4; + } + break; + case (byte)Commands.ReadConfigurationRegister2: + currentOperation.Operation = DecodedOperation.OperationType.ReadRegister; + currentOperation.Register = (uint)Register.ConfigurationRegister2; + currentOperation.AddressLength = 4; + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + break; + case (byte)Commands.WriteConfigurationRegister2: + currentOperation.Operation = DecodedOperation.OperationType.WriteRegister; + currentOperation.Register = (uint)Register.ConfigurationRegister2; + currentOperation.AddressLength = 4; + currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes; + break; + case (byte)Commands.ReleaseFromDeepPowerdown: + return; //return to prevent further logging + default: + this.Log(LogLevel.Error, "Command decoding failed on byte: 0x{0:X} ({1}).", firstByte, (Commands)firstByte); + return; + } + this.Log(LogLevel.Noisy, "Decoded operation: {0}, write enabled {1}", currentOperation, enable.Value); + } + + private byte HandleCommand(byte data) + { + byte result = 0; + switch (currentOperation.Operation) + { + case DecodedOperation.OperationType.ReadFast: + // handle dummy byte and switch to read + currentOperation.Operation = DecodedOperation.OperationType.Read; + currentOperation.CommandBytesHandled--; + this.Log(LogLevel.Noisy, "Handling dummy byte in ReadFast operation"); + break; + case DecodedOperation.OperationType.Read: + result = ReadFromMemory(); + break; + case DecodedOperation.OperationType.ReadID: + if (currentOperation.CommandBytesHandled < deviceData.Length) + { + result = deviceData[currentOperation.CommandBytesHandled]; + } + else + { + this.Log(LogLevel.Error, "Trying to read beyond the length of the device ID table."); + result = 0; + } + break; + case DecodedOperation.OperationType.Program: + if (enable.Value) + { + WriteToMemory(data); + result = data; + } + else + { + this.Log(LogLevel.Error, "Memory write operations are disabled."); + } + break; + case DecodedOperation.OperationType.ReadRegister: + result = ReadRegister((Register)currentOperation.Register); + break; + case DecodedOperation.OperationType.WriteRegister: + WriteRegister((Register)currentOperation.Register, data); + break; + case DecodedOperation.OperationType.None: + break; + default: + this.Log(LogLevel.Warning, "Unhandled operation encountered while processing command bytes: {0}", currentOperation.Operation); + break; + } + currentOperation.CommandBytesHandled++; + this.Log(LogLevel.Noisy, "Handled command: {0}, returning 0x{1:X}", currentOperation, result); + return result; + } + + private void WriteRegister(Register register, byte data) + { + if (!enable.Value) + { + this.Log(LogLevel.Error, "Trying to write a register, but write enable latch is not set"); + return; + } + switch (register) + { + case Register.VolatileConfiguration: + volatileConfigurationRegister.Write(0, data); + break; + case Register.NonVolatileConfiguration: + if ((currentOperation.CommandBytesHandled) >= 2) + { + this.Log(LogLevel.Error, "Trying to write to register {0} with more than expected 2 bytes.", Register.NonVolatileConfiguration); + break; + } + BitHelper.UpdateWithShifted(ref temporaryNonVolatileConfiguration, data, currentOperation.CommandBytesHandled * 8, 8); + if (currentOperation.CommandBytesHandled == 1) + { + nonVolatileConfigurationRegister.Write(0, (ushort)temporaryNonVolatileConfiguration); + } + break; + //listing all cases as other registers are not writable at all + case Register.EnhancedVolatileConfiguration: + enhancedVolatileConfigurationRegister.Write(0, data); + break; + case Register.SecurityRegister: + return; + case Register.ConfigurationRegister2: + switch (currentOperation.ExecutionAddress) + { + case 0x00000000: + opiMode = ((data & 3) != 0); + if (opiMode) + { + this.Log(LogLevel.Noisy, "OPI mode enabled"); + } + else + { + this.Log(LogLevel.Noisy, "OPI mode disabled"); + } + break; + case 0x00000200: + break; + case 0x00000300: + break; + case 0x00000400: + break; + case 0x00000500: + // CRC chunk size configuration / enabled + break; + case 0x00000800: + case 0x04000800: + // ECC fail status + break; + case 0x00000c00: + case 0x04000c00: + // ECC fail + break; + case 0x00000d00: + case 0x04000d00: + // ECC fail + break; + case 0x00000e00: + case 0x04000e00: + // ECC fail + break; + case 0x00000f00: + case 0x04000f00: + // ECC fail + break; + case 0x40000000: + // Enable DOPI/SOPI after reset + break; + case 0x80000000: + // CRC error + break; + default: + this.Log(LogLevel.Warning, "Unrecognized CR2 address: {0:X8}", currentOperation.ExecutionAddress); + break; + } + break; + case Register.Status: + default: + this.Log(LogLevel.Warning, "Trying to write 0x{0} to unsupported register \"{1}\"", data, register); + break; + } + } + + private byte ReadRegister(Register register) + { + switch (register) + { + case Register.Status: + // The documentation states that at least 1 byte will be read + // If more than 1 byte is read, the same byte is returned + return statusRegister.Read(); + case Register.FlagStatus: + // The documentation states that at least 1 byte will be read + // If more than 1 byte is read, the same byte is returned + return flagStatusRegister.Read(); + case Register.VolatileConfiguration: + // The documentation states that at least 1 byte will be read + // If more than 1 byte is read, the same byte is returned + return volatileConfigurationRegister.Read(); + case Register.NonVolatileConfiguration: + // The documentation states that at least 2 bytes will be read + // After all 16 bits of the register have been read, 0 is returned + if ((currentOperation.CommandBytesHandled) < 2) + { + return (byte)BitHelper.GetValue(nonVolatileConfigurationRegister.Read(), currentOperation.CommandBytesHandled * 8, 8); + } + return 0; + case Register.SecurityRegister: + return 0; + case Register.EnhancedVolatileConfiguration: + return enhancedVolatileConfigurationRegister.Read(); + case Register.ConfigurationRegister2: + switch (currentOperation.ExecutionAddress) + { + case 0x00000000: + if (opiMode) + { + return 2; + } + return 0; + case 0x00000200: + return 0; + case 0x00000300: + return 0; + case 0x00000400: + return 0; + case 0x00000500: + // CRC chunk size configuration / enabled + return 0; + case 0x00000800: + case 0x04000800: + // ECC fail status + return 0; + case 0x00000c00: + case 0x04000c00: + // ECC fail + return 0; + case 0x00000d00: + case 0x04000d00: + // ECC fail + return 0; + case 0x00000e00: + case 0x04000e00: + // ECC fail + return 0; + case 0x00000f00: + case 0x04000f00: + // ECC fail + return 0; + case 0x40000000: + // Enable DOPI/SOPI after reset + return 0; + case 0x80000000: + // CRC error + return 0; + default: + this.Log(LogLevel.Warning, "Unrecognized CR2 address: {0:X8}", currentOperation.ExecutionAddress); + return 0; + } + case Register.ExtendedAddress: + default: + this.Log(LogLevel.Warning, "Trying to read from unsupported register \"{0}\"", register); + return 0; + } + } + + private void HandleNoDataCommand() + { + // The documentation describes more commands that don't have any data bytes (just code + address) + // but at the moment we have implemented just these ones + switch (currentOperation.Operation) + { + case DecodedOperation.OperationType.Erase: + if (enable.Value) + { + if (currentOperation.ExecutionAddress >= underlyingMemory.Size) + { + this.Log(LogLevel.Error, "Cannot erase memory because current address 0x{0:X} exceeds configured memory size.", currentOperation.ExecutionAddress); + return; + } + switch (currentOperation.EraseSize) + { + case DecodedOperation.OperationEraseSize.Sector: + EraseSector(); + break; + case DecodedOperation.OperationEraseSize.Subsector4K: + EraseSubsector4K(); + break; + case DecodedOperation.OperationEraseSize.Die: + EraseDie(); + break; + default: + this.Log(LogLevel.Warning, "Unsupported erase type: {0}", currentOperation.EraseSize); + break; + } + } + else + { + this.Log(LogLevel.Error, "Erase operations are disabled."); + } + break; + default: + this.Log(LogLevel.Warning, "Encountered unexpected command: {0}", currentOperation); + break; + } + } + + private void EraseDie() + { + var position = 0; + var segment = new byte[SegmentSize]; + for (var i = 0; i < SegmentSize; i++) + { + segment[i] = EmptySegment; + } + + while (position < underlyingMemory.Size) + { + var length = (int)Math.Min(SegmentSize, underlyingMemory.Size - position); + + underlyingMemory.WriteBytes(position, segment, length); + position += length; + } + } + + private void EraseSector() + { + var segment = new byte[SegmentSize]; + for (var i = 0; i < SegmentSize; i++) + { + segment[i] = EmptySegment; + } + // The documentations states that on erase the operation address is + // aligned to the segment size + + var position = SegmentSize * (currentOperation.ExecutionAddress / SegmentSize); + underlyingMemory.WriteBytes(position, segment); + } + + private void EraseSubsector4K() + { + var segment = new byte[4.KB()]; + for (var i = 0; i < 4.KB(); i++) + { + segment[i] = EmptySegment; + } + // The documentations states that on erase the operation address is + // aligned to the segment size + + var position = 4.KB() * (currentOperation.ExecutionAddress / 4.KB()); + underlyingMemory.WriteBytes(position, segment); + } + + private void WriteToMemory(byte val) + { + if (currentOperation.ExecutionAddress + currentOperation.CommandBytesHandled > underlyingMemory.Size) + { + this.Log(LogLevel.Error, "Cannot write to address 0x{0:X} because it is bigger than configured memory size.", currentOperation.ExecutionAddress); + return; + } + + var position = currentOperation.ExecutionAddress + currentOperation.CommandBytesHandled; + underlyingMemory.WriteByte(position, val); + } + + private byte ReadFromMemory() + { + if (currentOperation.ExecutionAddress + currentOperation.CommandBytesHandled > underlyingMemory.Size) + { + this.Log(LogLevel.Error, "Cannot read from address 0x{0:X} because it is bigger than configured memory size.", currentOperation.ExecutionAddress); + return 0; + } + + var position = currentOperation.ExecutionAddress + currentOperation.CommandBytesHandled; + return underlyingMemory.ReadByte(position); + } + + private DecodedOperation currentOperation; + private uint temporaryNonVolatileConfiguration; //this should be an ushort, but due to C# type promotions it's easier to use uint + + private readonly byte[] deviceData; + private readonly int SegmentSize = 64.KB(); + private readonly IFlagRegisterField enable; + private readonly ByteRegister statusRegister; + private readonly ByteRegister flagStatusRegister; + private readonly IFlagRegisterField numberOfAddressBytes; + private readonly ByteRegister volatileConfigurationRegister; + private readonly ByteRegister enhancedVolatileConfigurationRegister; + private readonly WordRegister nonVolatileConfigurationRegister; + private readonly MappedMemory underlyingMemory; + + private const byte EmptySegment = 0xff; + private const byte ManufacturerID = 0xC2; + private const byte RemainingIDBytes = 0x10; + private const byte MemoryType = 0x80; + private const byte MemoryDensity = 0x3B; + private const byte DeviceConfiguration = 0x0; // standard + private const byte DeviceGeneration = 0x1; // 2nd generation + private const byte ExtendedDeviceID = DeviceGeneration << 6; + + private bool opiMode = false; + private bool isFirstOpiByte = false; + private byte firstOpiByte; + + private enum Commands : byte + { + // Software RESET Operations + ResetEnable = 0x66, + ResetMemory = 0x99, + + // READ ID Operations + ReadID = 0x9F, + ReadSerialFlashDiscoveryParameter = 0x5A, + + // READ MEMORY Operations + Read = 0x03, + FastRead = 0x0B, + + // READ MEMORY Operations with 4-Byte Address + Read4byte = 0x13, + FastRead4byte = 0x0C, + + // WRITE Operations + WriteEnable = 0x06, + WriteDisable = 0x04, + + // READ REGISTER Operations + ReadStatusRegister = 0x05, + ReadConfigurationRegister2 = 0x71, + ReadFastBootRegister = 0x16, + + // WRITE REGISTER Operations + WriteStatusRegister = 0x01, + WriteConfigurationRegister2 = 0x72, + WriteFastBootRegister = 0x17, + + // PROGRAM Operations + PageProgram = 0x02, + + // PROGRAM Operations with 4-Byte Address + PageProgram4byte = 0x12, + + // ERASE Operations + SubsectorErase4kb = 0x20, + SectorErase = 0xD8, + DieErase = 0x60, + EraseFastBootRegister = 0x18, + + // ERASE Operations with 4-Byte Address + SectorErase4byte = 0xDC, + SubsectorErase4byte4kb = 0x21, + SubsectorErase4byte32kb = 0x5C, + DieErase4byte = 0xC7, + + // SUSPEND/RESUME Operations + ProgramEraseSuspend = 0xB0, + ProgramEraseResume = 0x30, + + // ONE-TIME PROGRAMMABLE (OTP) Operations + EnterSecuredOtp = 0xB1, + ExitSecuredOtp = 0xC1, + + // Deep Power-Down Operations + EnterDeepPowerDown = 0xB9, + ReleaseFromDeepPowerdown = 0xAB, + + // ADVANCED SECTOR PROTECTION Operations + ReadSectorProtection = 0x2D, + ProgramSectorProtection = 0x2C, + ReadSpbRegister = 0xE2, + WriteSpbRegister = 0xE3, + EraseSpbRegister = 0xE4, + ReadPassword = 0x27, + WritePassword = 0x28, + UnlockPassword = 0x29, + + // ADVANCED SECTOR PROTECTION Operations with 4-Byte Address + ReadDpbRegister = 0xE0, + WriteDpbRegister = 0xE1, + + // SECURITY REGISTER + ReadSecurityRegister = 0x2B, + WriteSecurityRegister = 0x2F, + } + + private enum Register : uint + { + Status = 1, //starting from 1 to leave 0 as an unused value + ConfigurationRegister2, + SecurityRegister, + // The following are currently unised + FlagStatus, + ExtendedAddress, + NonVolatileConfiguration, + VolatileConfiguration, + EnhancedVolatileConfiguration + } + } +} diff --git a/emulation/peripherals/SPIConnector.cs b/emulation/peripherals/SPIConnector.cs deleted file mode 100644 index f153bc9ad..000000000 --- a/emulation/peripherals/SPIConnector.cs +++ /dev/null @@ -1,130 +0,0 @@ -// -// Copyright (c) 2010-2021 Antmicro -// -// This file is licensed under the MIT License. -// Full license text is available in 'licenses/MIT.txt'. -// -using System.Collections.Generic; -using Antmicro.Renode.Core; -using Antmicro.Renode.Core.Structure; -using Antmicro.Renode.Exceptions; -using Antmicro.Renode.Logging; -using Antmicro.Renode.Time; - -namespace Antmicro.Renode.Peripherals.SPI -{ - public static class SPIConnectorExtensions - { - public static void CreateSPIConnector(this Emulation emulation, string name) - { - emulation.ExternalsManager.AddExternal(new SPIConnector(), name); - } - } - - public class SPIConnector : IExternal, ISPIPeripheral, IConnectable, IConnectable> - { - public void Reset() - { - peripheralOutput.Clear(); - } - - public void AttachTo(NullRegistrationPointPeripheralContainer controller) - { - lock(locker) - { - if(controller == this.controller) - { - throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); - } - else if(this.controller != null) - { - this.Log(LogLevel.Warning, "Overwriting controller connection."); - } - - this.controller?.Unregister(this); - this.controller = controller; - this.controller.Register(this, NullRegistrationPoint.Instance); - } - } - - public void AttachTo(ISPIPeripheral peripheral) - { - lock(locker) - { - if(peripheral == this.peripheral) - { - throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); - } - else if(this.peripheral != null) - { - this.Log(LogLevel.Warning, "Overwriting peripheral connection."); - } - this.peripheral = peripheral; - } - } - - public void DetachFrom(NullRegistrationPointPeripheralContainer controller) - { - lock(locker) - { - if(controller == this.controller) - { - this.controller.Unregister(this); - this.controller = null; - } - else - { - throw new RecoverableException("Cannot detach from the provided controller as it is not registered in this connector."); - } - } - } - - public void DetachFrom(ISPIPeripheral peripheral) - { - lock(locker) - { - if(peripheral == this.peripheral) - { - peripheral = null; - peripheralOutput.Clear(); - } - else - { - throw new RecoverableException("Cannot detach from the provided peripheral as it is not registered in this connector."); - } - } - } - - public byte Transmit(byte data) - { - lock(locker) - { - if(peripheral == null) - { - this.Log(LogLevel.Warning, "Controller sent data (0x{0:X}), but peripheral is not connected.", data); - return 0x0; - } - peripheral.GetMachine().HandleTimeDomainEvent(InnerTransmit, data, TimeDomainsManager.Instance.VirtualTimeStamp); - return peripheralOutput.Count > 0 ? peripheralOutput.Dequeue() : (byte)0x0; - } - } - - public void FinishTransmission() - { - lock(locker) - { - peripheral.GetMachine().HandleTimeDomainEvent(_ => peripheral.FinishTransmission(), null, TimeDomainsManager.Instance.VirtualTimeStamp); - } - } - - private void InnerTransmit(byte data) - { - peripheralOutput.Enqueue(peripheral.Transmit(data)); - } - - private NullRegistrationPointPeripheralContainer controller; - private ISPIPeripheral peripheral; - private readonly Queue peripheralOutput = new Queue(); - private readonly object locker = new object(); - } -} diff --git a/emulation/peripherals/keyrom.cs b/emulation/peripherals/keyrom.cs index ae7cfc898..312ef5b3c 100644 --- a/emulation/peripherals/keyrom.cs +++ b/emulation/peripherals/keyrom.cs @@ -70,23 +70,263 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous this.locked[i] = false; } + this.data[0x0] = 0x9516051b; + this.data[0x1] = 0x315aa513; + this.data[0x2] = 0x28417c6; + this.data[0x3] = 0x3c6818d6; + this.data[0x4] = 0x52d8972b; + this.data[0x5] = 0x10e5b388; + this.data[0x6] = 0xa2177e24; + this.data[0x7] = 0xf84ff81f; + this.data[0x8] = 0xf2460da1; + this.data[0x9] = 0xf86d51b5; + this.data[0xa] = 0x4e279ae7; + this.data[0xb] = 0x224a7158; + this.data[0xc] = 0x4676edb1; + this.data[0xd] = 0x297db43b; + this.data[0xe] = 0xeff3cd32; + this.data[0xf] = 0xe2f39301; + this.data[0x10] = 0x560e91d3; + this.data[0x11] = 0xe9439e5e; + this.data[0x12] = 0xa600629c; + this.data[0x13] = 0x3276f5b8; + this.data[0x14] = 0xcca5ba59; + this.data[0x15] = 0x9cbae96e; + this.data[0x16] = 0x96899a9c; + this.data[0x17] = 0xa92c5624; this.data[0x18] = 0x1c9beae3; this.data[0x19] = 0x2aeac875; - this.data[0x1a] = 0x07c18094; + this.data[0x1a] = 0x7c18094; this.data[0x1b] = 0x387eff1c; this.data[0x1c] = 0x74614282; this.data[0x1d] = 0xaffd8152; this.data[0x1e] = 0xd871352e; this.data[0x1f] = 0xdf3f58bb; - // Words are swapped on this little-endian system. - // this.data[0x18] = 0xe3ea9b1c; - // this.data[0x19] = 0x75c8ea2a; - // this.data[0x1a] = 0x9480c107; - // this.data[0x1b] = 0x1cff7e38; - // this.data[0x1c] = 0x82426174; - // this.data[0x1d] = 0x5281fdaf; - // this.data[0x1e] = 0x2e3571d8; - // this.data[0x1f] = 0xbb583fdf; + this.data[0x20] = 0x0; + this.data[0x21] = 0x0; + this.data[0x22] = 0x0; + this.data[0x23] = 0x0; + this.data[0x24] = 0x0; + this.data[0x25] = 0x0; + this.data[0x26] = 0x0; + this.data[0x27] = 0x0; + this.data[0x28] = 0xf2460da1; + this.data[0x29] = 0xf86d51b5; + this.data[0x2a] = 0x4e279ae7; + this.data[0x2b] = 0x224a7158; + this.data[0x2c] = 0x4676edb1; + this.data[0x2d] = 0x297db43b; + this.data[0x2e] = 0xeff3cd32; + this.data[0x2f] = 0xe2f39301; + this.data[0x30] = 0x0; + this.data[0x31] = 0x0; + this.data[0x32] = 0x0; + this.data[0x33] = 0x0; + this.data[0x34] = 0x0; + this.data[0x35] = 0x0; + this.data[0x36] = 0x0; + this.data[0x37] = 0x0; + this.data[0x38] = 0x0; + this.data[0x39] = 0x0; + this.data[0x3a] = 0x0; + this.data[0x3b] = 0x0; + this.data[0x3c] = 0x0; + this.data[0x3d] = 0x0; + this.data[0x3e] = 0x0; + this.data[0x3f] = 0x0; + this.data[0x40] = 0x0; + this.data[0x41] = 0x0; + this.data[0x42] = 0x0; + this.data[0x43] = 0x0; + this.data[0x44] = 0x0; + this.data[0x45] = 0x0; + this.data[0x46] = 0x0; + this.data[0x47] = 0x0; + this.data[0x48] = 0x0; + this.data[0x49] = 0x0; + this.data[0x4a] = 0x0; + this.data[0x4b] = 0x0; + this.data[0x4c] = 0x0; + this.data[0x4d] = 0x0; + this.data[0x4e] = 0x0; + this.data[0x4f] = 0x0; + this.data[0x50] = 0x0; + this.data[0x51] = 0x0; + this.data[0x52] = 0x0; + this.data[0x53] = 0x0; + this.data[0x54] = 0x0; + this.data[0x55] = 0x0; + this.data[0x56] = 0x0; + this.data[0x57] = 0x0; + this.data[0x58] = 0x0; + this.data[0x59] = 0x0; + this.data[0x5a] = 0x0; + this.data[0x5b] = 0x0; + this.data[0x5c] = 0x0; + this.data[0x5d] = 0x0; + this.data[0x5e] = 0x0; + this.data[0x5f] = 0x0; + this.data[0x60] = 0x0; + this.data[0x61] = 0x0; + this.data[0x62] = 0x0; + this.data[0x63] = 0x0; + this.data[0x64] = 0x0; + this.data[0x65] = 0x0; + this.data[0x66] = 0x0; + this.data[0x67] = 0x0; + this.data[0x68] = 0x0; + this.data[0x69] = 0x0; + this.data[0x6a] = 0x0; + this.data[0x6b] = 0x0; + this.data[0x6c] = 0x0; + this.data[0x6d] = 0x0; + this.data[0x6e] = 0x0; + this.data[0x6f] = 0x0; + this.data[0x70] = 0x0; + this.data[0x71] = 0x0; + this.data[0x72] = 0x0; + this.data[0x73] = 0x0; + this.data[0x74] = 0x0; + this.data[0x75] = 0x0; + this.data[0x76] = 0x0; + this.data[0x77] = 0x0; + this.data[0x78] = 0x0; + this.data[0x79] = 0x0; + this.data[0x7a] = 0x0; + this.data[0x7b] = 0x0; + this.data[0x7c] = 0x0; + this.data[0x7d] = 0x0; + this.data[0x7e] = 0x0; + this.data[0x7f] = 0x0; + this.data[0x80] = 0x0; + this.data[0x81] = 0x0; + this.data[0x82] = 0x0; + this.data[0x83] = 0x0; + this.data[0x84] = 0x0; + this.data[0x85] = 0x0; + this.data[0x86] = 0x0; + this.data[0x87] = 0x0; + this.data[0x88] = 0x0; + this.data[0x89] = 0x0; + this.data[0x8a] = 0x0; + this.data[0x8b] = 0x0; + this.data[0x8c] = 0x0; + this.data[0x8d] = 0x0; + this.data[0x8e] = 0x0; + this.data[0x8f] = 0x0; + this.data[0x90] = 0x0; + this.data[0x91] = 0x0; + this.data[0x92] = 0x0; + this.data[0x93] = 0x0; + this.data[0x94] = 0x0; + this.data[0x95] = 0x0; + this.data[0x96] = 0x0; + this.data[0x97] = 0x0; + this.data[0x98] = 0x0; + this.data[0x99] = 0x0; + this.data[0x9a] = 0x0; + this.data[0x9b] = 0x0; + this.data[0x9c] = 0x0; + this.data[0x9d] = 0x0; + this.data[0x9e] = 0x0; + this.data[0x9f] = 0x0; + this.data[0xa0] = 0x0; + this.data[0xa1] = 0x0; + this.data[0xa2] = 0x0; + this.data[0xa3] = 0x0; + this.data[0xa4] = 0x0; + this.data[0xa5] = 0x0; + this.data[0xa6] = 0x0; + this.data[0xa7] = 0x0; + this.data[0xa8] = 0x0; + this.data[0xa9] = 0x0; + this.data[0xaa] = 0x0; + this.data[0xab] = 0x0; + this.data[0xac] = 0x0; + this.data[0xad] = 0x0; + this.data[0xae] = 0x0; + this.data[0xaf] = 0x0; + this.data[0xb0] = 0x0; + this.data[0xb1] = 0x0; + this.data[0xb2] = 0x0; + this.data[0xb3] = 0x0; + this.data[0xb4] = 0x0; + this.data[0xb5] = 0x0; + this.data[0xb6] = 0x0; + this.data[0xb7] = 0x0; + this.data[0xb8] = 0x0; + this.data[0xb9] = 0x0; + this.data[0xba] = 0x0; + this.data[0xbb] = 0x0; + this.data[0xbc] = 0x0; + this.data[0xbd] = 0x0; + this.data[0xbe] = 0x0; + this.data[0xbf] = 0x0; + this.data[0xc0] = 0x0; + this.data[0xc1] = 0x0; + this.data[0xc2] = 0x0; + this.data[0xc3] = 0x0; + this.data[0xc4] = 0x0; + this.data[0xc5] = 0x0; + this.data[0xc6] = 0x0; + this.data[0xc7] = 0x0; + this.data[0xc8] = 0x0; + this.data[0xc9] = 0x0; + this.data[0xca] = 0x0; + this.data[0xcb] = 0x0; + this.data[0xcc] = 0x0; + this.data[0xcd] = 0x0; + this.data[0xce] = 0x0; + this.data[0xcf] = 0x0; + this.data[0xd0] = 0x0; + this.data[0xd1] = 0x0; + this.data[0xd2] = 0x0; + this.data[0xd3] = 0x0; + this.data[0xd4] = 0x0; + this.data[0xd5] = 0x0; + this.data[0xd6] = 0x0; + this.data[0xd7] = 0x0; + this.data[0xd8] = 0x0; + this.data[0xd9] = 0x0; + this.data[0xda] = 0x0; + this.data[0xdb] = 0x0; + this.data[0xdc] = 0x0; + this.data[0xdd] = 0x0; + this.data[0xde] = 0x0; + this.data[0xdf] = 0x0; + this.data[0xe0] = 0x0; + this.data[0xe1] = 0x0; + this.data[0xe2] = 0x0; + this.data[0xe3] = 0x0; + this.data[0xe4] = 0x0; + this.data[0xe5] = 0x0; + this.data[0xe6] = 0x0; + this.data[0xe7] = 0x0; + this.data[0xe8] = 0x0; + this.data[0xe9] = 0x0; + this.data[0xea] = 0x0; + this.data[0xeb] = 0x0; + this.data[0xec] = 0x0; + this.data[0xed] = 0x0; + this.data[0xee] = 0x0; + this.data[0xef] = 0x0; + this.data[0xf0] = 0x0; + this.data[0xf1] = 0x0; + this.data[0xf2] = 0x0; + this.data[0xf3] = 0x0; + this.data[0xf4] = 0x0; + this.data[0xf5] = 0x0; + this.data[0xf6] = 0x0; + this.data[0xf7] = 0x0; + this.data[0xf8] = 0xe01133bd; + this.data[0xf9] = 0xc0ea362; + this.data[0xfa] = 0x9d48a555; + this.data[0xfb] = 0x947a820; + this.data[0xfc] = 0x0; + this.data[0xfd] = 0x0; + this.data[0xfe] = 0x0; + this.data[0xff] = 0x1000008; + this.lockAddress = 0; } diff --git a/emulation/peripherals/vexriscv-aes.cs b/emulation/peripherals/vexriscv-aes.cs new file mode 100644 index 000000000..009fca41c --- /dev/null +++ b/emulation/peripherals/vexriscv-aes.cs @@ -0,0 +1,4262 @@ +// +// Copyright (c) 2010-2021 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// +using System; +using ELFSharp.ELF; +using Antmicro.Renode.Utilities; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Peripherals.Timers; + +namespace Antmicro.Renode.Peripherals.CPU +{ + public class AesVexRiscv : VexRiscv + { + public AesVexRiscv(Core.Machine machine, + uint hartId = 0, + IRiscVTimeProvider timeProvider = null, + PrivilegeArchitecture privilegeArchitecture = PrivilegeArchitecture.Priv1_10, + string cpuType = "rv32im", + bool builtInIrqController = true) : base(machine, hartId, timeProvider, privilegeArchitecture, cpuType, builtInIrqController) + { + CreateTables(); + InstallCustomInstruction(pattern: "ssss0lebbbbbaaaaa000ddddd0001011", handler: HandleAesInstruction); // RegisterCustomInstructions(); + } + + // 3322222 22222 11111 111 11000 0000000 + // 1098765 43210 98765 432 10987 6543210 + // aes_enc_round: ssss000 bbbbb aaaaa 000 ddddd 0001011 + // aes_enc_round_last: ssss010 bbbbb aaaaa 000 ddddd 0001011 + // aes_dec_round: ssss001 bbbbb aaaaa 000 ddddd 0001011 + // aes_dec_round_last: ssss011 bbbbb aaaaa 000 ddddd 0001011 + public void HandleAesInstruction(UInt64 opcode) + { + var rd = (int)BitHelper.GetValue(opcode, 7, 5); + var rs1 = (int)BitHelper.GetValue(opcode, 15, 5); + var rs2 = (int)BitHelper.GetValue(opcode, 20, 5); + var is_dec = BitHelper.IsBitSet(opcode, 25); + var is_last = BitHelper.IsBitSet(opcode, 26); + var byte_sel = (int)BitHelper.GetValue(opcode, 28, 2); + + + var arg1 = (UInt32)GetRegisterUnsafe(rs1).RawValue; + var arg2 = (UInt32)GetRegisterUnsafe(rs2).RawValue; + var byte_val = (arg2 >> (byte_sel * 8)) & 0xff; + + UInt32 result = 0; + if (is_dec) + { + // print("Handling%s AES DEcode, instruction is %08x (%s), rs1: x%d (%08x), rs2: x%d (%08x), rd: x%d" % + // (is_last_str, opcode, bin(opcode), rs1, arg1, rs2, arg2, rd)) + if (is_last) + { + result = arg1 ^ decrypt_last_ref[byte_sel][byte_val]; + } + else + { + result = arg1 ^ decrypt_ref[byte_sel][byte_val]; + } + } + else + { + // print("Handling%s AES enCODE, instruction is %08x (%s), rs1: x%d (%08x), rs2: x%d (%08x), rd: x%d, byte#: %d (%02x)" % + // (is_last_str, opcode, bin(opcode), rs1, arg1, rs2, arg2, rd, byte_sel, byte_val)) + if (is_last) + { + result = arg1 ^ encrypt_last_ref[byte_sel][byte_val]; + } + else + { + result = arg1 ^ encrypt_ref[byte_sel][byte_val]; + } + } + + this.Log(LogLevel.Noisy, "PC@0x{8:X}: Handling aes instruction: is dec? {0}, is last? {1}, rs1: x{2} ({5:X8}), rs2: x{3} ({6:X8}), written to x{4} ({7:X8})", + is_dec, is_last, rs1, rs2, rd, arg1, arg2, result, PC.RawValue); + + SetRegisterUnsafe(rd, (ulong)result); + } + + private void CreateTables() + { + var idx = 0; + + UInt32[] encrypt_ref_0 = new UInt32[256]; + UInt32[] encrypt_ref_1 = new UInt32[256]; + UInt32[] encrypt_ref_2 = new UInt32[256]; + UInt32[] encrypt_ref_3 = new UInt32[256]; + + UInt32[] encrypt_last_ref_0 = new UInt32[256]; + UInt32[] encrypt_last_ref_1 = new UInt32[256]; + UInt32[] encrypt_last_ref_2 = new UInt32[256]; + UInt32[] encrypt_last_ref_3 = new UInt32[256]; + + UInt32[] decrypt_ref_0 = new UInt32[256]; + UInt32[] decrypt_ref_1 = new UInt32[256]; + UInt32[] decrypt_ref_2 = new UInt32[256]; + UInt32[] decrypt_ref_3 = new UInt32[256]; + + UInt32[] decrypt_last_ref_0 = new UInt32[256]; + UInt32[] decrypt_last_ref_1 = new UInt32[256]; + UInt32[] decrypt_last_ref_2 = new UInt32[256]; + UInt32[] decrypt_last_ref_3 = new UInt32[256]; + + idx = 0; + encrypt_ref_0[idx++] = 0xa56363c6; + encrypt_ref_0[idx++] = 0x847c7cf8; + encrypt_ref_0[idx++] = 0x997777ee; + encrypt_ref_0[idx++] = 0x8d7b7bf6; + encrypt_ref_0[idx++] = 0x0df2f2ff; + encrypt_ref_0[idx++] = 0xbd6b6bd6; + encrypt_ref_0[idx++] = 0xb16f6fde; + encrypt_ref_0[idx++] = 0x54c5c591; + encrypt_ref_0[idx++] = 0x50303060; + encrypt_ref_0[idx++] = 0x03010102; + encrypt_ref_0[idx++] = 0xa96767ce; + encrypt_ref_0[idx++] = 0x7d2b2b56; + encrypt_ref_0[idx++] = 0x19fefee7; + encrypt_ref_0[idx++] = 0x62d7d7b5; + encrypt_ref_0[idx++] = 0xe6abab4d; + encrypt_ref_0[idx++] = 0x9a7676ec; + encrypt_ref_0[idx++] = 0x45caca8f; + encrypt_ref_0[idx++] = 0x9d82821f; + encrypt_ref_0[idx++] = 0x40c9c989; + encrypt_ref_0[idx++] = 0x877d7dfa; + encrypt_ref_0[idx++] = 0x15fafaef; + encrypt_ref_0[idx++] = 0xeb5959b2; + encrypt_ref_0[idx++] = 0xc947478e; + encrypt_ref_0[idx++] = 0x0bf0f0fb; + encrypt_ref_0[idx++] = 0xecadad41; + encrypt_ref_0[idx++] = 0x67d4d4b3; + encrypt_ref_0[idx++] = 0xfda2a25f; + encrypt_ref_0[idx++] = 0xeaafaf45; + encrypt_ref_0[idx++] = 0xbf9c9c23; + encrypt_ref_0[idx++] = 0xf7a4a453; + encrypt_ref_0[idx++] = 0x967272e4; + encrypt_ref_0[idx++] = 0x5bc0c09b; + encrypt_ref_0[idx++] = 0xc2b7b775; + encrypt_ref_0[idx++] = 0x1cfdfde1; + encrypt_ref_0[idx++] = 0xae93933d; + encrypt_ref_0[idx++] = 0x6a26264c; + encrypt_ref_0[idx++] = 0x5a36366c; + encrypt_ref_0[idx++] = 0x413f3f7e; + encrypt_ref_0[idx++] = 0x02f7f7f5; + encrypt_ref_0[idx++] = 0x4fcccc83; + encrypt_ref_0[idx++] = 0x5c343468; + encrypt_ref_0[idx++] = 0xf4a5a551; + encrypt_ref_0[idx++] = 0x34e5e5d1; + encrypt_ref_0[idx++] = 0x08f1f1f9; + encrypt_ref_0[idx++] = 0x937171e2; + encrypt_ref_0[idx++] = 0x73d8d8ab; + encrypt_ref_0[idx++] = 0x53313162; + encrypt_ref_0[idx++] = 0x3f15152a; + encrypt_ref_0[idx++] = 0x0c040408; + encrypt_ref_0[idx++] = 0x52c7c795; + encrypt_ref_0[idx++] = 0x65232346; + encrypt_ref_0[idx++] = 0x5ec3c39d; + encrypt_ref_0[idx++] = 0x28181830; + encrypt_ref_0[idx++] = 0xa1969637; + encrypt_ref_0[idx++] = 0x0f05050a; + encrypt_ref_0[idx++] = 0xb59a9a2f; + encrypt_ref_0[idx++] = 0x0907070e; + encrypt_ref_0[idx++] = 0x36121224; + encrypt_ref_0[idx++] = 0x9b80801b; + encrypt_ref_0[idx++] = 0x3de2e2df; + encrypt_ref_0[idx++] = 0x26ebebcd; + encrypt_ref_0[idx++] = 0x6927274e; + encrypt_ref_0[idx++] = 0xcdb2b27f; + encrypt_ref_0[idx++] = 0x9f7575ea; + encrypt_ref_0[idx++] = 0x1b090912; + encrypt_ref_0[idx++] = 0x9e83831d; + encrypt_ref_0[idx++] = 0x742c2c58; + encrypt_ref_0[idx++] = 0x2e1a1a34; + encrypt_ref_0[idx++] = 0x2d1b1b36; + encrypt_ref_0[idx++] = 0xb26e6edc; + encrypt_ref_0[idx++] = 0xee5a5ab4; + encrypt_ref_0[idx++] = 0xfba0a05b; + encrypt_ref_0[idx++] = 0xf65252a4; + encrypt_ref_0[idx++] = 0x4d3b3b76; + encrypt_ref_0[idx++] = 0x61d6d6b7; + encrypt_ref_0[idx++] = 0xceb3b37d; + encrypt_ref_0[idx++] = 0x7b292952; + encrypt_ref_0[idx++] = 0x3ee3e3dd; + encrypt_ref_0[idx++] = 0x712f2f5e; + encrypt_ref_0[idx++] = 0x97848413; + encrypt_ref_0[idx++] = 0xf55353a6; + encrypt_ref_0[idx++] = 0x68d1d1b9; + encrypt_ref_0[idx++] = 0x00000000; + encrypt_ref_0[idx++] = 0x2cededc1; + encrypt_ref_0[idx++] = 0x60202040; + encrypt_ref_0[idx++] = 0x1ffcfce3; + encrypt_ref_0[idx++] = 0xc8b1b179; + encrypt_ref_0[idx++] = 0xed5b5bb6; + encrypt_ref_0[idx++] = 0xbe6a6ad4; + encrypt_ref_0[idx++] = 0x46cbcb8d; + encrypt_ref_0[idx++] = 0xd9bebe67; + encrypt_ref_0[idx++] = 0x4b393972; + encrypt_ref_0[idx++] = 0xde4a4a94; + encrypt_ref_0[idx++] = 0xd44c4c98; + encrypt_ref_0[idx++] = 0xe85858b0; + encrypt_ref_0[idx++] = 0x4acfcf85; + encrypt_ref_0[idx++] = 0x6bd0d0bb; + encrypt_ref_0[idx++] = 0x2aefefc5; + encrypt_ref_0[idx++] = 0xe5aaaa4f; + encrypt_ref_0[idx++] = 0x16fbfbed; + encrypt_ref_0[idx++] = 0xc5434386; + encrypt_ref_0[idx++] = 0xd74d4d9a; + encrypt_ref_0[idx++] = 0x55333366; + encrypt_ref_0[idx++] = 0x94858511; + encrypt_ref_0[idx++] = 0xcf45458a; + encrypt_ref_0[idx++] = 0x10f9f9e9; + encrypt_ref_0[idx++] = 0x06020204; + encrypt_ref_0[idx++] = 0x817f7ffe; + encrypt_ref_0[idx++] = 0xf05050a0; + encrypt_ref_0[idx++] = 0x443c3c78; + encrypt_ref_0[idx++] = 0xba9f9f25; + encrypt_ref_0[idx++] = 0xe3a8a84b; + encrypt_ref_0[idx++] = 0xf35151a2; + encrypt_ref_0[idx++] = 0xfea3a35d; + encrypt_ref_0[idx++] = 0xc0404080; + encrypt_ref_0[idx++] = 0x8a8f8f05; + encrypt_ref_0[idx++] = 0xad92923f; + encrypt_ref_0[idx++] = 0xbc9d9d21; + encrypt_ref_0[idx++] = 0x48383870; + encrypt_ref_0[idx++] = 0x04f5f5f1; + encrypt_ref_0[idx++] = 0xdfbcbc63; + encrypt_ref_0[idx++] = 0xc1b6b677; + encrypt_ref_0[idx++] = 0x75dadaaf; + encrypt_ref_0[idx++] = 0x63212142; + encrypt_ref_0[idx++] = 0x30101020; + encrypt_ref_0[idx++] = 0x1affffe5; + encrypt_ref_0[idx++] = 0x0ef3f3fd; + encrypt_ref_0[idx++] = 0x6dd2d2bf; + encrypt_ref_0[idx++] = 0x4ccdcd81; + encrypt_ref_0[idx++] = 0x140c0c18; + encrypt_ref_0[idx++] = 0x35131326; + encrypt_ref_0[idx++] = 0x2fececc3; + encrypt_ref_0[idx++] = 0xe15f5fbe; + encrypt_ref_0[idx++] = 0xa2979735; + encrypt_ref_0[idx++] = 0xcc444488; + encrypt_ref_0[idx++] = 0x3917172e; + encrypt_ref_0[idx++] = 0x57c4c493; + encrypt_ref_0[idx++] = 0xf2a7a755; + encrypt_ref_0[idx++] = 0x827e7efc; + encrypt_ref_0[idx++] = 0x473d3d7a; + encrypt_ref_0[idx++] = 0xac6464c8; + encrypt_ref_0[idx++] = 0xe75d5dba; + encrypt_ref_0[idx++] = 0x2b191932; + encrypt_ref_0[idx++] = 0x957373e6; + encrypt_ref_0[idx++] = 0xa06060c0; + encrypt_ref_0[idx++] = 0x98818119; + encrypt_ref_0[idx++] = 0xd14f4f9e; + encrypt_ref_0[idx++] = 0x7fdcdca3; + encrypt_ref_0[idx++] = 0x66222244; + encrypt_ref_0[idx++] = 0x7e2a2a54; + encrypt_ref_0[idx++] = 0xab90903b; + encrypt_ref_0[idx++] = 0x8388880b; + encrypt_ref_0[idx++] = 0xca46468c; + encrypt_ref_0[idx++] = 0x29eeeec7; + encrypt_ref_0[idx++] = 0xd3b8b86b; + encrypt_ref_0[idx++] = 0x3c141428; + encrypt_ref_0[idx++] = 0x79dedea7; + encrypt_ref_0[idx++] = 0xe25e5ebc; + encrypt_ref_0[idx++] = 0x1d0b0b16; + encrypt_ref_0[idx++] = 0x76dbdbad; + encrypt_ref_0[idx++] = 0x3be0e0db; + encrypt_ref_0[idx++] = 0x56323264; + encrypt_ref_0[idx++] = 0x4e3a3a74; + encrypt_ref_0[idx++] = 0x1e0a0a14; + encrypt_ref_0[idx++] = 0xdb494992; + encrypt_ref_0[idx++] = 0x0a06060c; + encrypt_ref_0[idx++] = 0x6c242448; + encrypt_ref_0[idx++] = 0xe45c5cb8; + encrypt_ref_0[idx++] = 0x5dc2c29f; + encrypt_ref_0[idx++] = 0x6ed3d3bd; + encrypt_ref_0[idx++] = 0xefacac43; + encrypt_ref_0[idx++] = 0xa66262c4; + encrypt_ref_0[idx++] = 0xa8919139; + encrypt_ref_0[idx++] = 0xa4959531; + encrypt_ref_0[idx++] = 0x37e4e4d3; + encrypt_ref_0[idx++] = 0x8b7979f2; + encrypt_ref_0[idx++] = 0x32e7e7d5; + encrypt_ref_0[idx++] = 0x43c8c88b; + encrypt_ref_0[idx++] = 0x5937376e; + encrypt_ref_0[idx++] = 0xb76d6dda; + encrypt_ref_0[idx++] = 0x8c8d8d01; + encrypt_ref_0[idx++] = 0x64d5d5b1; + encrypt_ref_0[idx++] = 0xd24e4e9c; + encrypt_ref_0[idx++] = 0xe0a9a949; + encrypt_ref_0[idx++] = 0xb46c6cd8; + encrypt_ref_0[idx++] = 0xfa5656ac; + encrypt_ref_0[idx++] = 0x07f4f4f3; + encrypt_ref_0[idx++] = 0x25eaeacf; + encrypt_ref_0[idx++] = 0xaf6565ca; + encrypt_ref_0[idx++] = 0x8e7a7af4; + encrypt_ref_0[idx++] = 0xe9aeae47; + encrypt_ref_0[idx++] = 0x18080810; + encrypt_ref_0[idx++] = 0xd5baba6f; + encrypt_ref_0[idx++] = 0x887878f0; + encrypt_ref_0[idx++] = 0x6f25254a; + encrypt_ref_0[idx++] = 0x722e2e5c; + encrypt_ref_0[idx++] = 0x241c1c38; + encrypt_ref_0[idx++] = 0xf1a6a657; + encrypt_ref_0[idx++] = 0xc7b4b473; + encrypt_ref_0[idx++] = 0x51c6c697; + encrypt_ref_0[idx++] = 0x23e8e8cb; + encrypt_ref_0[idx++] = 0x7cdddda1; + encrypt_ref_0[idx++] = 0x9c7474e8; + encrypt_ref_0[idx++] = 0x211f1f3e; + encrypt_ref_0[idx++] = 0xdd4b4b96; + encrypt_ref_0[idx++] = 0xdcbdbd61; + encrypt_ref_0[idx++] = 0x868b8b0d; + encrypt_ref_0[idx++] = 0x858a8a0f; + encrypt_ref_0[idx++] = 0x907070e0; + encrypt_ref_0[idx++] = 0x423e3e7c; + encrypt_ref_0[idx++] = 0xc4b5b571; + encrypt_ref_0[idx++] = 0xaa6666cc; + encrypt_ref_0[idx++] = 0xd8484890; + encrypt_ref_0[idx++] = 0x05030306; + encrypt_ref_0[idx++] = 0x01f6f6f7; + encrypt_ref_0[idx++] = 0x120e0e1c; + encrypt_ref_0[idx++] = 0xa36161c2; + encrypt_ref_0[idx++] = 0x5f35356a; + encrypt_ref_0[idx++] = 0xf95757ae; + encrypt_ref_0[idx++] = 0xd0b9b969; + encrypt_ref_0[idx++] = 0x91868617; + encrypt_ref_0[idx++] = 0x58c1c199; + encrypt_ref_0[idx++] = 0x271d1d3a; + encrypt_ref_0[idx++] = 0xb99e9e27; + encrypt_ref_0[idx++] = 0x38e1e1d9; + encrypt_ref_0[idx++] = 0x13f8f8eb; + encrypt_ref_0[idx++] = 0xb398982b; + encrypt_ref_0[idx++] = 0x33111122; + encrypt_ref_0[idx++] = 0xbb6969d2; + encrypt_ref_0[idx++] = 0x70d9d9a9; + encrypt_ref_0[idx++] = 0x898e8e07; + encrypt_ref_0[idx++] = 0xa7949433; + encrypt_ref_0[idx++] = 0xb69b9b2d; + encrypt_ref_0[idx++] = 0x221e1e3c; + encrypt_ref_0[idx++] = 0x92878715; + encrypt_ref_0[idx++] = 0x20e9e9c9; + encrypt_ref_0[idx++] = 0x49cece87; + encrypt_ref_0[idx++] = 0xff5555aa; + encrypt_ref_0[idx++] = 0x78282850; + encrypt_ref_0[idx++] = 0x7adfdfa5; + encrypt_ref_0[idx++] = 0x8f8c8c03; + encrypt_ref_0[idx++] = 0xf8a1a159; + encrypt_ref_0[idx++] = 0x80898909; + encrypt_ref_0[idx++] = 0x170d0d1a; + encrypt_ref_0[idx++] = 0xdabfbf65; + encrypt_ref_0[idx++] = 0x31e6e6d7; + encrypt_ref_0[idx++] = 0xc6424284; + encrypt_ref_0[idx++] = 0xb86868d0; + encrypt_ref_0[idx++] = 0xc3414182; + encrypt_ref_0[idx++] = 0xb0999929; + encrypt_ref_0[idx++] = 0x772d2d5a; + encrypt_ref_0[idx++] = 0x110f0f1e; + encrypt_ref_0[idx++] = 0xcbb0b07b; + encrypt_ref_0[idx++] = 0xfc5454a8; + encrypt_ref_0[idx++] = 0xd6bbbb6d; + encrypt_ref_0[idx++] = 0x3a16162c; + + idx = 0; + encrypt_ref_1[idx++] = 0x6363c6a5; + encrypt_ref_1[idx++] = 0x7c7cf884; + encrypt_ref_1[idx++] = 0x7777ee99; + encrypt_ref_1[idx++] = 0x7b7bf68d; + encrypt_ref_1[idx++] = 0xf2f2ff0d; + encrypt_ref_1[idx++] = 0x6b6bd6bd; + encrypt_ref_1[idx++] = 0x6f6fdeb1; + encrypt_ref_1[idx++] = 0xc5c59154; + encrypt_ref_1[idx++] = 0x30306050; + encrypt_ref_1[idx++] = 0x01010203; + encrypt_ref_1[idx++] = 0x6767cea9; + encrypt_ref_1[idx++] = 0x2b2b567d; + encrypt_ref_1[idx++] = 0xfefee719; + encrypt_ref_1[idx++] = 0xd7d7b562; + encrypt_ref_1[idx++] = 0xabab4de6; + encrypt_ref_1[idx++] = 0x7676ec9a; + encrypt_ref_1[idx++] = 0xcaca8f45; + encrypt_ref_1[idx++] = 0x82821f9d; + encrypt_ref_1[idx++] = 0xc9c98940; + encrypt_ref_1[idx++] = 0x7d7dfa87; + encrypt_ref_1[idx++] = 0xfafaef15; + encrypt_ref_1[idx++] = 0x5959b2eb; + encrypt_ref_1[idx++] = 0x47478ec9; + encrypt_ref_1[idx++] = 0xf0f0fb0b; + encrypt_ref_1[idx++] = 0xadad41ec; + encrypt_ref_1[idx++] = 0xd4d4b367; + encrypt_ref_1[idx++] = 0xa2a25ffd; + encrypt_ref_1[idx++] = 0xafaf45ea; + encrypt_ref_1[idx++] = 0x9c9c23bf; + encrypt_ref_1[idx++] = 0xa4a453f7; + encrypt_ref_1[idx++] = 0x7272e496; + encrypt_ref_1[idx++] = 0xc0c09b5b; + encrypt_ref_1[idx++] = 0xb7b775c2; + encrypt_ref_1[idx++] = 0xfdfde11c; + encrypt_ref_1[idx++] = 0x93933dae; + encrypt_ref_1[idx++] = 0x26264c6a; + encrypt_ref_1[idx++] = 0x36366c5a; + encrypt_ref_1[idx++] = 0x3f3f7e41; + encrypt_ref_1[idx++] = 0xf7f7f502; + encrypt_ref_1[idx++] = 0xcccc834f; + encrypt_ref_1[idx++] = 0x3434685c; + encrypt_ref_1[idx++] = 0xa5a551f4; + encrypt_ref_1[idx++] = 0xe5e5d134; + encrypt_ref_1[idx++] = 0xf1f1f908; + encrypt_ref_1[idx++] = 0x7171e293; + encrypt_ref_1[idx++] = 0xd8d8ab73; + encrypt_ref_1[idx++] = 0x31316253; + encrypt_ref_1[idx++] = 0x15152a3f; + encrypt_ref_1[idx++] = 0x0404080c; + encrypt_ref_1[idx++] = 0xc7c79552; + encrypt_ref_1[idx++] = 0x23234665; + encrypt_ref_1[idx++] = 0xc3c39d5e; + encrypt_ref_1[idx++] = 0x18183028; + encrypt_ref_1[idx++] = 0x969637a1; + encrypt_ref_1[idx++] = 0x05050a0f; + encrypt_ref_1[idx++] = 0x9a9a2fb5; + encrypt_ref_1[idx++] = 0x07070e09; + encrypt_ref_1[idx++] = 0x12122436; + encrypt_ref_1[idx++] = 0x80801b9b; + encrypt_ref_1[idx++] = 0xe2e2df3d; + encrypt_ref_1[idx++] = 0xebebcd26; + encrypt_ref_1[idx++] = 0x27274e69; + encrypt_ref_1[idx++] = 0xb2b27fcd; + encrypt_ref_1[idx++] = 0x7575ea9f; + encrypt_ref_1[idx++] = 0x0909121b; + encrypt_ref_1[idx++] = 0x83831d9e; + encrypt_ref_1[idx++] = 0x2c2c5874; + encrypt_ref_1[idx++] = 0x1a1a342e; + encrypt_ref_1[idx++] = 0x1b1b362d; + encrypt_ref_1[idx++] = 0x6e6edcb2; + encrypt_ref_1[idx++] = 0x5a5ab4ee; + encrypt_ref_1[idx++] = 0xa0a05bfb; + encrypt_ref_1[idx++] = 0x5252a4f6; + encrypt_ref_1[idx++] = 0x3b3b764d; + encrypt_ref_1[idx++] = 0xd6d6b761; + encrypt_ref_1[idx++] = 0xb3b37dce; + encrypt_ref_1[idx++] = 0x2929527b; + encrypt_ref_1[idx++] = 0xe3e3dd3e; + encrypt_ref_1[idx++] = 0x2f2f5e71; + encrypt_ref_1[idx++] = 0x84841397; + encrypt_ref_1[idx++] = 0x5353a6f5; + encrypt_ref_1[idx++] = 0xd1d1b968; + encrypt_ref_1[idx++] = 0x00000000; + encrypt_ref_1[idx++] = 0xededc12c; + encrypt_ref_1[idx++] = 0x20204060; + encrypt_ref_1[idx++] = 0xfcfce31f; + encrypt_ref_1[idx++] = 0xb1b179c8; + encrypt_ref_1[idx++] = 0x5b5bb6ed; + encrypt_ref_1[idx++] = 0x6a6ad4be; + encrypt_ref_1[idx++] = 0xcbcb8d46; + encrypt_ref_1[idx++] = 0xbebe67d9; + encrypt_ref_1[idx++] = 0x3939724b; + encrypt_ref_1[idx++] = 0x4a4a94de; + encrypt_ref_1[idx++] = 0x4c4c98d4; + encrypt_ref_1[idx++] = 0x5858b0e8; + encrypt_ref_1[idx++] = 0xcfcf854a; + encrypt_ref_1[idx++] = 0xd0d0bb6b; + encrypt_ref_1[idx++] = 0xefefc52a; + encrypt_ref_1[idx++] = 0xaaaa4fe5; + encrypt_ref_1[idx++] = 0xfbfbed16; + encrypt_ref_1[idx++] = 0x434386c5; + encrypt_ref_1[idx++] = 0x4d4d9ad7; + encrypt_ref_1[idx++] = 0x33336655; + encrypt_ref_1[idx++] = 0x85851194; + encrypt_ref_1[idx++] = 0x45458acf; + encrypt_ref_1[idx++] = 0xf9f9e910; + encrypt_ref_1[idx++] = 0x02020406; + encrypt_ref_1[idx++] = 0x7f7ffe81; + encrypt_ref_1[idx++] = 0x5050a0f0; + encrypt_ref_1[idx++] = 0x3c3c7844; + encrypt_ref_1[idx++] = 0x9f9f25ba; + encrypt_ref_1[idx++] = 0xa8a84be3; + encrypt_ref_1[idx++] = 0x5151a2f3; + encrypt_ref_1[idx++] = 0xa3a35dfe; + encrypt_ref_1[idx++] = 0x404080c0; + encrypt_ref_1[idx++] = 0x8f8f058a; + encrypt_ref_1[idx++] = 0x92923fad; + encrypt_ref_1[idx++] = 0x9d9d21bc; + encrypt_ref_1[idx++] = 0x38387048; + encrypt_ref_1[idx++] = 0xf5f5f104; + encrypt_ref_1[idx++] = 0xbcbc63df; + encrypt_ref_1[idx++] = 0xb6b677c1; + encrypt_ref_1[idx++] = 0xdadaaf75; + encrypt_ref_1[idx++] = 0x21214263; + encrypt_ref_1[idx++] = 0x10102030; + encrypt_ref_1[idx++] = 0xffffe51a; + encrypt_ref_1[idx++] = 0xf3f3fd0e; + encrypt_ref_1[idx++] = 0xd2d2bf6d; + encrypt_ref_1[idx++] = 0xcdcd814c; + encrypt_ref_1[idx++] = 0x0c0c1814; + encrypt_ref_1[idx++] = 0x13132635; + encrypt_ref_1[idx++] = 0xececc32f; + encrypt_ref_1[idx++] = 0x5f5fbee1; + encrypt_ref_1[idx++] = 0x979735a2; + encrypt_ref_1[idx++] = 0x444488cc; + encrypt_ref_1[idx++] = 0x17172e39; + encrypt_ref_1[idx++] = 0xc4c49357; + encrypt_ref_1[idx++] = 0xa7a755f2; + encrypt_ref_1[idx++] = 0x7e7efc82; + encrypt_ref_1[idx++] = 0x3d3d7a47; + encrypt_ref_1[idx++] = 0x6464c8ac; + encrypt_ref_1[idx++] = 0x5d5dbae7; + encrypt_ref_1[idx++] = 0x1919322b; + encrypt_ref_1[idx++] = 0x7373e695; + encrypt_ref_1[idx++] = 0x6060c0a0; + encrypt_ref_1[idx++] = 0x81811998; + encrypt_ref_1[idx++] = 0x4f4f9ed1; + encrypt_ref_1[idx++] = 0xdcdca37f; + encrypt_ref_1[idx++] = 0x22224466; + encrypt_ref_1[idx++] = 0x2a2a547e; + encrypt_ref_1[idx++] = 0x90903bab; + encrypt_ref_1[idx++] = 0x88880b83; + encrypt_ref_1[idx++] = 0x46468cca; + encrypt_ref_1[idx++] = 0xeeeec729; + encrypt_ref_1[idx++] = 0xb8b86bd3; + encrypt_ref_1[idx++] = 0x1414283c; + encrypt_ref_1[idx++] = 0xdedea779; + encrypt_ref_1[idx++] = 0x5e5ebce2; + encrypt_ref_1[idx++] = 0x0b0b161d; + encrypt_ref_1[idx++] = 0xdbdbad76; + encrypt_ref_1[idx++] = 0xe0e0db3b; + encrypt_ref_1[idx++] = 0x32326456; + encrypt_ref_1[idx++] = 0x3a3a744e; + encrypt_ref_1[idx++] = 0x0a0a141e; + encrypt_ref_1[idx++] = 0x494992db; + encrypt_ref_1[idx++] = 0x06060c0a; + encrypt_ref_1[idx++] = 0x2424486c; + encrypt_ref_1[idx++] = 0x5c5cb8e4; + encrypt_ref_1[idx++] = 0xc2c29f5d; + encrypt_ref_1[idx++] = 0xd3d3bd6e; + encrypt_ref_1[idx++] = 0xacac43ef; + encrypt_ref_1[idx++] = 0x6262c4a6; + encrypt_ref_1[idx++] = 0x919139a8; + encrypt_ref_1[idx++] = 0x959531a4; + encrypt_ref_1[idx++] = 0xe4e4d337; + encrypt_ref_1[idx++] = 0x7979f28b; + encrypt_ref_1[idx++] = 0xe7e7d532; + encrypt_ref_1[idx++] = 0xc8c88b43; + encrypt_ref_1[idx++] = 0x37376e59; + encrypt_ref_1[idx++] = 0x6d6ddab7; + encrypt_ref_1[idx++] = 0x8d8d018c; + encrypt_ref_1[idx++] = 0xd5d5b164; + encrypt_ref_1[idx++] = 0x4e4e9cd2; + encrypt_ref_1[idx++] = 0xa9a949e0; + encrypt_ref_1[idx++] = 0x6c6cd8b4; + encrypt_ref_1[idx++] = 0x5656acfa; + encrypt_ref_1[idx++] = 0xf4f4f307; + encrypt_ref_1[idx++] = 0xeaeacf25; + encrypt_ref_1[idx++] = 0x6565caaf; + encrypt_ref_1[idx++] = 0x7a7af48e; + encrypt_ref_1[idx++] = 0xaeae47e9; + encrypt_ref_1[idx++] = 0x08081018; + encrypt_ref_1[idx++] = 0xbaba6fd5; + encrypt_ref_1[idx++] = 0x7878f088; + encrypt_ref_1[idx++] = 0x25254a6f; + encrypt_ref_1[idx++] = 0x2e2e5c72; + encrypt_ref_1[idx++] = 0x1c1c3824; + encrypt_ref_1[idx++] = 0xa6a657f1; + encrypt_ref_1[idx++] = 0xb4b473c7; + encrypt_ref_1[idx++] = 0xc6c69751; + encrypt_ref_1[idx++] = 0xe8e8cb23; + encrypt_ref_1[idx++] = 0xdddda17c; + encrypt_ref_1[idx++] = 0x7474e89c; + encrypt_ref_1[idx++] = 0x1f1f3e21; + encrypt_ref_1[idx++] = 0x4b4b96dd; + encrypt_ref_1[idx++] = 0xbdbd61dc; + encrypt_ref_1[idx++] = 0x8b8b0d86; + encrypt_ref_1[idx++] = 0x8a8a0f85; + encrypt_ref_1[idx++] = 0x7070e090; + encrypt_ref_1[idx++] = 0x3e3e7c42; + encrypt_ref_1[idx++] = 0xb5b571c4; + encrypt_ref_1[idx++] = 0x6666ccaa; + encrypt_ref_1[idx++] = 0x484890d8; + encrypt_ref_1[idx++] = 0x03030605; + encrypt_ref_1[idx++] = 0xf6f6f701; + encrypt_ref_1[idx++] = 0x0e0e1c12; + encrypt_ref_1[idx++] = 0x6161c2a3; + encrypt_ref_1[idx++] = 0x35356a5f; + encrypt_ref_1[idx++] = 0x5757aef9; + encrypt_ref_1[idx++] = 0xb9b969d0; + encrypt_ref_1[idx++] = 0x86861791; + encrypt_ref_1[idx++] = 0xc1c19958; + encrypt_ref_1[idx++] = 0x1d1d3a27; + encrypt_ref_1[idx++] = 0x9e9e27b9; + encrypt_ref_1[idx++] = 0xe1e1d938; + encrypt_ref_1[idx++] = 0xf8f8eb13; + encrypt_ref_1[idx++] = 0x98982bb3; + encrypt_ref_1[idx++] = 0x11112233; + encrypt_ref_1[idx++] = 0x6969d2bb; + encrypt_ref_1[idx++] = 0xd9d9a970; + encrypt_ref_1[idx++] = 0x8e8e0789; + encrypt_ref_1[idx++] = 0x949433a7; + encrypt_ref_1[idx++] = 0x9b9b2db6; + encrypt_ref_1[idx++] = 0x1e1e3c22; + encrypt_ref_1[idx++] = 0x87871592; + encrypt_ref_1[idx++] = 0xe9e9c920; + encrypt_ref_1[idx++] = 0xcece8749; + encrypt_ref_1[idx++] = 0x5555aaff; + encrypt_ref_1[idx++] = 0x28285078; + encrypt_ref_1[idx++] = 0xdfdfa57a; + encrypt_ref_1[idx++] = 0x8c8c038f; + encrypt_ref_1[idx++] = 0xa1a159f8; + encrypt_ref_1[idx++] = 0x89890980; + encrypt_ref_1[idx++] = 0x0d0d1a17; + encrypt_ref_1[idx++] = 0xbfbf65da; + encrypt_ref_1[idx++] = 0xe6e6d731; + encrypt_ref_1[idx++] = 0x424284c6; + encrypt_ref_1[idx++] = 0x6868d0b8; + encrypt_ref_1[idx++] = 0x414182c3; + encrypt_ref_1[idx++] = 0x999929b0; + encrypt_ref_1[idx++] = 0x2d2d5a77; + encrypt_ref_1[idx++] = 0x0f0f1e11; + encrypt_ref_1[idx++] = 0xb0b07bcb; + encrypt_ref_1[idx++] = 0x5454a8fc; + encrypt_ref_1[idx++] = 0xbbbb6dd6; + encrypt_ref_1[idx++] = 0x16162c3a; + + idx = 0; + encrypt_ref_2[idx++] = 0x63c6a563; + encrypt_ref_2[idx++] = 0x7cf8847c; + encrypt_ref_2[idx++] = 0x77ee9977; + encrypt_ref_2[idx++] = 0x7bf68d7b; + encrypt_ref_2[idx++] = 0xf2ff0df2; + encrypt_ref_2[idx++] = 0x6bd6bd6b; + encrypt_ref_2[idx++] = 0x6fdeb16f; + encrypt_ref_2[idx++] = 0xc59154c5; + encrypt_ref_2[idx++] = 0x30605030; + encrypt_ref_2[idx++] = 0x01020301; + encrypt_ref_2[idx++] = 0x67cea967; + encrypt_ref_2[idx++] = 0x2b567d2b; + encrypt_ref_2[idx++] = 0xfee719fe; + encrypt_ref_2[idx++] = 0xd7b562d7; + encrypt_ref_2[idx++] = 0xab4de6ab; + encrypt_ref_2[idx++] = 0x76ec9a76; + encrypt_ref_2[idx++] = 0xca8f45ca; + encrypt_ref_2[idx++] = 0x821f9d82; + encrypt_ref_2[idx++] = 0xc98940c9; + encrypt_ref_2[idx++] = 0x7dfa877d; + encrypt_ref_2[idx++] = 0xfaef15fa; + encrypt_ref_2[idx++] = 0x59b2eb59; + encrypt_ref_2[idx++] = 0x478ec947; + encrypt_ref_2[idx++] = 0xf0fb0bf0; + encrypt_ref_2[idx++] = 0xad41ecad; + encrypt_ref_2[idx++] = 0xd4b367d4; + encrypt_ref_2[idx++] = 0xa25ffda2; + encrypt_ref_2[idx++] = 0xaf45eaaf; + encrypt_ref_2[idx++] = 0x9c23bf9c; + encrypt_ref_2[idx++] = 0xa453f7a4; + encrypt_ref_2[idx++] = 0x72e49672; + encrypt_ref_2[idx++] = 0xc09b5bc0; + encrypt_ref_2[idx++] = 0xb775c2b7; + encrypt_ref_2[idx++] = 0xfde11cfd; + encrypt_ref_2[idx++] = 0x933dae93; + encrypt_ref_2[idx++] = 0x264c6a26; + encrypt_ref_2[idx++] = 0x366c5a36; + encrypt_ref_2[idx++] = 0x3f7e413f; + encrypt_ref_2[idx++] = 0xf7f502f7; + encrypt_ref_2[idx++] = 0xcc834fcc; + encrypt_ref_2[idx++] = 0x34685c34; + encrypt_ref_2[idx++] = 0xa551f4a5; + encrypt_ref_2[idx++] = 0xe5d134e5; + encrypt_ref_2[idx++] = 0xf1f908f1; + encrypt_ref_2[idx++] = 0x71e29371; + encrypt_ref_2[idx++] = 0xd8ab73d8; + encrypt_ref_2[idx++] = 0x31625331; + encrypt_ref_2[idx++] = 0x152a3f15; + encrypt_ref_2[idx++] = 0x04080c04; + encrypt_ref_2[idx++] = 0xc79552c7; + encrypt_ref_2[idx++] = 0x23466523; + encrypt_ref_2[idx++] = 0xc39d5ec3; + encrypt_ref_2[idx++] = 0x18302818; + encrypt_ref_2[idx++] = 0x9637a196; + encrypt_ref_2[idx++] = 0x050a0f05; + encrypt_ref_2[idx++] = 0x9a2fb59a; + encrypt_ref_2[idx++] = 0x070e0907; + encrypt_ref_2[idx++] = 0x12243612; + encrypt_ref_2[idx++] = 0x801b9b80; + encrypt_ref_2[idx++] = 0xe2df3de2; + encrypt_ref_2[idx++] = 0xebcd26eb; + encrypt_ref_2[idx++] = 0x274e6927; + encrypt_ref_2[idx++] = 0xb27fcdb2; + encrypt_ref_2[idx++] = 0x75ea9f75; + encrypt_ref_2[idx++] = 0x09121b09; + encrypt_ref_2[idx++] = 0x831d9e83; + encrypt_ref_2[idx++] = 0x2c58742c; + encrypt_ref_2[idx++] = 0x1a342e1a; + encrypt_ref_2[idx++] = 0x1b362d1b; + encrypt_ref_2[idx++] = 0x6edcb26e; + encrypt_ref_2[idx++] = 0x5ab4ee5a; + encrypt_ref_2[idx++] = 0xa05bfba0; + encrypt_ref_2[idx++] = 0x52a4f652; + encrypt_ref_2[idx++] = 0x3b764d3b; + encrypt_ref_2[idx++] = 0xd6b761d6; + encrypt_ref_2[idx++] = 0xb37dceb3; + encrypt_ref_2[idx++] = 0x29527b29; + encrypt_ref_2[idx++] = 0xe3dd3ee3; + encrypt_ref_2[idx++] = 0x2f5e712f; + encrypt_ref_2[idx++] = 0x84139784; + encrypt_ref_2[idx++] = 0x53a6f553; + encrypt_ref_2[idx++] = 0xd1b968d1; + encrypt_ref_2[idx++] = 0x00000000; + encrypt_ref_2[idx++] = 0xedc12ced; + encrypt_ref_2[idx++] = 0x20406020; + encrypt_ref_2[idx++] = 0xfce31ffc; + encrypt_ref_2[idx++] = 0xb179c8b1; + encrypt_ref_2[idx++] = 0x5bb6ed5b; + encrypt_ref_2[idx++] = 0x6ad4be6a; + encrypt_ref_2[idx++] = 0xcb8d46cb; + encrypt_ref_2[idx++] = 0xbe67d9be; + encrypt_ref_2[idx++] = 0x39724b39; + encrypt_ref_2[idx++] = 0x4a94de4a; + encrypt_ref_2[idx++] = 0x4c98d44c; + encrypt_ref_2[idx++] = 0x58b0e858; + encrypt_ref_2[idx++] = 0xcf854acf; + encrypt_ref_2[idx++] = 0xd0bb6bd0; + encrypt_ref_2[idx++] = 0xefc52aef; + encrypt_ref_2[idx++] = 0xaa4fe5aa; + encrypt_ref_2[idx++] = 0xfbed16fb; + encrypt_ref_2[idx++] = 0x4386c543; + encrypt_ref_2[idx++] = 0x4d9ad74d; + encrypt_ref_2[idx++] = 0x33665533; + encrypt_ref_2[idx++] = 0x85119485; + encrypt_ref_2[idx++] = 0x458acf45; + encrypt_ref_2[idx++] = 0xf9e910f9; + encrypt_ref_2[idx++] = 0x02040602; + encrypt_ref_2[idx++] = 0x7ffe817f; + encrypt_ref_2[idx++] = 0x50a0f050; + encrypt_ref_2[idx++] = 0x3c78443c; + encrypt_ref_2[idx++] = 0x9f25ba9f; + encrypt_ref_2[idx++] = 0xa84be3a8; + encrypt_ref_2[idx++] = 0x51a2f351; + encrypt_ref_2[idx++] = 0xa35dfea3; + encrypt_ref_2[idx++] = 0x4080c040; + encrypt_ref_2[idx++] = 0x8f058a8f; + encrypt_ref_2[idx++] = 0x923fad92; + encrypt_ref_2[idx++] = 0x9d21bc9d; + encrypt_ref_2[idx++] = 0x38704838; + encrypt_ref_2[idx++] = 0xf5f104f5; + encrypt_ref_2[idx++] = 0xbc63dfbc; + encrypt_ref_2[idx++] = 0xb677c1b6; + encrypt_ref_2[idx++] = 0xdaaf75da; + encrypt_ref_2[idx++] = 0x21426321; + encrypt_ref_2[idx++] = 0x10203010; + encrypt_ref_2[idx++] = 0xffe51aff; + encrypt_ref_2[idx++] = 0xf3fd0ef3; + encrypt_ref_2[idx++] = 0xd2bf6dd2; + encrypt_ref_2[idx++] = 0xcd814ccd; + encrypt_ref_2[idx++] = 0x0c18140c; + encrypt_ref_2[idx++] = 0x13263513; + encrypt_ref_2[idx++] = 0xecc32fec; + encrypt_ref_2[idx++] = 0x5fbee15f; + encrypt_ref_2[idx++] = 0x9735a297; + encrypt_ref_2[idx++] = 0x4488cc44; + encrypt_ref_2[idx++] = 0x172e3917; + encrypt_ref_2[idx++] = 0xc49357c4; + encrypt_ref_2[idx++] = 0xa755f2a7; + encrypt_ref_2[idx++] = 0x7efc827e; + encrypt_ref_2[idx++] = 0x3d7a473d; + encrypt_ref_2[idx++] = 0x64c8ac64; + encrypt_ref_2[idx++] = 0x5dbae75d; + encrypt_ref_2[idx++] = 0x19322b19; + encrypt_ref_2[idx++] = 0x73e69573; + encrypt_ref_2[idx++] = 0x60c0a060; + encrypt_ref_2[idx++] = 0x81199881; + encrypt_ref_2[idx++] = 0x4f9ed14f; + encrypt_ref_2[idx++] = 0xdca37fdc; + encrypt_ref_2[idx++] = 0x22446622; + encrypt_ref_2[idx++] = 0x2a547e2a; + encrypt_ref_2[idx++] = 0x903bab90; + encrypt_ref_2[idx++] = 0x880b8388; + encrypt_ref_2[idx++] = 0x468cca46; + encrypt_ref_2[idx++] = 0xeec729ee; + encrypt_ref_2[idx++] = 0xb86bd3b8; + encrypt_ref_2[idx++] = 0x14283c14; + encrypt_ref_2[idx++] = 0xdea779de; + encrypt_ref_2[idx++] = 0x5ebce25e; + encrypt_ref_2[idx++] = 0x0b161d0b; + encrypt_ref_2[idx++] = 0xdbad76db; + encrypt_ref_2[idx++] = 0xe0db3be0; + encrypt_ref_2[idx++] = 0x32645632; + encrypt_ref_2[idx++] = 0x3a744e3a; + encrypt_ref_2[idx++] = 0x0a141e0a; + encrypt_ref_2[idx++] = 0x4992db49; + encrypt_ref_2[idx++] = 0x060c0a06; + encrypt_ref_2[idx++] = 0x24486c24; + encrypt_ref_2[idx++] = 0x5cb8e45c; + encrypt_ref_2[idx++] = 0xc29f5dc2; + encrypt_ref_2[idx++] = 0xd3bd6ed3; + encrypt_ref_2[idx++] = 0xac43efac; + encrypt_ref_2[idx++] = 0x62c4a662; + encrypt_ref_2[idx++] = 0x9139a891; + encrypt_ref_2[idx++] = 0x9531a495; + encrypt_ref_2[idx++] = 0xe4d337e4; + encrypt_ref_2[idx++] = 0x79f28b79; + encrypt_ref_2[idx++] = 0xe7d532e7; + encrypt_ref_2[idx++] = 0xc88b43c8; + encrypt_ref_2[idx++] = 0x376e5937; + encrypt_ref_2[idx++] = 0x6ddab76d; + encrypt_ref_2[idx++] = 0x8d018c8d; + encrypt_ref_2[idx++] = 0xd5b164d5; + encrypt_ref_2[idx++] = 0x4e9cd24e; + encrypt_ref_2[idx++] = 0xa949e0a9; + encrypt_ref_2[idx++] = 0x6cd8b46c; + encrypt_ref_2[idx++] = 0x56acfa56; + encrypt_ref_2[idx++] = 0xf4f307f4; + encrypt_ref_2[idx++] = 0xeacf25ea; + encrypt_ref_2[idx++] = 0x65caaf65; + encrypt_ref_2[idx++] = 0x7af48e7a; + encrypt_ref_2[idx++] = 0xae47e9ae; + encrypt_ref_2[idx++] = 0x08101808; + encrypt_ref_2[idx++] = 0xba6fd5ba; + encrypt_ref_2[idx++] = 0x78f08878; + encrypt_ref_2[idx++] = 0x254a6f25; + encrypt_ref_2[idx++] = 0x2e5c722e; + encrypt_ref_2[idx++] = 0x1c38241c; + encrypt_ref_2[idx++] = 0xa657f1a6; + encrypt_ref_2[idx++] = 0xb473c7b4; + encrypt_ref_2[idx++] = 0xc69751c6; + encrypt_ref_2[idx++] = 0xe8cb23e8; + encrypt_ref_2[idx++] = 0xdda17cdd; + encrypt_ref_2[idx++] = 0x74e89c74; + encrypt_ref_2[idx++] = 0x1f3e211f; + encrypt_ref_2[idx++] = 0x4b96dd4b; + encrypt_ref_2[idx++] = 0xbd61dcbd; + encrypt_ref_2[idx++] = 0x8b0d868b; + encrypt_ref_2[idx++] = 0x8a0f858a; + encrypt_ref_2[idx++] = 0x70e09070; + encrypt_ref_2[idx++] = 0x3e7c423e; + encrypt_ref_2[idx++] = 0xb571c4b5; + encrypt_ref_2[idx++] = 0x66ccaa66; + encrypt_ref_2[idx++] = 0x4890d848; + encrypt_ref_2[idx++] = 0x03060503; + encrypt_ref_2[idx++] = 0xf6f701f6; + encrypt_ref_2[idx++] = 0x0e1c120e; + encrypt_ref_2[idx++] = 0x61c2a361; + encrypt_ref_2[idx++] = 0x356a5f35; + encrypt_ref_2[idx++] = 0x57aef957; + encrypt_ref_2[idx++] = 0xb969d0b9; + encrypt_ref_2[idx++] = 0x86179186; + encrypt_ref_2[idx++] = 0xc19958c1; + encrypt_ref_2[idx++] = 0x1d3a271d; + encrypt_ref_2[idx++] = 0x9e27b99e; + encrypt_ref_2[idx++] = 0xe1d938e1; + encrypt_ref_2[idx++] = 0xf8eb13f8; + encrypt_ref_2[idx++] = 0x982bb398; + encrypt_ref_2[idx++] = 0x11223311; + encrypt_ref_2[idx++] = 0x69d2bb69; + encrypt_ref_2[idx++] = 0xd9a970d9; + encrypt_ref_2[idx++] = 0x8e07898e; + encrypt_ref_2[idx++] = 0x9433a794; + encrypt_ref_2[idx++] = 0x9b2db69b; + encrypt_ref_2[idx++] = 0x1e3c221e; + encrypt_ref_2[idx++] = 0x87159287; + encrypt_ref_2[idx++] = 0xe9c920e9; + encrypt_ref_2[idx++] = 0xce8749ce; + encrypt_ref_2[idx++] = 0x55aaff55; + encrypt_ref_2[idx++] = 0x28507828; + encrypt_ref_2[idx++] = 0xdfa57adf; + encrypt_ref_2[idx++] = 0x8c038f8c; + encrypt_ref_2[idx++] = 0xa159f8a1; + encrypt_ref_2[idx++] = 0x89098089; + encrypt_ref_2[idx++] = 0x0d1a170d; + encrypt_ref_2[idx++] = 0xbf65dabf; + encrypt_ref_2[idx++] = 0xe6d731e6; + encrypt_ref_2[idx++] = 0x4284c642; + encrypt_ref_2[idx++] = 0x68d0b868; + encrypt_ref_2[idx++] = 0x4182c341; + encrypt_ref_2[idx++] = 0x9929b099; + encrypt_ref_2[idx++] = 0x2d5a772d; + encrypt_ref_2[idx++] = 0x0f1e110f; + encrypt_ref_2[idx++] = 0xb07bcbb0; + encrypt_ref_2[idx++] = 0x54a8fc54; + encrypt_ref_2[idx++] = 0xbb6dd6bb; + encrypt_ref_2[idx++] = 0x162c3a16; + + idx = 0; + encrypt_ref_3[idx++] = 0xc6a56363; + encrypt_ref_3[idx++] = 0xf8847c7c; + encrypt_ref_3[idx++] = 0xee997777; + encrypt_ref_3[idx++] = 0xf68d7b7b; + encrypt_ref_3[idx++] = 0xff0df2f2; + encrypt_ref_3[idx++] = 0xd6bd6b6b; + encrypt_ref_3[idx++] = 0xdeb16f6f; + encrypt_ref_3[idx++] = 0x9154c5c5; + encrypt_ref_3[idx++] = 0x60503030; + encrypt_ref_3[idx++] = 0x02030101; + encrypt_ref_3[idx++] = 0xcea96767; + encrypt_ref_3[idx++] = 0x567d2b2b; + encrypt_ref_3[idx++] = 0xe719fefe; + encrypt_ref_3[idx++] = 0xb562d7d7; + encrypt_ref_3[idx++] = 0x4de6abab; + encrypt_ref_3[idx++] = 0xec9a7676; + encrypt_ref_3[idx++] = 0x8f45caca; + encrypt_ref_3[idx++] = 0x1f9d8282; + encrypt_ref_3[idx++] = 0x8940c9c9; + encrypt_ref_3[idx++] = 0xfa877d7d; + encrypt_ref_3[idx++] = 0xef15fafa; + encrypt_ref_3[idx++] = 0xb2eb5959; + encrypt_ref_3[idx++] = 0x8ec94747; + encrypt_ref_3[idx++] = 0xfb0bf0f0; + encrypt_ref_3[idx++] = 0x41ecadad; + encrypt_ref_3[idx++] = 0xb367d4d4; + encrypt_ref_3[idx++] = 0x5ffda2a2; + encrypt_ref_3[idx++] = 0x45eaafaf; + encrypt_ref_3[idx++] = 0x23bf9c9c; + encrypt_ref_3[idx++] = 0x53f7a4a4; + encrypt_ref_3[idx++] = 0xe4967272; + encrypt_ref_3[idx++] = 0x9b5bc0c0; + encrypt_ref_3[idx++] = 0x75c2b7b7; + encrypt_ref_3[idx++] = 0xe11cfdfd; + encrypt_ref_3[idx++] = 0x3dae9393; + encrypt_ref_3[idx++] = 0x4c6a2626; + encrypt_ref_3[idx++] = 0x6c5a3636; + encrypt_ref_3[idx++] = 0x7e413f3f; + encrypt_ref_3[idx++] = 0xf502f7f7; + encrypt_ref_3[idx++] = 0x834fcccc; + encrypt_ref_3[idx++] = 0x685c3434; + encrypt_ref_3[idx++] = 0x51f4a5a5; + encrypt_ref_3[idx++] = 0xd134e5e5; + encrypt_ref_3[idx++] = 0xf908f1f1; + encrypt_ref_3[idx++] = 0xe2937171; + encrypt_ref_3[idx++] = 0xab73d8d8; + encrypt_ref_3[idx++] = 0x62533131; + encrypt_ref_3[idx++] = 0x2a3f1515; + encrypt_ref_3[idx++] = 0x080c0404; + encrypt_ref_3[idx++] = 0x9552c7c7; + encrypt_ref_3[idx++] = 0x46652323; + encrypt_ref_3[idx++] = 0x9d5ec3c3; + encrypt_ref_3[idx++] = 0x30281818; + encrypt_ref_3[idx++] = 0x37a19696; + encrypt_ref_3[idx++] = 0x0a0f0505; + encrypt_ref_3[idx++] = 0x2fb59a9a; + encrypt_ref_3[idx++] = 0x0e090707; + encrypt_ref_3[idx++] = 0x24361212; + encrypt_ref_3[idx++] = 0x1b9b8080; + encrypt_ref_3[idx++] = 0xdf3de2e2; + encrypt_ref_3[idx++] = 0xcd26ebeb; + encrypt_ref_3[idx++] = 0x4e692727; + encrypt_ref_3[idx++] = 0x7fcdb2b2; + encrypt_ref_3[idx++] = 0xea9f7575; + encrypt_ref_3[idx++] = 0x121b0909; + encrypt_ref_3[idx++] = 0x1d9e8383; + encrypt_ref_3[idx++] = 0x58742c2c; + encrypt_ref_3[idx++] = 0x342e1a1a; + encrypt_ref_3[idx++] = 0x362d1b1b; + encrypt_ref_3[idx++] = 0xdcb26e6e; + encrypt_ref_3[idx++] = 0xb4ee5a5a; + encrypt_ref_3[idx++] = 0x5bfba0a0; + encrypt_ref_3[idx++] = 0xa4f65252; + encrypt_ref_3[idx++] = 0x764d3b3b; + encrypt_ref_3[idx++] = 0xb761d6d6; + encrypt_ref_3[idx++] = 0x7dceb3b3; + encrypt_ref_3[idx++] = 0x527b2929; + encrypt_ref_3[idx++] = 0xdd3ee3e3; + encrypt_ref_3[idx++] = 0x5e712f2f; + encrypt_ref_3[idx++] = 0x13978484; + encrypt_ref_3[idx++] = 0xa6f55353; + encrypt_ref_3[idx++] = 0xb968d1d1; + encrypt_ref_3[idx++] = 0x00000000; + encrypt_ref_3[idx++] = 0xc12ceded; + encrypt_ref_3[idx++] = 0x40602020; + encrypt_ref_3[idx++] = 0xe31ffcfc; + encrypt_ref_3[idx++] = 0x79c8b1b1; + encrypt_ref_3[idx++] = 0xb6ed5b5b; + encrypt_ref_3[idx++] = 0xd4be6a6a; + encrypt_ref_3[idx++] = 0x8d46cbcb; + encrypt_ref_3[idx++] = 0x67d9bebe; + encrypt_ref_3[idx++] = 0x724b3939; + encrypt_ref_3[idx++] = 0x94de4a4a; + encrypt_ref_3[idx++] = 0x98d44c4c; + encrypt_ref_3[idx++] = 0xb0e85858; + encrypt_ref_3[idx++] = 0x854acfcf; + encrypt_ref_3[idx++] = 0xbb6bd0d0; + encrypt_ref_3[idx++] = 0xc52aefef; + encrypt_ref_3[idx++] = 0x4fe5aaaa; + encrypt_ref_3[idx++] = 0xed16fbfb; + encrypt_ref_3[idx++] = 0x86c54343; + encrypt_ref_3[idx++] = 0x9ad74d4d; + encrypt_ref_3[idx++] = 0x66553333; + encrypt_ref_3[idx++] = 0x11948585; + encrypt_ref_3[idx++] = 0x8acf4545; + encrypt_ref_3[idx++] = 0xe910f9f9; + encrypt_ref_3[idx++] = 0x04060202; + encrypt_ref_3[idx++] = 0xfe817f7f; + encrypt_ref_3[idx++] = 0xa0f05050; + encrypt_ref_3[idx++] = 0x78443c3c; + encrypt_ref_3[idx++] = 0x25ba9f9f; + encrypt_ref_3[idx++] = 0x4be3a8a8; + encrypt_ref_3[idx++] = 0xa2f35151; + encrypt_ref_3[idx++] = 0x5dfea3a3; + encrypt_ref_3[idx++] = 0x80c04040; + encrypt_ref_3[idx++] = 0x058a8f8f; + encrypt_ref_3[idx++] = 0x3fad9292; + encrypt_ref_3[idx++] = 0x21bc9d9d; + encrypt_ref_3[idx++] = 0x70483838; + encrypt_ref_3[idx++] = 0xf104f5f5; + encrypt_ref_3[idx++] = 0x63dfbcbc; + encrypt_ref_3[idx++] = 0x77c1b6b6; + encrypt_ref_3[idx++] = 0xaf75dada; + encrypt_ref_3[idx++] = 0x42632121; + encrypt_ref_3[idx++] = 0x20301010; + encrypt_ref_3[idx++] = 0xe51affff; + encrypt_ref_3[idx++] = 0xfd0ef3f3; + encrypt_ref_3[idx++] = 0xbf6dd2d2; + encrypt_ref_3[idx++] = 0x814ccdcd; + encrypt_ref_3[idx++] = 0x18140c0c; + encrypt_ref_3[idx++] = 0x26351313; + encrypt_ref_3[idx++] = 0xc32fecec; + encrypt_ref_3[idx++] = 0xbee15f5f; + encrypt_ref_3[idx++] = 0x35a29797; + encrypt_ref_3[idx++] = 0x88cc4444; + encrypt_ref_3[idx++] = 0x2e391717; + encrypt_ref_3[idx++] = 0x9357c4c4; + encrypt_ref_3[idx++] = 0x55f2a7a7; + encrypt_ref_3[idx++] = 0xfc827e7e; + encrypt_ref_3[idx++] = 0x7a473d3d; + encrypt_ref_3[idx++] = 0xc8ac6464; + encrypt_ref_3[idx++] = 0xbae75d5d; + encrypt_ref_3[idx++] = 0x322b1919; + encrypt_ref_3[idx++] = 0xe6957373; + encrypt_ref_3[idx++] = 0xc0a06060; + encrypt_ref_3[idx++] = 0x19988181; + encrypt_ref_3[idx++] = 0x9ed14f4f; + encrypt_ref_3[idx++] = 0xa37fdcdc; + encrypt_ref_3[idx++] = 0x44662222; + encrypt_ref_3[idx++] = 0x547e2a2a; + encrypt_ref_3[idx++] = 0x3bab9090; + encrypt_ref_3[idx++] = 0x0b838888; + encrypt_ref_3[idx++] = 0x8cca4646; + encrypt_ref_3[idx++] = 0xc729eeee; + encrypt_ref_3[idx++] = 0x6bd3b8b8; + encrypt_ref_3[idx++] = 0x283c1414; + encrypt_ref_3[idx++] = 0xa779dede; + encrypt_ref_3[idx++] = 0xbce25e5e; + encrypt_ref_3[idx++] = 0x161d0b0b; + encrypt_ref_3[idx++] = 0xad76dbdb; + encrypt_ref_3[idx++] = 0xdb3be0e0; + encrypt_ref_3[idx++] = 0x64563232; + encrypt_ref_3[idx++] = 0x744e3a3a; + encrypt_ref_3[idx++] = 0x141e0a0a; + encrypt_ref_3[idx++] = 0x92db4949; + encrypt_ref_3[idx++] = 0x0c0a0606; + encrypt_ref_3[idx++] = 0x486c2424; + encrypt_ref_3[idx++] = 0xb8e45c5c; + encrypt_ref_3[idx++] = 0x9f5dc2c2; + encrypt_ref_3[idx++] = 0xbd6ed3d3; + encrypt_ref_3[idx++] = 0x43efacac; + encrypt_ref_3[idx++] = 0xc4a66262; + encrypt_ref_3[idx++] = 0x39a89191; + encrypt_ref_3[idx++] = 0x31a49595; + encrypt_ref_3[idx++] = 0xd337e4e4; + encrypt_ref_3[idx++] = 0xf28b7979; + encrypt_ref_3[idx++] = 0xd532e7e7; + encrypt_ref_3[idx++] = 0x8b43c8c8; + encrypt_ref_3[idx++] = 0x6e593737; + encrypt_ref_3[idx++] = 0xdab76d6d; + encrypt_ref_3[idx++] = 0x018c8d8d; + encrypt_ref_3[idx++] = 0xb164d5d5; + encrypt_ref_3[idx++] = 0x9cd24e4e; + encrypt_ref_3[idx++] = 0x49e0a9a9; + encrypt_ref_3[idx++] = 0xd8b46c6c; + encrypt_ref_3[idx++] = 0xacfa5656; + encrypt_ref_3[idx++] = 0xf307f4f4; + encrypt_ref_3[idx++] = 0xcf25eaea; + encrypt_ref_3[idx++] = 0xcaaf6565; + encrypt_ref_3[idx++] = 0xf48e7a7a; + encrypt_ref_3[idx++] = 0x47e9aeae; + encrypt_ref_3[idx++] = 0x10180808; + encrypt_ref_3[idx++] = 0x6fd5baba; + encrypt_ref_3[idx++] = 0xf0887878; + encrypt_ref_3[idx++] = 0x4a6f2525; + encrypt_ref_3[idx++] = 0x5c722e2e; + encrypt_ref_3[idx++] = 0x38241c1c; + encrypt_ref_3[idx++] = 0x57f1a6a6; + encrypt_ref_3[idx++] = 0x73c7b4b4; + encrypt_ref_3[idx++] = 0x9751c6c6; + encrypt_ref_3[idx++] = 0xcb23e8e8; + encrypt_ref_3[idx++] = 0xa17cdddd; + encrypt_ref_3[idx++] = 0xe89c7474; + encrypt_ref_3[idx++] = 0x3e211f1f; + encrypt_ref_3[idx++] = 0x96dd4b4b; + encrypt_ref_3[idx++] = 0x61dcbdbd; + encrypt_ref_3[idx++] = 0x0d868b8b; + encrypt_ref_3[idx++] = 0x0f858a8a; + encrypt_ref_3[idx++] = 0xe0907070; + encrypt_ref_3[idx++] = 0x7c423e3e; + encrypt_ref_3[idx++] = 0x71c4b5b5; + encrypt_ref_3[idx++] = 0xccaa6666; + encrypt_ref_3[idx++] = 0x90d84848; + encrypt_ref_3[idx++] = 0x06050303; + encrypt_ref_3[idx++] = 0xf701f6f6; + encrypt_ref_3[idx++] = 0x1c120e0e; + encrypt_ref_3[idx++] = 0xc2a36161; + encrypt_ref_3[idx++] = 0x6a5f3535; + encrypt_ref_3[idx++] = 0xaef95757; + encrypt_ref_3[idx++] = 0x69d0b9b9; + encrypt_ref_3[idx++] = 0x17918686; + encrypt_ref_3[idx++] = 0x9958c1c1; + encrypt_ref_3[idx++] = 0x3a271d1d; + encrypt_ref_3[idx++] = 0x27b99e9e; + encrypt_ref_3[idx++] = 0xd938e1e1; + encrypt_ref_3[idx++] = 0xeb13f8f8; + encrypt_ref_3[idx++] = 0x2bb39898; + encrypt_ref_3[idx++] = 0x22331111; + encrypt_ref_3[idx++] = 0xd2bb6969; + encrypt_ref_3[idx++] = 0xa970d9d9; + encrypt_ref_3[idx++] = 0x07898e8e; + encrypt_ref_3[idx++] = 0x33a79494; + encrypt_ref_3[idx++] = 0x2db69b9b; + encrypt_ref_3[idx++] = 0x3c221e1e; + encrypt_ref_3[idx++] = 0x15928787; + encrypt_ref_3[idx++] = 0xc920e9e9; + encrypt_ref_3[idx++] = 0x8749cece; + encrypt_ref_3[idx++] = 0xaaff5555; + encrypt_ref_3[idx++] = 0x50782828; + encrypt_ref_3[idx++] = 0xa57adfdf; + encrypt_ref_3[idx++] = 0x038f8c8c; + encrypt_ref_3[idx++] = 0x59f8a1a1; + encrypt_ref_3[idx++] = 0x09808989; + encrypt_ref_3[idx++] = 0x1a170d0d; + encrypt_ref_3[idx++] = 0x65dabfbf; + encrypt_ref_3[idx++] = 0xd731e6e6; + encrypt_ref_3[idx++] = 0x84c64242; + encrypt_ref_3[idx++] = 0xd0b86868; + encrypt_ref_3[idx++] = 0x82c34141; + encrypt_ref_3[idx++] = 0x29b09999; + encrypt_ref_3[idx++] = 0x5a772d2d; + encrypt_ref_3[idx++] = 0x1e110f0f; + encrypt_ref_3[idx++] = 0x7bcbb0b0; + encrypt_ref_3[idx++] = 0xa8fc5454; + encrypt_ref_3[idx++] = 0x6dd6bbbb; + encrypt_ref_3[idx++] = 0x2c3a1616; + + idx = 0; + encrypt_last_ref_0[idx++] = 0x00000063; + encrypt_last_ref_0[idx++] = 0x0000007c; + encrypt_last_ref_0[idx++] = 0x00000077; + encrypt_last_ref_0[idx++] = 0x0000007b; + encrypt_last_ref_0[idx++] = 0x000000f2; + encrypt_last_ref_0[idx++] = 0x0000006b; + encrypt_last_ref_0[idx++] = 0x0000006f; + encrypt_last_ref_0[idx++] = 0x000000c5; + encrypt_last_ref_0[idx++] = 0x00000030; + encrypt_last_ref_0[idx++] = 0x00000001; + encrypt_last_ref_0[idx++] = 0x00000067; + encrypt_last_ref_0[idx++] = 0x0000002b; + encrypt_last_ref_0[idx++] = 0x000000fe; + encrypt_last_ref_0[idx++] = 0x000000d7; + encrypt_last_ref_0[idx++] = 0x000000ab; + encrypt_last_ref_0[idx++] = 0x00000076; + encrypt_last_ref_0[idx++] = 0x000000ca; + encrypt_last_ref_0[idx++] = 0x00000082; + encrypt_last_ref_0[idx++] = 0x000000c9; + encrypt_last_ref_0[idx++] = 0x0000007d; + encrypt_last_ref_0[idx++] = 0x000000fa; + encrypt_last_ref_0[idx++] = 0x00000059; + encrypt_last_ref_0[idx++] = 0x00000047; + encrypt_last_ref_0[idx++] = 0x000000f0; + encrypt_last_ref_0[idx++] = 0x000000ad; + encrypt_last_ref_0[idx++] = 0x000000d4; + encrypt_last_ref_0[idx++] = 0x000000a2; + encrypt_last_ref_0[idx++] = 0x000000af; + encrypt_last_ref_0[idx++] = 0x0000009c; + encrypt_last_ref_0[idx++] = 0x000000a4; + encrypt_last_ref_0[idx++] = 0x00000072; + encrypt_last_ref_0[idx++] = 0x000000c0; + encrypt_last_ref_0[idx++] = 0x000000b7; + encrypt_last_ref_0[idx++] = 0x000000fd; + encrypt_last_ref_0[idx++] = 0x00000093; + encrypt_last_ref_0[idx++] = 0x00000026; + encrypt_last_ref_0[idx++] = 0x00000036; + encrypt_last_ref_0[idx++] = 0x0000003f; + encrypt_last_ref_0[idx++] = 0x000000f7; + encrypt_last_ref_0[idx++] = 0x000000cc; + encrypt_last_ref_0[idx++] = 0x00000034; + encrypt_last_ref_0[idx++] = 0x000000a5; + encrypt_last_ref_0[idx++] = 0x000000e5; + encrypt_last_ref_0[idx++] = 0x000000f1; + encrypt_last_ref_0[idx++] = 0x00000071; + encrypt_last_ref_0[idx++] = 0x000000d8; + encrypt_last_ref_0[idx++] = 0x00000031; + encrypt_last_ref_0[idx++] = 0x00000015; + encrypt_last_ref_0[idx++] = 0x00000004; + encrypt_last_ref_0[idx++] = 0x000000c7; + encrypt_last_ref_0[idx++] = 0x00000023; + encrypt_last_ref_0[idx++] = 0x000000c3; + encrypt_last_ref_0[idx++] = 0x00000018; + encrypt_last_ref_0[idx++] = 0x00000096; + encrypt_last_ref_0[idx++] = 0x00000005; + encrypt_last_ref_0[idx++] = 0x0000009a; + encrypt_last_ref_0[idx++] = 0x00000007; + encrypt_last_ref_0[idx++] = 0x00000012; + encrypt_last_ref_0[idx++] = 0x00000080; + encrypt_last_ref_0[idx++] = 0x000000e2; + encrypt_last_ref_0[idx++] = 0x000000eb; + encrypt_last_ref_0[idx++] = 0x00000027; + encrypt_last_ref_0[idx++] = 0x000000b2; + encrypt_last_ref_0[idx++] = 0x00000075; + encrypt_last_ref_0[idx++] = 0x00000009; + encrypt_last_ref_0[idx++] = 0x00000083; + encrypt_last_ref_0[idx++] = 0x0000002c; + encrypt_last_ref_0[idx++] = 0x0000001a; + encrypt_last_ref_0[idx++] = 0x0000001b; + encrypt_last_ref_0[idx++] = 0x0000006e; + encrypt_last_ref_0[idx++] = 0x0000005a; + encrypt_last_ref_0[idx++] = 0x000000a0; + encrypt_last_ref_0[idx++] = 0x00000052; + encrypt_last_ref_0[idx++] = 0x0000003b; + encrypt_last_ref_0[idx++] = 0x000000d6; + encrypt_last_ref_0[idx++] = 0x000000b3; + encrypt_last_ref_0[idx++] = 0x00000029; + encrypt_last_ref_0[idx++] = 0x000000e3; + encrypt_last_ref_0[idx++] = 0x0000002f; + encrypt_last_ref_0[idx++] = 0x00000084; + encrypt_last_ref_0[idx++] = 0x00000053; + encrypt_last_ref_0[idx++] = 0x000000d1; + encrypt_last_ref_0[idx++] = 0x00000000; + encrypt_last_ref_0[idx++] = 0x000000ed; + encrypt_last_ref_0[idx++] = 0x00000020; + encrypt_last_ref_0[idx++] = 0x000000fc; + encrypt_last_ref_0[idx++] = 0x000000b1; + encrypt_last_ref_0[idx++] = 0x0000005b; + encrypt_last_ref_0[idx++] = 0x0000006a; + encrypt_last_ref_0[idx++] = 0x000000cb; + encrypt_last_ref_0[idx++] = 0x000000be; + encrypt_last_ref_0[idx++] = 0x00000039; + encrypt_last_ref_0[idx++] = 0x0000004a; + encrypt_last_ref_0[idx++] = 0x0000004c; + encrypt_last_ref_0[idx++] = 0x00000058; + encrypt_last_ref_0[idx++] = 0x000000cf; + encrypt_last_ref_0[idx++] = 0x000000d0; + encrypt_last_ref_0[idx++] = 0x000000ef; + encrypt_last_ref_0[idx++] = 0x000000aa; + encrypt_last_ref_0[idx++] = 0x000000fb; + encrypt_last_ref_0[idx++] = 0x00000043; + encrypt_last_ref_0[idx++] = 0x0000004d; + encrypt_last_ref_0[idx++] = 0x00000033; + encrypt_last_ref_0[idx++] = 0x00000085; + encrypt_last_ref_0[idx++] = 0x00000045; + encrypt_last_ref_0[idx++] = 0x000000f9; + encrypt_last_ref_0[idx++] = 0x00000002; + encrypt_last_ref_0[idx++] = 0x0000007f; + encrypt_last_ref_0[idx++] = 0x00000050; + encrypt_last_ref_0[idx++] = 0x0000003c; + encrypt_last_ref_0[idx++] = 0x0000009f; + encrypt_last_ref_0[idx++] = 0x000000a8; + encrypt_last_ref_0[idx++] = 0x00000051; + encrypt_last_ref_0[idx++] = 0x000000a3; + encrypt_last_ref_0[idx++] = 0x00000040; + encrypt_last_ref_0[idx++] = 0x0000008f; + encrypt_last_ref_0[idx++] = 0x00000092; + encrypt_last_ref_0[idx++] = 0x0000009d; + encrypt_last_ref_0[idx++] = 0x00000038; + encrypt_last_ref_0[idx++] = 0x000000f5; + encrypt_last_ref_0[idx++] = 0x000000bc; + encrypt_last_ref_0[idx++] = 0x000000b6; + encrypt_last_ref_0[idx++] = 0x000000da; + encrypt_last_ref_0[idx++] = 0x00000021; + encrypt_last_ref_0[idx++] = 0x00000010; + encrypt_last_ref_0[idx++] = 0x000000ff; + encrypt_last_ref_0[idx++] = 0x000000f3; + encrypt_last_ref_0[idx++] = 0x000000d2; + encrypt_last_ref_0[idx++] = 0x000000cd; + encrypt_last_ref_0[idx++] = 0x0000000c; + encrypt_last_ref_0[idx++] = 0x00000013; + encrypt_last_ref_0[idx++] = 0x000000ec; + encrypt_last_ref_0[idx++] = 0x0000005f; + encrypt_last_ref_0[idx++] = 0x00000097; + encrypt_last_ref_0[idx++] = 0x00000044; + encrypt_last_ref_0[idx++] = 0x00000017; + encrypt_last_ref_0[idx++] = 0x000000c4; + encrypt_last_ref_0[idx++] = 0x000000a7; + encrypt_last_ref_0[idx++] = 0x0000007e; + encrypt_last_ref_0[idx++] = 0x0000003d; + encrypt_last_ref_0[idx++] = 0x00000064; + encrypt_last_ref_0[idx++] = 0x0000005d; + encrypt_last_ref_0[idx++] = 0x00000019; + encrypt_last_ref_0[idx++] = 0x00000073; + encrypt_last_ref_0[idx++] = 0x00000060; + encrypt_last_ref_0[idx++] = 0x00000081; + encrypt_last_ref_0[idx++] = 0x0000004f; + encrypt_last_ref_0[idx++] = 0x000000dc; + encrypt_last_ref_0[idx++] = 0x00000022; + encrypt_last_ref_0[idx++] = 0x0000002a; + encrypt_last_ref_0[idx++] = 0x00000090; + encrypt_last_ref_0[idx++] = 0x00000088; + encrypt_last_ref_0[idx++] = 0x00000046; + encrypt_last_ref_0[idx++] = 0x000000ee; + encrypt_last_ref_0[idx++] = 0x000000b8; + encrypt_last_ref_0[idx++] = 0x00000014; + encrypt_last_ref_0[idx++] = 0x000000de; + encrypt_last_ref_0[idx++] = 0x0000005e; + encrypt_last_ref_0[idx++] = 0x0000000b; + encrypt_last_ref_0[idx++] = 0x000000db; + encrypt_last_ref_0[idx++] = 0x000000e0; + encrypt_last_ref_0[idx++] = 0x00000032; + encrypt_last_ref_0[idx++] = 0x0000003a; + encrypt_last_ref_0[idx++] = 0x0000000a; + encrypt_last_ref_0[idx++] = 0x00000049; + encrypt_last_ref_0[idx++] = 0x00000006; + encrypt_last_ref_0[idx++] = 0x00000024; + encrypt_last_ref_0[idx++] = 0x0000005c; + encrypt_last_ref_0[idx++] = 0x000000c2; + encrypt_last_ref_0[idx++] = 0x000000d3; + encrypt_last_ref_0[idx++] = 0x000000ac; + encrypt_last_ref_0[idx++] = 0x00000062; + encrypt_last_ref_0[idx++] = 0x00000091; + encrypt_last_ref_0[idx++] = 0x00000095; + encrypt_last_ref_0[idx++] = 0x000000e4; + encrypt_last_ref_0[idx++] = 0x00000079; + encrypt_last_ref_0[idx++] = 0x000000e7; + encrypt_last_ref_0[idx++] = 0x000000c8; + encrypt_last_ref_0[idx++] = 0x00000037; + encrypt_last_ref_0[idx++] = 0x0000006d; + encrypt_last_ref_0[idx++] = 0x0000008d; + encrypt_last_ref_0[idx++] = 0x000000d5; + encrypt_last_ref_0[idx++] = 0x0000004e; + encrypt_last_ref_0[idx++] = 0x000000a9; + encrypt_last_ref_0[idx++] = 0x0000006c; + encrypt_last_ref_0[idx++] = 0x00000056; + encrypt_last_ref_0[idx++] = 0x000000f4; + encrypt_last_ref_0[idx++] = 0x000000ea; + encrypt_last_ref_0[idx++] = 0x00000065; + encrypt_last_ref_0[idx++] = 0x0000007a; + encrypt_last_ref_0[idx++] = 0x000000ae; + encrypt_last_ref_0[idx++] = 0x00000008; + encrypt_last_ref_0[idx++] = 0x000000ba; + encrypt_last_ref_0[idx++] = 0x00000078; + encrypt_last_ref_0[idx++] = 0x00000025; + encrypt_last_ref_0[idx++] = 0x0000002e; + encrypt_last_ref_0[idx++] = 0x0000001c; + encrypt_last_ref_0[idx++] = 0x000000a6; + encrypt_last_ref_0[idx++] = 0x000000b4; + encrypt_last_ref_0[idx++] = 0x000000c6; + encrypt_last_ref_0[idx++] = 0x000000e8; + encrypt_last_ref_0[idx++] = 0x000000dd; + encrypt_last_ref_0[idx++] = 0x00000074; + encrypt_last_ref_0[idx++] = 0x0000001f; + encrypt_last_ref_0[idx++] = 0x0000004b; + encrypt_last_ref_0[idx++] = 0x000000bd; + encrypt_last_ref_0[idx++] = 0x0000008b; + encrypt_last_ref_0[idx++] = 0x0000008a; + encrypt_last_ref_0[idx++] = 0x00000070; + encrypt_last_ref_0[idx++] = 0x0000003e; + encrypt_last_ref_0[idx++] = 0x000000b5; + encrypt_last_ref_0[idx++] = 0x00000066; + encrypt_last_ref_0[idx++] = 0x00000048; + encrypt_last_ref_0[idx++] = 0x00000003; + encrypt_last_ref_0[idx++] = 0x000000f6; + encrypt_last_ref_0[idx++] = 0x0000000e; + encrypt_last_ref_0[idx++] = 0x00000061; + encrypt_last_ref_0[idx++] = 0x00000035; + encrypt_last_ref_0[idx++] = 0x00000057; + encrypt_last_ref_0[idx++] = 0x000000b9; + encrypt_last_ref_0[idx++] = 0x00000086; + encrypt_last_ref_0[idx++] = 0x000000c1; + encrypt_last_ref_0[idx++] = 0x0000001d; + encrypt_last_ref_0[idx++] = 0x0000009e; + encrypt_last_ref_0[idx++] = 0x000000e1; + encrypt_last_ref_0[idx++] = 0x000000f8; + encrypt_last_ref_0[idx++] = 0x00000098; + encrypt_last_ref_0[idx++] = 0x00000011; + encrypt_last_ref_0[idx++] = 0x00000069; + encrypt_last_ref_0[idx++] = 0x000000d9; + encrypt_last_ref_0[idx++] = 0x0000008e; + encrypt_last_ref_0[idx++] = 0x00000094; + encrypt_last_ref_0[idx++] = 0x0000009b; + encrypt_last_ref_0[idx++] = 0x0000001e; + encrypt_last_ref_0[idx++] = 0x00000087; + encrypt_last_ref_0[idx++] = 0x000000e9; + encrypt_last_ref_0[idx++] = 0x000000ce; + encrypt_last_ref_0[idx++] = 0x00000055; + encrypt_last_ref_0[idx++] = 0x00000028; + encrypt_last_ref_0[idx++] = 0x000000df; + encrypt_last_ref_0[idx++] = 0x0000008c; + encrypt_last_ref_0[idx++] = 0x000000a1; + encrypt_last_ref_0[idx++] = 0x00000089; + encrypt_last_ref_0[idx++] = 0x0000000d; + encrypt_last_ref_0[idx++] = 0x000000bf; + encrypt_last_ref_0[idx++] = 0x000000e6; + encrypt_last_ref_0[idx++] = 0x00000042; + encrypt_last_ref_0[idx++] = 0x00000068; + encrypt_last_ref_0[idx++] = 0x00000041; + encrypt_last_ref_0[idx++] = 0x00000099; + encrypt_last_ref_0[idx++] = 0x0000002d; + encrypt_last_ref_0[idx++] = 0x0000000f; + encrypt_last_ref_0[idx++] = 0x000000b0; + encrypt_last_ref_0[idx++] = 0x00000054; + encrypt_last_ref_0[idx++] = 0x000000bb; + encrypt_last_ref_0[idx++] = 0x00000016; + + idx = 0; + encrypt_last_ref_1[idx++] = 0x00006300; + encrypt_last_ref_1[idx++] = 0x00007c00; + encrypt_last_ref_1[idx++] = 0x00007700; + encrypt_last_ref_1[idx++] = 0x00007b00; + encrypt_last_ref_1[idx++] = 0x0000f200; + encrypt_last_ref_1[idx++] = 0x00006b00; + encrypt_last_ref_1[idx++] = 0x00006f00; + encrypt_last_ref_1[idx++] = 0x0000c500; + encrypt_last_ref_1[idx++] = 0x00003000; + encrypt_last_ref_1[idx++] = 0x00000100; + encrypt_last_ref_1[idx++] = 0x00006700; + encrypt_last_ref_1[idx++] = 0x00002b00; + encrypt_last_ref_1[idx++] = 0x0000fe00; + encrypt_last_ref_1[idx++] = 0x0000d700; + encrypt_last_ref_1[idx++] = 0x0000ab00; + encrypt_last_ref_1[idx++] = 0x00007600; + encrypt_last_ref_1[idx++] = 0x0000ca00; + encrypt_last_ref_1[idx++] = 0x00008200; + encrypt_last_ref_1[idx++] = 0x0000c900; + encrypt_last_ref_1[idx++] = 0x00007d00; + encrypt_last_ref_1[idx++] = 0x0000fa00; + encrypt_last_ref_1[idx++] = 0x00005900; + encrypt_last_ref_1[idx++] = 0x00004700; + encrypt_last_ref_1[idx++] = 0x0000f000; + encrypt_last_ref_1[idx++] = 0x0000ad00; + encrypt_last_ref_1[idx++] = 0x0000d400; + encrypt_last_ref_1[idx++] = 0x0000a200; + encrypt_last_ref_1[idx++] = 0x0000af00; + encrypt_last_ref_1[idx++] = 0x00009c00; + encrypt_last_ref_1[idx++] = 0x0000a400; + encrypt_last_ref_1[idx++] = 0x00007200; + encrypt_last_ref_1[idx++] = 0x0000c000; + encrypt_last_ref_1[idx++] = 0x0000b700; + encrypt_last_ref_1[idx++] = 0x0000fd00; + encrypt_last_ref_1[idx++] = 0x00009300; + encrypt_last_ref_1[idx++] = 0x00002600; + encrypt_last_ref_1[idx++] = 0x00003600; + encrypt_last_ref_1[idx++] = 0x00003f00; + encrypt_last_ref_1[idx++] = 0x0000f700; + encrypt_last_ref_1[idx++] = 0x0000cc00; + encrypt_last_ref_1[idx++] = 0x00003400; + encrypt_last_ref_1[idx++] = 0x0000a500; + encrypt_last_ref_1[idx++] = 0x0000e500; + encrypt_last_ref_1[idx++] = 0x0000f100; + encrypt_last_ref_1[idx++] = 0x00007100; + encrypt_last_ref_1[idx++] = 0x0000d800; + encrypt_last_ref_1[idx++] = 0x00003100; + encrypt_last_ref_1[idx++] = 0x00001500; + encrypt_last_ref_1[idx++] = 0x00000400; + encrypt_last_ref_1[idx++] = 0x0000c700; + encrypt_last_ref_1[idx++] = 0x00002300; + encrypt_last_ref_1[idx++] = 0x0000c300; + encrypt_last_ref_1[idx++] = 0x00001800; + encrypt_last_ref_1[idx++] = 0x00009600; + encrypt_last_ref_1[idx++] = 0x00000500; + encrypt_last_ref_1[idx++] = 0x00009a00; + encrypt_last_ref_1[idx++] = 0x00000700; + encrypt_last_ref_1[idx++] = 0x00001200; + encrypt_last_ref_1[idx++] = 0x00008000; + encrypt_last_ref_1[idx++] = 0x0000e200; + encrypt_last_ref_1[idx++] = 0x0000eb00; + encrypt_last_ref_1[idx++] = 0x00002700; + encrypt_last_ref_1[idx++] = 0x0000b200; + encrypt_last_ref_1[idx++] = 0x00007500; + encrypt_last_ref_1[idx++] = 0x00000900; + encrypt_last_ref_1[idx++] = 0x00008300; + encrypt_last_ref_1[idx++] = 0x00002c00; + encrypt_last_ref_1[idx++] = 0x00001a00; + encrypt_last_ref_1[idx++] = 0x00001b00; + encrypt_last_ref_1[idx++] = 0x00006e00; + encrypt_last_ref_1[idx++] = 0x00005a00; + encrypt_last_ref_1[idx++] = 0x0000a000; + encrypt_last_ref_1[idx++] = 0x00005200; + encrypt_last_ref_1[idx++] = 0x00003b00; + encrypt_last_ref_1[idx++] = 0x0000d600; + encrypt_last_ref_1[idx++] = 0x0000b300; + encrypt_last_ref_1[idx++] = 0x00002900; + encrypt_last_ref_1[idx++] = 0x0000e300; + encrypt_last_ref_1[idx++] = 0x00002f00; + encrypt_last_ref_1[idx++] = 0x00008400; + encrypt_last_ref_1[idx++] = 0x00005300; + encrypt_last_ref_1[idx++] = 0x0000d100; + encrypt_last_ref_1[idx++] = 0x00000000; + encrypt_last_ref_1[idx++] = 0x0000ed00; + encrypt_last_ref_1[idx++] = 0x00002000; + encrypt_last_ref_1[idx++] = 0x0000fc00; + encrypt_last_ref_1[idx++] = 0x0000b100; + encrypt_last_ref_1[idx++] = 0x00005b00; + encrypt_last_ref_1[idx++] = 0x00006a00; + encrypt_last_ref_1[idx++] = 0x0000cb00; + encrypt_last_ref_1[idx++] = 0x0000be00; + encrypt_last_ref_1[idx++] = 0x00003900; + encrypt_last_ref_1[idx++] = 0x00004a00; + encrypt_last_ref_1[idx++] = 0x00004c00; + encrypt_last_ref_1[idx++] = 0x00005800; + encrypt_last_ref_1[idx++] = 0x0000cf00; + encrypt_last_ref_1[idx++] = 0x0000d000; + encrypt_last_ref_1[idx++] = 0x0000ef00; + encrypt_last_ref_1[idx++] = 0x0000aa00; + encrypt_last_ref_1[idx++] = 0x0000fb00; + encrypt_last_ref_1[idx++] = 0x00004300; + encrypt_last_ref_1[idx++] = 0x00004d00; + encrypt_last_ref_1[idx++] = 0x00003300; + encrypt_last_ref_1[idx++] = 0x00008500; + encrypt_last_ref_1[idx++] = 0x00004500; + encrypt_last_ref_1[idx++] = 0x0000f900; + encrypt_last_ref_1[idx++] = 0x00000200; + encrypt_last_ref_1[idx++] = 0x00007f00; + encrypt_last_ref_1[idx++] = 0x00005000; + encrypt_last_ref_1[idx++] = 0x00003c00; + encrypt_last_ref_1[idx++] = 0x00009f00; + encrypt_last_ref_1[idx++] = 0x0000a800; + encrypt_last_ref_1[idx++] = 0x00005100; + encrypt_last_ref_1[idx++] = 0x0000a300; + encrypt_last_ref_1[idx++] = 0x00004000; + encrypt_last_ref_1[idx++] = 0x00008f00; + encrypt_last_ref_1[idx++] = 0x00009200; + encrypt_last_ref_1[idx++] = 0x00009d00; + encrypt_last_ref_1[idx++] = 0x00003800; + encrypt_last_ref_1[idx++] = 0x0000f500; + encrypt_last_ref_1[idx++] = 0x0000bc00; + encrypt_last_ref_1[idx++] = 0x0000b600; + encrypt_last_ref_1[idx++] = 0x0000da00; + encrypt_last_ref_1[idx++] = 0x00002100; + encrypt_last_ref_1[idx++] = 0x00001000; + encrypt_last_ref_1[idx++] = 0x0000ff00; + encrypt_last_ref_1[idx++] = 0x0000f300; + encrypt_last_ref_1[idx++] = 0x0000d200; + encrypt_last_ref_1[idx++] = 0x0000cd00; + encrypt_last_ref_1[idx++] = 0x00000c00; + encrypt_last_ref_1[idx++] = 0x00001300; + encrypt_last_ref_1[idx++] = 0x0000ec00; + encrypt_last_ref_1[idx++] = 0x00005f00; + encrypt_last_ref_1[idx++] = 0x00009700; + encrypt_last_ref_1[idx++] = 0x00004400; + encrypt_last_ref_1[idx++] = 0x00001700; + encrypt_last_ref_1[idx++] = 0x0000c400; + encrypt_last_ref_1[idx++] = 0x0000a700; + encrypt_last_ref_1[idx++] = 0x00007e00; + encrypt_last_ref_1[idx++] = 0x00003d00; + encrypt_last_ref_1[idx++] = 0x00006400; + encrypt_last_ref_1[idx++] = 0x00005d00; + encrypt_last_ref_1[idx++] = 0x00001900; + encrypt_last_ref_1[idx++] = 0x00007300; + encrypt_last_ref_1[idx++] = 0x00006000; + encrypt_last_ref_1[idx++] = 0x00008100; + encrypt_last_ref_1[idx++] = 0x00004f00; + encrypt_last_ref_1[idx++] = 0x0000dc00; + encrypt_last_ref_1[idx++] = 0x00002200; + encrypt_last_ref_1[idx++] = 0x00002a00; + encrypt_last_ref_1[idx++] = 0x00009000; + encrypt_last_ref_1[idx++] = 0x00008800; + encrypt_last_ref_1[idx++] = 0x00004600; + encrypt_last_ref_1[idx++] = 0x0000ee00; + encrypt_last_ref_1[idx++] = 0x0000b800; + encrypt_last_ref_1[idx++] = 0x00001400; + encrypt_last_ref_1[idx++] = 0x0000de00; + encrypt_last_ref_1[idx++] = 0x00005e00; + encrypt_last_ref_1[idx++] = 0x00000b00; + encrypt_last_ref_1[idx++] = 0x0000db00; + encrypt_last_ref_1[idx++] = 0x0000e000; + encrypt_last_ref_1[idx++] = 0x00003200; + encrypt_last_ref_1[idx++] = 0x00003a00; + encrypt_last_ref_1[idx++] = 0x00000a00; + encrypt_last_ref_1[idx++] = 0x00004900; + encrypt_last_ref_1[idx++] = 0x00000600; + encrypt_last_ref_1[idx++] = 0x00002400; + encrypt_last_ref_1[idx++] = 0x00005c00; + encrypt_last_ref_1[idx++] = 0x0000c200; + encrypt_last_ref_1[idx++] = 0x0000d300; + encrypt_last_ref_1[idx++] = 0x0000ac00; + encrypt_last_ref_1[idx++] = 0x00006200; + encrypt_last_ref_1[idx++] = 0x00009100; + encrypt_last_ref_1[idx++] = 0x00009500; + encrypt_last_ref_1[idx++] = 0x0000e400; + encrypt_last_ref_1[idx++] = 0x00007900; + encrypt_last_ref_1[idx++] = 0x0000e700; + encrypt_last_ref_1[idx++] = 0x0000c800; + encrypt_last_ref_1[idx++] = 0x00003700; + encrypt_last_ref_1[idx++] = 0x00006d00; + encrypt_last_ref_1[idx++] = 0x00008d00; + encrypt_last_ref_1[idx++] = 0x0000d500; + encrypt_last_ref_1[idx++] = 0x00004e00; + encrypt_last_ref_1[idx++] = 0x0000a900; + encrypt_last_ref_1[idx++] = 0x00006c00; + encrypt_last_ref_1[idx++] = 0x00005600; + encrypt_last_ref_1[idx++] = 0x0000f400; + encrypt_last_ref_1[idx++] = 0x0000ea00; + encrypt_last_ref_1[idx++] = 0x00006500; + encrypt_last_ref_1[idx++] = 0x00007a00; + encrypt_last_ref_1[idx++] = 0x0000ae00; + encrypt_last_ref_1[idx++] = 0x00000800; + encrypt_last_ref_1[idx++] = 0x0000ba00; + encrypt_last_ref_1[idx++] = 0x00007800; + encrypt_last_ref_1[idx++] = 0x00002500; + encrypt_last_ref_1[idx++] = 0x00002e00; + encrypt_last_ref_1[idx++] = 0x00001c00; + encrypt_last_ref_1[idx++] = 0x0000a600; + encrypt_last_ref_1[idx++] = 0x0000b400; + encrypt_last_ref_1[idx++] = 0x0000c600; + encrypt_last_ref_1[idx++] = 0x0000e800; + encrypt_last_ref_1[idx++] = 0x0000dd00; + encrypt_last_ref_1[idx++] = 0x00007400; + encrypt_last_ref_1[idx++] = 0x00001f00; + encrypt_last_ref_1[idx++] = 0x00004b00; + encrypt_last_ref_1[idx++] = 0x0000bd00; + encrypt_last_ref_1[idx++] = 0x00008b00; + encrypt_last_ref_1[idx++] = 0x00008a00; + encrypt_last_ref_1[idx++] = 0x00007000; + encrypt_last_ref_1[idx++] = 0x00003e00; + encrypt_last_ref_1[idx++] = 0x0000b500; + encrypt_last_ref_1[idx++] = 0x00006600; + encrypt_last_ref_1[idx++] = 0x00004800; + encrypt_last_ref_1[idx++] = 0x00000300; + encrypt_last_ref_1[idx++] = 0x0000f600; + encrypt_last_ref_1[idx++] = 0x00000e00; + encrypt_last_ref_1[idx++] = 0x00006100; + encrypt_last_ref_1[idx++] = 0x00003500; + encrypt_last_ref_1[idx++] = 0x00005700; + encrypt_last_ref_1[idx++] = 0x0000b900; + encrypt_last_ref_1[idx++] = 0x00008600; + encrypt_last_ref_1[idx++] = 0x0000c100; + encrypt_last_ref_1[idx++] = 0x00001d00; + encrypt_last_ref_1[idx++] = 0x00009e00; + encrypt_last_ref_1[idx++] = 0x0000e100; + encrypt_last_ref_1[idx++] = 0x0000f800; + encrypt_last_ref_1[idx++] = 0x00009800; + encrypt_last_ref_1[idx++] = 0x00001100; + encrypt_last_ref_1[idx++] = 0x00006900; + encrypt_last_ref_1[idx++] = 0x0000d900; + encrypt_last_ref_1[idx++] = 0x00008e00; + encrypt_last_ref_1[idx++] = 0x00009400; + encrypt_last_ref_1[idx++] = 0x00009b00; + encrypt_last_ref_1[idx++] = 0x00001e00; + encrypt_last_ref_1[idx++] = 0x00008700; + encrypt_last_ref_1[idx++] = 0x0000e900; + encrypt_last_ref_1[idx++] = 0x0000ce00; + encrypt_last_ref_1[idx++] = 0x00005500; + encrypt_last_ref_1[idx++] = 0x00002800; + encrypt_last_ref_1[idx++] = 0x0000df00; + encrypt_last_ref_1[idx++] = 0x00008c00; + encrypt_last_ref_1[idx++] = 0x0000a100; + encrypt_last_ref_1[idx++] = 0x00008900; + encrypt_last_ref_1[idx++] = 0x00000d00; + encrypt_last_ref_1[idx++] = 0x0000bf00; + encrypt_last_ref_1[idx++] = 0x0000e600; + encrypt_last_ref_1[idx++] = 0x00004200; + encrypt_last_ref_1[idx++] = 0x00006800; + encrypt_last_ref_1[idx++] = 0x00004100; + encrypt_last_ref_1[idx++] = 0x00009900; + encrypt_last_ref_1[idx++] = 0x00002d00; + encrypt_last_ref_1[idx++] = 0x00000f00; + encrypt_last_ref_1[idx++] = 0x0000b000; + encrypt_last_ref_1[idx++] = 0x00005400; + encrypt_last_ref_1[idx++] = 0x0000bb00; + encrypt_last_ref_1[idx++] = 0x00001600; + + idx = 0; + encrypt_last_ref_2[idx++] = 0x00630000; + encrypt_last_ref_2[idx++] = 0x007c0000; + encrypt_last_ref_2[idx++] = 0x00770000; + encrypt_last_ref_2[idx++] = 0x007b0000; + encrypt_last_ref_2[idx++] = 0x00f20000; + encrypt_last_ref_2[idx++] = 0x006b0000; + encrypt_last_ref_2[idx++] = 0x006f0000; + encrypt_last_ref_2[idx++] = 0x00c50000; + encrypt_last_ref_2[idx++] = 0x00300000; + encrypt_last_ref_2[idx++] = 0x00010000; + encrypt_last_ref_2[idx++] = 0x00670000; + encrypt_last_ref_2[idx++] = 0x002b0000; + encrypt_last_ref_2[idx++] = 0x00fe0000; + encrypt_last_ref_2[idx++] = 0x00d70000; + encrypt_last_ref_2[idx++] = 0x00ab0000; + encrypt_last_ref_2[idx++] = 0x00760000; + encrypt_last_ref_2[idx++] = 0x00ca0000; + encrypt_last_ref_2[idx++] = 0x00820000; + encrypt_last_ref_2[idx++] = 0x00c90000; + encrypt_last_ref_2[idx++] = 0x007d0000; + encrypt_last_ref_2[idx++] = 0x00fa0000; + encrypt_last_ref_2[idx++] = 0x00590000; + encrypt_last_ref_2[idx++] = 0x00470000; + encrypt_last_ref_2[idx++] = 0x00f00000; + encrypt_last_ref_2[idx++] = 0x00ad0000; + encrypt_last_ref_2[idx++] = 0x00d40000; + encrypt_last_ref_2[idx++] = 0x00a20000; + encrypt_last_ref_2[idx++] = 0x00af0000; + encrypt_last_ref_2[idx++] = 0x009c0000; + encrypt_last_ref_2[idx++] = 0x00a40000; + encrypt_last_ref_2[idx++] = 0x00720000; + encrypt_last_ref_2[idx++] = 0x00c00000; + encrypt_last_ref_2[idx++] = 0x00b70000; + encrypt_last_ref_2[idx++] = 0x00fd0000; + encrypt_last_ref_2[idx++] = 0x00930000; + encrypt_last_ref_2[idx++] = 0x00260000; + encrypt_last_ref_2[idx++] = 0x00360000; + encrypt_last_ref_2[idx++] = 0x003f0000; + encrypt_last_ref_2[idx++] = 0x00f70000; + encrypt_last_ref_2[idx++] = 0x00cc0000; + encrypt_last_ref_2[idx++] = 0x00340000; + encrypt_last_ref_2[idx++] = 0x00a50000; + encrypt_last_ref_2[idx++] = 0x00e50000; + encrypt_last_ref_2[idx++] = 0x00f10000; + encrypt_last_ref_2[idx++] = 0x00710000; + encrypt_last_ref_2[idx++] = 0x00d80000; + encrypt_last_ref_2[idx++] = 0x00310000; + encrypt_last_ref_2[idx++] = 0x00150000; + encrypt_last_ref_2[idx++] = 0x00040000; + encrypt_last_ref_2[idx++] = 0x00c70000; + encrypt_last_ref_2[idx++] = 0x00230000; + encrypt_last_ref_2[idx++] = 0x00c30000; + encrypt_last_ref_2[idx++] = 0x00180000; + encrypt_last_ref_2[idx++] = 0x00960000; + encrypt_last_ref_2[idx++] = 0x00050000; + encrypt_last_ref_2[idx++] = 0x009a0000; + encrypt_last_ref_2[idx++] = 0x00070000; + encrypt_last_ref_2[idx++] = 0x00120000; + encrypt_last_ref_2[idx++] = 0x00800000; + encrypt_last_ref_2[idx++] = 0x00e20000; + encrypt_last_ref_2[idx++] = 0x00eb0000; + encrypt_last_ref_2[idx++] = 0x00270000; + encrypt_last_ref_2[idx++] = 0x00b20000; + encrypt_last_ref_2[idx++] = 0x00750000; + encrypt_last_ref_2[idx++] = 0x00090000; + encrypt_last_ref_2[idx++] = 0x00830000; + encrypt_last_ref_2[idx++] = 0x002c0000; + encrypt_last_ref_2[idx++] = 0x001a0000; + encrypt_last_ref_2[idx++] = 0x001b0000; + encrypt_last_ref_2[idx++] = 0x006e0000; + encrypt_last_ref_2[idx++] = 0x005a0000; + encrypt_last_ref_2[idx++] = 0x00a00000; + encrypt_last_ref_2[idx++] = 0x00520000; + encrypt_last_ref_2[idx++] = 0x003b0000; + encrypt_last_ref_2[idx++] = 0x00d60000; + encrypt_last_ref_2[idx++] = 0x00b30000; + encrypt_last_ref_2[idx++] = 0x00290000; + encrypt_last_ref_2[idx++] = 0x00e30000; + encrypt_last_ref_2[idx++] = 0x002f0000; + encrypt_last_ref_2[idx++] = 0x00840000; + encrypt_last_ref_2[idx++] = 0x00530000; + encrypt_last_ref_2[idx++] = 0x00d10000; + encrypt_last_ref_2[idx++] = 0x00000000; + encrypt_last_ref_2[idx++] = 0x00ed0000; + encrypt_last_ref_2[idx++] = 0x00200000; + encrypt_last_ref_2[idx++] = 0x00fc0000; + encrypt_last_ref_2[idx++] = 0x00b10000; + encrypt_last_ref_2[idx++] = 0x005b0000; + encrypt_last_ref_2[idx++] = 0x006a0000; + encrypt_last_ref_2[idx++] = 0x00cb0000; + encrypt_last_ref_2[idx++] = 0x00be0000; + encrypt_last_ref_2[idx++] = 0x00390000; + encrypt_last_ref_2[idx++] = 0x004a0000; + encrypt_last_ref_2[idx++] = 0x004c0000; + encrypt_last_ref_2[idx++] = 0x00580000; + encrypt_last_ref_2[idx++] = 0x00cf0000; + encrypt_last_ref_2[idx++] = 0x00d00000; + encrypt_last_ref_2[idx++] = 0x00ef0000; + encrypt_last_ref_2[idx++] = 0x00aa0000; + encrypt_last_ref_2[idx++] = 0x00fb0000; + encrypt_last_ref_2[idx++] = 0x00430000; + encrypt_last_ref_2[idx++] = 0x004d0000; + encrypt_last_ref_2[idx++] = 0x00330000; + encrypt_last_ref_2[idx++] = 0x00850000; + encrypt_last_ref_2[idx++] = 0x00450000; + encrypt_last_ref_2[idx++] = 0x00f90000; + encrypt_last_ref_2[idx++] = 0x00020000; + encrypt_last_ref_2[idx++] = 0x007f0000; + encrypt_last_ref_2[idx++] = 0x00500000; + encrypt_last_ref_2[idx++] = 0x003c0000; + encrypt_last_ref_2[idx++] = 0x009f0000; + encrypt_last_ref_2[idx++] = 0x00a80000; + encrypt_last_ref_2[idx++] = 0x00510000; + encrypt_last_ref_2[idx++] = 0x00a30000; + encrypt_last_ref_2[idx++] = 0x00400000; + encrypt_last_ref_2[idx++] = 0x008f0000; + encrypt_last_ref_2[idx++] = 0x00920000; + encrypt_last_ref_2[idx++] = 0x009d0000; + encrypt_last_ref_2[idx++] = 0x00380000; + encrypt_last_ref_2[idx++] = 0x00f50000; + encrypt_last_ref_2[idx++] = 0x00bc0000; + encrypt_last_ref_2[idx++] = 0x00b60000; + encrypt_last_ref_2[idx++] = 0x00da0000; + encrypt_last_ref_2[idx++] = 0x00210000; + encrypt_last_ref_2[idx++] = 0x00100000; + encrypt_last_ref_2[idx++] = 0x00ff0000; + encrypt_last_ref_2[idx++] = 0x00f30000; + encrypt_last_ref_2[idx++] = 0x00d20000; + encrypt_last_ref_2[idx++] = 0x00cd0000; + encrypt_last_ref_2[idx++] = 0x000c0000; + encrypt_last_ref_2[idx++] = 0x00130000; + encrypt_last_ref_2[idx++] = 0x00ec0000; + encrypt_last_ref_2[idx++] = 0x005f0000; + encrypt_last_ref_2[idx++] = 0x00970000; + encrypt_last_ref_2[idx++] = 0x00440000; + encrypt_last_ref_2[idx++] = 0x00170000; + encrypt_last_ref_2[idx++] = 0x00c40000; + encrypt_last_ref_2[idx++] = 0x00a70000; + encrypt_last_ref_2[idx++] = 0x007e0000; + encrypt_last_ref_2[idx++] = 0x003d0000; + encrypt_last_ref_2[idx++] = 0x00640000; + encrypt_last_ref_2[idx++] = 0x005d0000; + encrypt_last_ref_2[idx++] = 0x00190000; + encrypt_last_ref_2[idx++] = 0x00730000; + encrypt_last_ref_2[idx++] = 0x00600000; + encrypt_last_ref_2[idx++] = 0x00810000; + encrypt_last_ref_2[idx++] = 0x004f0000; + encrypt_last_ref_2[idx++] = 0x00dc0000; + encrypt_last_ref_2[idx++] = 0x00220000; + encrypt_last_ref_2[idx++] = 0x002a0000; + encrypt_last_ref_2[idx++] = 0x00900000; + encrypt_last_ref_2[idx++] = 0x00880000; + encrypt_last_ref_2[idx++] = 0x00460000; + encrypt_last_ref_2[idx++] = 0x00ee0000; + encrypt_last_ref_2[idx++] = 0x00b80000; + encrypt_last_ref_2[idx++] = 0x00140000; + encrypt_last_ref_2[idx++] = 0x00de0000; + encrypt_last_ref_2[idx++] = 0x005e0000; + encrypt_last_ref_2[idx++] = 0x000b0000; + encrypt_last_ref_2[idx++] = 0x00db0000; + encrypt_last_ref_2[idx++] = 0x00e00000; + encrypt_last_ref_2[idx++] = 0x00320000; + encrypt_last_ref_2[idx++] = 0x003a0000; + encrypt_last_ref_2[idx++] = 0x000a0000; + encrypt_last_ref_2[idx++] = 0x00490000; + encrypt_last_ref_2[idx++] = 0x00060000; + encrypt_last_ref_2[idx++] = 0x00240000; + encrypt_last_ref_2[idx++] = 0x005c0000; + encrypt_last_ref_2[idx++] = 0x00c20000; + encrypt_last_ref_2[idx++] = 0x00d30000; + encrypt_last_ref_2[idx++] = 0x00ac0000; + encrypt_last_ref_2[idx++] = 0x00620000; + encrypt_last_ref_2[idx++] = 0x00910000; + encrypt_last_ref_2[idx++] = 0x00950000; + encrypt_last_ref_2[idx++] = 0x00e40000; + encrypt_last_ref_2[idx++] = 0x00790000; + encrypt_last_ref_2[idx++] = 0x00e70000; + encrypt_last_ref_2[idx++] = 0x00c80000; + encrypt_last_ref_2[idx++] = 0x00370000; + encrypt_last_ref_2[idx++] = 0x006d0000; + encrypt_last_ref_2[idx++] = 0x008d0000; + encrypt_last_ref_2[idx++] = 0x00d50000; + encrypt_last_ref_2[idx++] = 0x004e0000; + encrypt_last_ref_2[idx++] = 0x00a90000; + encrypt_last_ref_2[idx++] = 0x006c0000; + encrypt_last_ref_2[idx++] = 0x00560000; + encrypt_last_ref_2[idx++] = 0x00f40000; + encrypt_last_ref_2[idx++] = 0x00ea0000; + encrypt_last_ref_2[idx++] = 0x00650000; + encrypt_last_ref_2[idx++] = 0x007a0000; + encrypt_last_ref_2[idx++] = 0x00ae0000; + encrypt_last_ref_2[idx++] = 0x00080000; + encrypt_last_ref_2[idx++] = 0x00ba0000; + encrypt_last_ref_2[idx++] = 0x00780000; + encrypt_last_ref_2[idx++] = 0x00250000; + encrypt_last_ref_2[idx++] = 0x002e0000; + encrypt_last_ref_2[idx++] = 0x001c0000; + encrypt_last_ref_2[idx++] = 0x00a60000; + encrypt_last_ref_2[idx++] = 0x00b40000; + encrypt_last_ref_2[idx++] = 0x00c60000; + encrypt_last_ref_2[idx++] = 0x00e80000; + encrypt_last_ref_2[idx++] = 0x00dd0000; + encrypt_last_ref_2[idx++] = 0x00740000; + encrypt_last_ref_2[idx++] = 0x001f0000; + encrypt_last_ref_2[idx++] = 0x004b0000; + encrypt_last_ref_2[idx++] = 0x00bd0000; + encrypt_last_ref_2[idx++] = 0x008b0000; + encrypt_last_ref_2[idx++] = 0x008a0000; + encrypt_last_ref_2[idx++] = 0x00700000; + encrypt_last_ref_2[idx++] = 0x003e0000; + encrypt_last_ref_2[idx++] = 0x00b50000; + encrypt_last_ref_2[idx++] = 0x00660000; + encrypt_last_ref_2[idx++] = 0x00480000; + encrypt_last_ref_2[idx++] = 0x00030000; + encrypt_last_ref_2[idx++] = 0x00f60000; + encrypt_last_ref_2[idx++] = 0x000e0000; + encrypt_last_ref_2[idx++] = 0x00610000; + encrypt_last_ref_2[idx++] = 0x00350000; + encrypt_last_ref_2[idx++] = 0x00570000; + encrypt_last_ref_2[idx++] = 0x00b90000; + encrypt_last_ref_2[idx++] = 0x00860000; + encrypt_last_ref_2[idx++] = 0x00c10000; + encrypt_last_ref_2[idx++] = 0x001d0000; + encrypt_last_ref_2[idx++] = 0x009e0000; + encrypt_last_ref_2[idx++] = 0x00e10000; + encrypt_last_ref_2[idx++] = 0x00f80000; + encrypt_last_ref_2[idx++] = 0x00980000; + encrypt_last_ref_2[idx++] = 0x00110000; + encrypt_last_ref_2[idx++] = 0x00690000; + encrypt_last_ref_2[idx++] = 0x00d90000; + encrypt_last_ref_2[idx++] = 0x008e0000; + encrypt_last_ref_2[idx++] = 0x00940000; + encrypt_last_ref_2[idx++] = 0x009b0000; + encrypt_last_ref_2[idx++] = 0x001e0000; + encrypt_last_ref_2[idx++] = 0x00870000; + encrypt_last_ref_2[idx++] = 0x00e90000; + encrypt_last_ref_2[idx++] = 0x00ce0000; + encrypt_last_ref_2[idx++] = 0x00550000; + encrypt_last_ref_2[idx++] = 0x00280000; + encrypt_last_ref_2[idx++] = 0x00df0000; + encrypt_last_ref_2[idx++] = 0x008c0000; + encrypt_last_ref_2[idx++] = 0x00a10000; + encrypt_last_ref_2[idx++] = 0x00890000; + encrypt_last_ref_2[idx++] = 0x000d0000; + encrypt_last_ref_2[idx++] = 0x00bf0000; + encrypt_last_ref_2[idx++] = 0x00e60000; + encrypt_last_ref_2[idx++] = 0x00420000; + encrypt_last_ref_2[idx++] = 0x00680000; + encrypt_last_ref_2[idx++] = 0x00410000; + encrypt_last_ref_2[idx++] = 0x00990000; + encrypt_last_ref_2[idx++] = 0x002d0000; + encrypt_last_ref_2[idx++] = 0x000f0000; + encrypt_last_ref_2[idx++] = 0x00b00000; + encrypt_last_ref_2[idx++] = 0x00540000; + encrypt_last_ref_2[idx++] = 0x00bb0000; + encrypt_last_ref_2[idx++] = 0x00160000; + + idx = 0; + encrypt_last_ref_3[idx++] = 0x63000000; + encrypt_last_ref_3[idx++] = 0x7c000000; + encrypt_last_ref_3[idx++] = 0x77000000; + encrypt_last_ref_3[idx++] = 0x7b000000; + encrypt_last_ref_3[idx++] = 0xf2000000; + encrypt_last_ref_3[idx++] = 0x6b000000; + encrypt_last_ref_3[idx++] = 0x6f000000; + encrypt_last_ref_3[idx++] = 0xc5000000; + encrypt_last_ref_3[idx++] = 0x30000000; + encrypt_last_ref_3[idx++] = 0x01000000; + encrypt_last_ref_3[idx++] = 0x67000000; + encrypt_last_ref_3[idx++] = 0x2b000000; + encrypt_last_ref_3[idx++] = 0xfe000000; + encrypt_last_ref_3[idx++] = 0xd7000000; + encrypt_last_ref_3[idx++] = 0xab000000; + encrypt_last_ref_3[idx++] = 0x76000000; + encrypt_last_ref_3[idx++] = 0xca000000; + encrypt_last_ref_3[idx++] = 0x82000000; + encrypt_last_ref_3[idx++] = 0xc9000000; + encrypt_last_ref_3[idx++] = 0x7d000000; + encrypt_last_ref_3[idx++] = 0xfa000000; + encrypt_last_ref_3[idx++] = 0x59000000; + encrypt_last_ref_3[idx++] = 0x47000000; + encrypt_last_ref_3[idx++] = 0xf0000000; + encrypt_last_ref_3[idx++] = 0xad000000; + encrypt_last_ref_3[idx++] = 0xd4000000; + encrypt_last_ref_3[idx++] = 0xa2000000; + encrypt_last_ref_3[idx++] = 0xaf000000; + encrypt_last_ref_3[idx++] = 0x9c000000; + encrypt_last_ref_3[idx++] = 0xa4000000; + encrypt_last_ref_3[idx++] = 0x72000000; + encrypt_last_ref_3[idx++] = 0xc0000000; + encrypt_last_ref_3[idx++] = 0xb7000000; + encrypt_last_ref_3[idx++] = 0xfd000000; + encrypt_last_ref_3[idx++] = 0x93000000; + encrypt_last_ref_3[idx++] = 0x26000000; + encrypt_last_ref_3[idx++] = 0x36000000; + encrypt_last_ref_3[idx++] = 0x3f000000; + encrypt_last_ref_3[idx++] = 0xf7000000; + encrypt_last_ref_3[idx++] = 0xcc000000; + encrypt_last_ref_3[idx++] = 0x34000000; + encrypt_last_ref_3[idx++] = 0xa5000000; + encrypt_last_ref_3[idx++] = 0xe5000000; + encrypt_last_ref_3[idx++] = 0xf1000000; + encrypt_last_ref_3[idx++] = 0x71000000; + encrypt_last_ref_3[idx++] = 0xd8000000; + encrypt_last_ref_3[idx++] = 0x31000000; + encrypt_last_ref_3[idx++] = 0x15000000; + encrypt_last_ref_3[idx++] = 0x04000000; + encrypt_last_ref_3[idx++] = 0xc7000000; + encrypt_last_ref_3[idx++] = 0x23000000; + encrypt_last_ref_3[idx++] = 0xc3000000; + encrypt_last_ref_3[idx++] = 0x18000000; + encrypt_last_ref_3[idx++] = 0x96000000; + encrypt_last_ref_3[idx++] = 0x05000000; + encrypt_last_ref_3[idx++] = 0x9a000000; + encrypt_last_ref_3[idx++] = 0x07000000; + encrypt_last_ref_3[idx++] = 0x12000000; + encrypt_last_ref_3[idx++] = 0x80000000; + encrypt_last_ref_3[idx++] = 0xe2000000; + encrypt_last_ref_3[idx++] = 0xeb000000; + encrypt_last_ref_3[idx++] = 0x27000000; + encrypt_last_ref_3[idx++] = 0xb2000000; + encrypt_last_ref_3[idx++] = 0x75000000; + encrypt_last_ref_3[idx++] = 0x09000000; + encrypt_last_ref_3[idx++] = 0x83000000; + encrypt_last_ref_3[idx++] = 0x2c000000; + encrypt_last_ref_3[idx++] = 0x1a000000; + encrypt_last_ref_3[idx++] = 0x1b000000; + encrypt_last_ref_3[idx++] = 0x6e000000; + encrypt_last_ref_3[idx++] = 0x5a000000; + encrypt_last_ref_3[idx++] = 0xa0000000; + encrypt_last_ref_3[idx++] = 0x52000000; + encrypt_last_ref_3[idx++] = 0x3b000000; + encrypt_last_ref_3[idx++] = 0xd6000000; + encrypt_last_ref_3[idx++] = 0xb3000000; + encrypt_last_ref_3[idx++] = 0x29000000; + encrypt_last_ref_3[idx++] = 0xe3000000; + encrypt_last_ref_3[idx++] = 0x2f000000; + encrypt_last_ref_3[idx++] = 0x84000000; + encrypt_last_ref_3[idx++] = 0x53000000; + encrypt_last_ref_3[idx++] = 0xd1000000; + encrypt_last_ref_3[idx++] = 0x00000000; + encrypt_last_ref_3[idx++] = 0xed000000; + encrypt_last_ref_3[idx++] = 0x20000000; + encrypt_last_ref_3[idx++] = 0xfc000000; + encrypt_last_ref_3[idx++] = 0xb1000000; + encrypt_last_ref_3[idx++] = 0x5b000000; + encrypt_last_ref_3[idx++] = 0x6a000000; + encrypt_last_ref_3[idx++] = 0xcb000000; + encrypt_last_ref_3[idx++] = 0xbe000000; + encrypt_last_ref_3[idx++] = 0x39000000; + encrypt_last_ref_3[idx++] = 0x4a000000; + encrypt_last_ref_3[idx++] = 0x4c000000; + encrypt_last_ref_3[idx++] = 0x58000000; + encrypt_last_ref_3[idx++] = 0xcf000000; + encrypt_last_ref_3[idx++] = 0xd0000000; + encrypt_last_ref_3[idx++] = 0xef000000; + encrypt_last_ref_3[idx++] = 0xaa000000; + encrypt_last_ref_3[idx++] = 0xfb000000; + encrypt_last_ref_3[idx++] = 0x43000000; + encrypt_last_ref_3[idx++] = 0x4d000000; + encrypt_last_ref_3[idx++] = 0x33000000; + encrypt_last_ref_3[idx++] = 0x85000000; + encrypt_last_ref_3[idx++] = 0x45000000; + encrypt_last_ref_3[idx++] = 0xf9000000; + encrypt_last_ref_3[idx++] = 0x02000000; + encrypt_last_ref_3[idx++] = 0x7f000000; + encrypt_last_ref_3[idx++] = 0x50000000; + encrypt_last_ref_3[idx++] = 0x3c000000; + encrypt_last_ref_3[idx++] = 0x9f000000; + encrypt_last_ref_3[idx++] = 0xa8000000; + encrypt_last_ref_3[idx++] = 0x51000000; + encrypt_last_ref_3[idx++] = 0xa3000000; + encrypt_last_ref_3[idx++] = 0x40000000; + encrypt_last_ref_3[idx++] = 0x8f000000; + encrypt_last_ref_3[idx++] = 0x92000000; + encrypt_last_ref_3[idx++] = 0x9d000000; + encrypt_last_ref_3[idx++] = 0x38000000; + encrypt_last_ref_3[idx++] = 0xf5000000; + encrypt_last_ref_3[idx++] = 0xbc000000; + encrypt_last_ref_3[idx++] = 0xb6000000; + encrypt_last_ref_3[idx++] = 0xda000000; + encrypt_last_ref_3[idx++] = 0x21000000; + encrypt_last_ref_3[idx++] = 0x10000000; + encrypt_last_ref_3[idx++] = 0xff000000; + encrypt_last_ref_3[idx++] = 0xf3000000; + encrypt_last_ref_3[idx++] = 0xd2000000; + encrypt_last_ref_3[idx++] = 0xcd000000; + encrypt_last_ref_3[idx++] = 0x0c000000; + encrypt_last_ref_3[idx++] = 0x13000000; + encrypt_last_ref_3[idx++] = 0xec000000; + encrypt_last_ref_3[idx++] = 0x5f000000; + encrypt_last_ref_3[idx++] = 0x97000000; + encrypt_last_ref_3[idx++] = 0x44000000; + encrypt_last_ref_3[idx++] = 0x17000000; + encrypt_last_ref_3[idx++] = 0xc4000000; + encrypt_last_ref_3[idx++] = 0xa7000000; + encrypt_last_ref_3[idx++] = 0x7e000000; + encrypt_last_ref_3[idx++] = 0x3d000000; + encrypt_last_ref_3[idx++] = 0x64000000; + encrypt_last_ref_3[idx++] = 0x5d000000; + encrypt_last_ref_3[idx++] = 0x19000000; + encrypt_last_ref_3[idx++] = 0x73000000; + encrypt_last_ref_3[idx++] = 0x60000000; + encrypt_last_ref_3[idx++] = 0x81000000; + encrypt_last_ref_3[idx++] = 0x4f000000; + encrypt_last_ref_3[idx++] = 0xdc000000; + encrypt_last_ref_3[idx++] = 0x22000000; + encrypt_last_ref_3[idx++] = 0x2a000000; + encrypt_last_ref_3[idx++] = 0x90000000; + encrypt_last_ref_3[idx++] = 0x88000000; + encrypt_last_ref_3[idx++] = 0x46000000; + encrypt_last_ref_3[idx++] = 0xee000000; + encrypt_last_ref_3[idx++] = 0xb8000000; + encrypt_last_ref_3[idx++] = 0x14000000; + encrypt_last_ref_3[idx++] = 0xde000000; + encrypt_last_ref_3[idx++] = 0x5e000000; + encrypt_last_ref_3[idx++] = 0x0b000000; + encrypt_last_ref_3[idx++] = 0xdb000000; + encrypt_last_ref_3[idx++] = 0xe0000000; + encrypt_last_ref_3[idx++] = 0x32000000; + encrypt_last_ref_3[idx++] = 0x3a000000; + encrypt_last_ref_3[idx++] = 0x0a000000; + encrypt_last_ref_3[idx++] = 0x49000000; + encrypt_last_ref_3[idx++] = 0x06000000; + encrypt_last_ref_3[idx++] = 0x24000000; + encrypt_last_ref_3[idx++] = 0x5c000000; + encrypt_last_ref_3[idx++] = 0xc2000000; + encrypt_last_ref_3[idx++] = 0xd3000000; + encrypt_last_ref_3[idx++] = 0xac000000; + encrypt_last_ref_3[idx++] = 0x62000000; + encrypt_last_ref_3[idx++] = 0x91000000; + encrypt_last_ref_3[idx++] = 0x95000000; + encrypt_last_ref_3[idx++] = 0xe4000000; + encrypt_last_ref_3[idx++] = 0x79000000; + encrypt_last_ref_3[idx++] = 0xe7000000; + encrypt_last_ref_3[idx++] = 0xc8000000; + encrypt_last_ref_3[idx++] = 0x37000000; + encrypt_last_ref_3[idx++] = 0x6d000000; + encrypt_last_ref_3[idx++] = 0x8d000000; + encrypt_last_ref_3[idx++] = 0xd5000000; + encrypt_last_ref_3[idx++] = 0x4e000000; + encrypt_last_ref_3[idx++] = 0xa9000000; + encrypt_last_ref_3[idx++] = 0x6c000000; + encrypt_last_ref_3[idx++] = 0x56000000; + encrypt_last_ref_3[idx++] = 0xf4000000; + encrypt_last_ref_3[idx++] = 0xea000000; + encrypt_last_ref_3[idx++] = 0x65000000; + encrypt_last_ref_3[idx++] = 0x7a000000; + encrypt_last_ref_3[idx++] = 0xae000000; + encrypt_last_ref_3[idx++] = 0x08000000; + encrypt_last_ref_3[idx++] = 0xba000000; + encrypt_last_ref_3[idx++] = 0x78000000; + encrypt_last_ref_3[idx++] = 0x25000000; + encrypt_last_ref_3[idx++] = 0x2e000000; + encrypt_last_ref_3[idx++] = 0x1c000000; + encrypt_last_ref_3[idx++] = 0xa6000000; + encrypt_last_ref_3[idx++] = 0xb4000000; + encrypt_last_ref_3[idx++] = 0xc6000000; + encrypt_last_ref_3[idx++] = 0xe8000000; + encrypt_last_ref_3[idx++] = 0xdd000000; + encrypt_last_ref_3[idx++] = 0x74000000; + encrypt_last_ref_3[idx++] = 0x1f000000; + encrypt_last_ref_3[idx++] = 0x4b000000; + encrypt_last_ref_3[idx++] = 0xbd000000; + encrypt_last_ref_3[idx++] = 0x8b000000; + encrypt_last_ref_3[idx++] = 0x8a000000; + encrypt_last_ref_3[idx++] = 0x70000000; + encrypt_last_ref_3[idx++] = 0x3e000000; + encrypt_last_ref_3[idx++] = 0xb5000000; + encrypt_last_ref_3[idx++] = 0x66000000; + encrypt_last_ref_3[idx++] = 0x48000000; + encrypt_last_ref_3[idx++] = 0x03000000; + encrypt_last_ref_3[idx++] = 0xf6000000; + encrypt_last_ref_3[idx++] = 0x0e000000; + encrypt_last_ref_3[idx++] = 0x61000000; + encrypt_last_ref_3[idx++] = 0x35000000; + encrypt_last_ref_3[idx++] = 0x57000000; + encrypt_last_ref_3[idx++] = 0xb9000000; + encrypt_last_ref_3[idx++] = 0x86000000; + encrypt_last_ref_3[idx++] = 0xc1000000; + encrypt_last_ref_3[idx++] = 0x1d000000; + encrypt_last_ref_3[idx++] = 0x9e000000; + encrypt_last_ref_3[idx++] = 0xe1000000; + encrypt_last_ref_3[idx++] = 0xf8000000; + encrypt_last_ref_3[idx++] = 0x98000000; + encrypt_last_ref_3[idx++] = 0x11000000; + encrypt_last_ref_3[idx++] = 0x69000000; + encrypt_last_ref_3[idx++] = 0xd9000000; + encrypt_last_ref_3[idx++] = 0x8e000000; + encrypt_last_ref_3[idx++] = 0x94000000; + encrypt_last_ref_3[idx++] = 0x9b000000; + encrypt_last_ref_3[idx++] = 0x1e000000; + encrypt_last_ref_3[idx++] = 0x87000000; + encrypt_last_ref_3[idx++] = 0xe9000000; + encrypt_last_ref_3[idx++] = 0xce000000; + encrypt_last_ref_3[idx++] = 0x55000000; + encrypt_last_ref_3[idx++] = 0x28000000; + encrypt_last_ref_3[idx++] = 0xdf000000; + encrypt_last_ref_3[idx++] = 0x8c000000; + encrypt_last_ref_3[idx++] = 0xa1000000; + encrypt_last_ref_3[idx++] = 0x89000000; + encrypt_last_ref_3[idx++] = 0x0d000000; + encrypt_last_ref_3[idx++] = 0xbf000000; + encrypt_last_ref_3[idx++] = 0xe6000000; + encrypt_last_ref_3[idx++] = 0x42000000; + encrypt_last_ref_3[idx++] = 0x68000000; + encrypt_last_ref_3[idx++] = 0x41000000; + encrypt_last_ref_3[idx++] = 0x99000000; + encrypt_last_ref_3[idx++] = 0x2d000000; + encrypt_last_ref_3[idx++] = 0x0f000000; + encrypt_last_ref_3[idx++] = 0xb0000000; + encrypt_last_ref_3[idx++] = 0x54000000; + encrypt_last_ref_3[idx++] = 0xbb000000; + encrypt_last_ref_3[idx++] = 0x16000000; + + idx = 0; + decrypt_ref_0[idx++] = 0x50a7f451; + decrypt_ref_0[idx++] = 0x5365417e; + decrypt_ref_0[idx++] = 0xc3a4171a; + decrypt_ref_0[idx++] = 0x965e273a; + decrypt_ref_0[idx++] = 0xcb6bab3b; + decrypt_ref_0[idx++] = 0xf1459d1f; + decrypt_ref_0[idx++] = 0xab58faac; + decrypt_ref_0[idx++] = 0x9303e34b; + decrypt_ref_0[idx++] = 0x55fa3020; + decrypt_ref_0[idx++] = 0xf66d76ad; + decrypt_ref_0[idx++] = 0x9176cc88; + decrypt_ref_0[idx++] = 0x254c02f5; + decrypt_ref_0[idx++] = 0xfcd7e54f; + decrypt_ref_0[idx++] = 0xd7cb2ac5; + decrypt_ref_0[idx++] = 0x80443526; + decrypt_ref_0[idx++] = 0x8fa362b5; + decrypt_ref_0[idx++] = 0x495ab1de; + decrypt_ref_0[idx++] = 0x671bba25; + decrypt_ref_0[idx++] = 0x980eea45; + decrypt_ref_0[idx++] = 0xe1c0fe5d; + decrypt_ref_0[idx++] = 0x02752fc3; + decrypt_ref_0[idx++] = 0x12f04c81; + decrypt_ref_0[idx++] = 0xa397468d; + decrypt_ref_0[idx++] = 0xc6f9d36b; + decrypt_ref_0[idx++] = 0xe75f8f03; + decrypt_ref_0[idx++] = 0x959c9215; + decrypt_ref_0[idx++] = 0xeb7a6dbf; + decrypt_ref_0[idx++] = 0xda595295; + decrypt_ref_0[idx++] = 0x2d83bed4; + decrypt_ref_0[idx++] = 0xd3217458; + decrypt_ref_0[idx++] = 0x2969e049; + decrypt_ref_0[idx++] = 0x44c8c98e; + decrypt_ref_0[idx++] = 0x6a89c275; + decrypt_ref_0[idx++] = 0x78798ef4; + decrypt_ref_0[idx++] = 0x6b3e5899; + decrypt_ref_0[idx++] = 0xdd71b927; + decrypt_ref_0[idx++] = 0xb64fe1be; + decrypt_ref_0[idx++] = 0x17ad88f0; + decrypt_ref_0[idx++] = 0x66ac20c9; + decrypt_ref_0[idx++] = 0xb43ace7d; + decrypt_ref_0[idx++] = 0x184adf63; + decrypt_ref_0[idx++] = 0x82311ae5; + decrypt_ref_0[idx++] = 0x60335197; + decrypt_ref_0[idx++] = 0x457f5362; + decrypt_ref_0[idx++] = 0xe07764b1; + decrypt_ref_0[idx++] = 0x84ae6bbb; + decrypt_ref_0[idx++] = 0x1ca081fe; + decrypt_ref_0[idx++] = 0x942b08f9; + decrypt_ref_0[idx++] = 0x58684870; + decrypt_ref_0[idx++] = 0x19fd458f; + decrypt_ref_0[idx++] = 0x876cde94; + decrypt_ref_0[idx++] = 0xb7f87b52; + decrypt_ref_0[idx++] = 0x23d373ab; + decrypt_ref_0[idx++] = 0xe2024b72; + decrypt_ref_0[idx++] = 0x578f1fe3; + decrypt_ref_0[idx++] = 0x2aab5566; + decrypt_ref_0[idx++] = 0x0728ebb2; + decrypt_ref_0[idx++] = 0x03c2b52f; + decrypt_ref_0[idx++] = 0x9a7bc586; + decrypt_ref_0[idx++] = 0xa50837d3; + decrypt_ref_0[idx++] = 0xf2872830; + decrypt_ref_0[idx++] = 0xb2a5bf23; + decrypt_ref_0[idx++] = 0xba6a0302; + decrypt_ref_0[idx++] = 0x5c8216ed; + decrypt_ref_0[idx++] = 0x2b1ccf8a; + decrypt_ref_0[idx++] = 0x92b479a7; + decrypt_ref_0[idx++] = 0xf0f207f3; + decrypt_ref_0[idx++] = 0xa1e2694e; + decrypt_ref_0[idx++] = 0xcdf4da65; + decrypt_ref_0[idx++] = 0xd5be0506; + decrypt_ref_0[idx++] = 0x1f6234d1; + decrypt_ref_0[idx++] = 0x8afea6c4; + decrypt_ref_0[idx++] = 0x9d532e34; + decrypt_ref_0[idx++] = 0xa055f3a2; + decrypt_ref_0[idx++] = 0x32e18a05; + decrypt_ref_0[idx++] = 0x75ebf6a4; + decrypt_ref_0[idx++] = 0x39ec830b; + decrypt_ref_0[idx++] = 0xaaef6040; + decrypt_ref_0[idx++] = 0x069f715e; + decrypt_ref_0[idx++] = 0x51106ebd; + decrypt_ref_0[idx++] = 0xf98a213e; + decrypt_ref_0[idx++] = 0x3d06dd96; + decrypt_ref_0[idx++] = 0xae053edd; + decrypt_ref_0[idx++] = 0x46bde64d; + decrypt_ref_0[idx++] = 0xb58d5491; + decrypt_ref_0[idx++] = 0x055dc471; + decrypt_ref_0[idx++] = 0x6fd40604; + decrypt_ref_0[idx++] = 0xff155060; + decrypt_ref_0[idx++] = 0x24fb9819; + decrypt_ref_0[idx++] = 0x97e9bdd6; + decrypt_ref_0[idx++] = 0xcc434089; + decrypt_ref_0[idx++] = 0x779ed967; + decrypt_ref_0[idx++] = 0xbd42e8b0; + decrypt_ref_0[idx++] = 0x888b8907; + decrypt_ref_0[idx++] = 0x385b19e7; + decrypt_ref_0[idx++] = 0xdbeec879; + decrypt_ref_0[idx++] = 0x470a7ca1; + decrypt_ref_0[idx++] = 0xe90f427c; + decrypt_ref_0[idx++] = 0xc91e84f8; + decrypt_ref_0[idx++] = 0x00000000; + decrypt_ref_0[idx++] = 0x83868009; + decrypt_ref_0[idx++] = 0x48ed2b32; + decrypt_ref_0[idx++] = 0xac70111e; + decrypt_ref_0[idx++] = 0x4e725a6c; + decrypt_ref_0[idx++] = 0xfbff0efd; + decrypt_ref_0[idx++] = 0x5638850f; + decrypt_ref_0[idx++] = 0x1ed5ae3d; + decrypt_ref_0[idx++] = 0x27392d36; + decrypt_ref_0[idx++] = 0x64d90f0a; + decrypt_ref_0[idx++] = 0x21a65c68; + decrypt_ref_0[idx++] = 0xd1545b9b; + decrypt_ref_0[idx++] = 0x3a2e3624; + decrypt_ref_0[idx++] = 0xb1670a0c; + decrypt_ref_0[idx++] = 0x0fe75793; + decrypt_ref_0[idx++] = 0xd296eeb4; + decrypt_ref_0[idx++] = 0x9e919b1b; + decrypt_ref_0[idx++] = 0x4fc5c080; + decrypt_ref_0[idx++] = 0xa220dc61; + decrypt_ref_0[idx++] = 0x694b775a; + decrypt_ref_0[idx++] = 0x161a121c; + decrypt_ref_0[idx++] = 0x0aba93e2; + decrypt_ref_0[idx++] = 0xe52aa0c0; + decrypt_ref_0[idx++] = 0x43e0223c; + decrypt_ref_0[idx++] = 0x1d171b12; + decrypt_ref_0[idx++] = 0x0b0d090e; + decrypt_ref_0[idx++] = 0xadc78bf2; + decrypt_ref_0[idx++] = 0xb9a8b62d; + decrypt_ref_0[idx++] = 0xc8a91e14; + decrypt_ref_0[idx++] = 0x8519f157; + decrypt_ref_0[idx++] = 0x4c0775af; + decrypt_ref_0[idx++] = 0xbbdd99ee; + decrypt_ref_0[idx++] = 0xfd607fa3; + decrypt_ref_0[idx++] = 0x9f2601f7; + decrypt_ref_0[idx++] = 0xbcf5725c; + decrypt_ref_0[idx++] = 0xc53b6644; + decrypt_ref_0[idx++] = 0x347efb5b; + decrypt_ref_0[idx++] = 0x7629438b; + decrypt_ref_0[idx++] = 0xdcc623cb; + decrypt_ref_0[idx++] = 0x68fcedb6; + decrypt_ref_0[idx++] = 0x63f1e4b8; + decrypt_ref_0[idx++] = 0xcadc31d7; + decrypt_ref_0[idx++] = 0x10856342; + decrypt_ref_0[idx++] = 0x40229713; + decrypt_ref_0[idx++] = 0x2011c684; + decrypt_ref_0[idx++] = 0x7d244a85; + decrypt_ref_0[idx++] = 0xf83dbbd2; + decrypt_ref_0[idx++] = 0x1132f9ae; + decrypt_ref_0[idx++] = 0x6da129c7; + decrypt_ref_0[idx++] = 0x4b2f9e1d; + decrypt_ref_0[idx++] = 0xf330b2dc; + decrypt_ref_0[idx++] = 0xec52860d; + decrypt_ref_0[idx++] = 0xd0e3c177; + decrypt_ref_0[idx++] = 0x6c16b32b; + decrypt_ref_0[idx++] = 0x99b970a9; + decrypt_ref_0[idx++] = 0xfa489411; + decrypt_ref_0[idx++] = 0x2264e947; + decrypt_ref_0[idx++] = 0xc48cfca8; + decrypt_ref_0[idx++] = 0x1a3ff0a0; + decrypt_ref_0[idx++] = 0xd82c7d56; + decrypt_ref_0[idx++] = 0xef903322; + decrypt_ref_0[idx++] = 0xc74e4987; + decrypt_ref_0[idx++] = 0xc1d138d9; + decrypt_ref_0[idx++] = 0xfea2ca8c; + decrypt_ref_0[idx++] = 0x360bd498; + decrypt_ref_0[idx++] = 0xcf81f5a6; + decrypt_ref_0[idx++] = 0x28de7aa5; + decrypt_ref_0[idx++] = 0x268eb7da; + decrypt_ref_0[idx++] = 0xa4bfad3f; + decrypt_ref_0[idx++] = 0xe49d3a2c; + decrypt_ref_0[idx++] = 0x0d927850; + decrypt_ref_0[idx++] = 0x9bcc5f6a; + decrypt_ref_0[idx++] = 0x62467e54; + decrypt_ref_0[idx++] = 0xc2138df6; + decrypt_ref_0[idx++] = 0xe8b8d890; + decrypt_ref_0[idx++] = 0x5ef7392e; + decrypt_ref_0[idx++] = 0xf5afc382; + decrypt_ref_0[idx++] = 0xbe805d9f; + decrypt_ref_0[idx++] = 0x7c93d069; + decrypt_ref_0[idx++] = 0xa92dd56f; + decrypt_ref_0[idx++] = 0xb31225cf; + decrypt_ref_0[idx++] = 0x3b99acc8; + decrypt_ref_0[idx++] = 0xa77d1810; + decrypt_ref_0[idx++] = 0x6e639ce8; + decrypt_ref_0[idx++] = 0x7bbb3bdb; + decrypt_ref_0[idx++] = 0x097826cd; + decrypt_ref_0[idx++] = 0xf418596e; + decrypt_ref_0[idx++] = 0x01b79aec; + decrypt_ref_0[idx++] = 0xa89a4f83; + decrypt_ref_0[idx++] = 0x656e95e6; + decrypt_ref_0[idx++] = 0x7ee6ffaa; + decrypt_ref_0[idx++] = 0x08cfbc21; + decrypt_ref_0[idx++] = 0xe6e815ef; + decrypt_ref_0[idx++] = 0xd99be7ba; + decrypt_ref_0[idx++] = 0xce366f4a; + decrypt_ref_0[idx++] = 0xd4099fea; + decrypt_ref_0[idx++] = 0xd67cb029; + decrypt_ref_0[idx++] = 0xafb2a431; + decrypt_ref_0[idx++] = 0x31233f2a; + decrypt_ref_0[idx++] = 0x3094a5c6; + decrypt_ref_0[idx++] = 0xc066a235; + decrypt_ref_0[idx++] = 0x37bc4e74; + decrypt_ref_0[idx++] = 0xa6ca82fc; + decrypt_ref_0[idx++] = 0xb0d090e0; + decrypt_ref_0[idx++] = 0x15d8a733; + decrypt_ref_0[idx++] = 0x4a9804f1; + decrypt_ref_0[idx++] = 0xf7daec41; + decrypt_ref_0[idx++] = 0x0e50cd7f; + decrypt_ref_0[idx++] = 0x2ff69117; + decrypt_ref_0[idx++] = 0x8dd64d76; + decrypt_ref_0[idx++] = 0x4db0ef43; + decrypt_ref_0[idx++] = 0x544daacc; + decrypt_ref_0[idx++] = 0xdf0496e4; + decrypt_ref_0[idx++] = 0xe3b5d19e; + decrypt_ref_0[idx++] = 0x1b886a4c; + decrypt_ref_0[idx++] = 0xb81f2cc1; + decrypt_ref_0[idx++] = 0x7f516546; + decrypt_ref_0[idx++] = 0x04ea5e9d; + decrypt_ref_0[idx++] = 0x5d358c01; + decrypt_ref_0[idx++] = 0x737487fa; + decrypt_ref_0[idx++] = 0x2e410bfb; + decrypt_ref_0[idx++] = 0x5a1d67b3; + decrypt_ref_0[idx++] = 0x52d2db92; + decrypt_ref_0[idx++] = 0x335610e9; + decrypt_ref_0[idx++] = 0x1347d66d; + decrypt_ref_0[idx++] = 0x8c61d79a; + decrypt_ref_0[idx++] = 0x7a0ca137; + decrypt_ref_0[idx++] = 0x8e14f859; + decrypt_ref_0[idx++] = 0x893c13eb; + decrypt_ref_0[idx++] = 0xee27a9ce; + decrypt_ref_0[idx++] = 0x35c961b7; + decrypt_ref_0[idx++] = 0xede51ce1; + decrypt_ref_0[idx++] = 0x3cb1477a; + decrypt_ref_0[idx++] = 0x59dfd29c; + decrypt_ref_0[idx++] = 0x3f73f255; + decrypt_ref_0[idx++] = 0x79ce1418; + decrypt_ref_0[idx++] = 0xbf37c773; + decrypt_ref_0[idx++] = 0xeacdf753; + decrypt_ref_0[idx++] = 0x5baafd5f; + decrypt_ref_0[idx++] = 0x146f3ddf; + decrypt_ref_0[idx++] = 0x86db4478; + decrypt_ref_0[idx++] = 0x81f3afca; + decrypt_ref_0[idx++] = 0x3ec468b9; + decrypt_ref_0[idx++] = 0x2c342438; + decrypt_ref_0[idx++] = 0x5f40a3c2; + decrypt_ref_0[idx++] = 0x72c31d16; + decrypt_ref_0[idx++] = 0x0c25e2bc; + decrypt_ref_0[idx++] = 0x8b493c28; + decrypt_ref_0[idx++] = 0x41950dff; + decrypt_ref_0[idx++] = 0x7101a839; + decrypt_ref_0[idx++] = 0xdeb30c08; + decrypt_ref_0[idx++] = 0x9ce4b4d8; + decrypt_ref_0[idx++] = 0x90c15664; + decrypt_ref_0[idx++] = 0x6184cb7b; + decrypt_ref_0[idx++] = 0x70b632d5; + decrypt_ref_0[idx++] = 0x745c6c48; + decrypt_ref_0[idx++] = 0x4257b8d0; + + idx = 0; + decrypt_ref_1[idx++] = 0xa7f45150; + decrypt_ref_1[idx++] = 0x65417e53; + decrypt_ref_1[idx++] = 0xa4171ac3; + decrypt_ref_1[idx++] = 0x5e273a96; + decrypt_ref_1[idx++] = 0x6bab3bcb; + decrypt_ref_1[idx++] = 0x459d1ff1; + decrypt_ref_1[idx++] = 0x58faacab; + decrypt_ref_1[idx++] = 0x03e34b93; + decrypt_ref_1[idx++] = 0xfa302055; + decrypt_ref_1[idx++] = 0x6d76adf6; + decrypt_ref_1[idx++] = 0x76cc8891; + decrypt_ref_1[idx++] = 0x4c02f525; + decrypt_ref_1[idx++] = 0xd7e54ffc; + decrypt_ref_1[idx++] = 0xcb2ac5d7; + decrypt_ref_1[idx++] = 0x44352680; + decrypt_ref_1[idx++] = 0xa362b58f; + decrypt_ref_1[idx++] = 0x5ab1de49; + decrypt_ref_1[idx++] = 0x1bba2567; + decrypt_ref_1[idx++] = 0x0eea4598; + decrypt_ref_1[idx++] = 0xc0fe5de1; + decrypt_ref_1[idx++] = 0x752fc302; + decrypt_ref_1[idx++] = 0xf04c8112; + decrypt_ref_1[idx++] = 0x97468da3; + decrypt_ref_1[idx++] = 0xf9d36bc6; + decrypt_ref_1[idx++] = 0x5f8f03e7; + decrypt_ref_1[idx++] = 0x9c921595; + decrypt_ref_1[idx++] = 0x7a6dbfeb; + decrypt_ref_1[idx++] = 0x595295da; + decrypt_ref_1[idx++] = 0x83bed42d; + decrypt_ref_1[idx++] = 0x217458d3; + decrypt_ref_1[idx++] = 0x69e04929; + decrypt_ref_1[idx++] = 0xc8c98e44; + decrypt_ref_1[idx++] = 0x89c2756a; + decrypt_ref_1[idx++] = 0x798ef478; + decrypt_ref_1[idx++] = 0x3e58996b; + decrypt_ref_1[idx++] = 0x71b927dd; + decrypt_ref_1[idx++] = 0x4fe1beb6; + decrypt_ref_1[idx++] = 0xad88f017; + decrypt_ref_1[idx++] = 0xac20c966; + decrypt_ref_1[idx++] = 0x3ace7db4; + decrypt_ref_1[idx++] = 0x4adf6318; + decrypt_ref_1[idx++] = 0x311ae582; + decrypt_ref_1[idx++] = 0x33519760; + decrypt_ref_1[idx++] = 0x7f536245; + decrypt_ref_1[idx++] = 0x7764b1e0; + decrypt_ref_1[idx++] = 0xae6bbb84; + decrypt_ref_1[idx++] = 0xa081fe1c; + decrypt_ref_1[idx++] = 0x2b08f994; + decrypt_ref_1[idx++] = 0x68487058; + decrypt_ref_1[idx++] = 0xfd458f19; + decrypt_ref_1[idx++] = 0x6cde9487; + decrypt_ref_1[idx++] = 0xf87b52b7; + decrypt_ref_1[idx++] = 0xd373ab23; + decrypt_ref_1[idx++] = 0x024b72e2; + decrypt_ref_1[idx++] = 0x8f1fe357; + decrypt_ref_1[idx++] = 0xab55662a; + decrypt_ref_1[idx++] = 0x28ebb207; + decrypt_ref_1[idx++] = 0xc2b52f03; + decrypt_ref_1[idx++] = 0x7bc5869a; + decrypt_ref_1[idx++] = 0x0837d3a5; + decrypt_ref_1[idx++] = 0x872830f2; + decrypt_ref_1[idx++] = 0xa5bf23b2; + decrypt_ref_1[idx++] = 0x6a0302ba; + decrypt_ref_1[idx++] = 0x8216ed5c; + decrypt_ref_1[idx++] = 0x1ccf8a2b; + decrypt_ref_1[idx++] = 0xb479a792; + decrypt_ref_1[idx++] = 0xf207f3f0; + decrypt_ref_1[idx++] = 0xe2694ea1; + decrypt_ref_1[idx++] = 0xf4da65cd; + decrypt_ref_1[idx++] = 0xbe0506d5; + decrypt_ref_1[idx++] = 0x6234d11f; + decrypt_ref_1[idx++] = 0xfea6c48a; + decrypt_ref_1[idx++] = 0x532e349d; + decrypt_ref_1[idx++] = 0x55f3a2a0; + decrypt_ref_1[idx++] = 0xe18a0532; + decrypt_ref_1[idx++] = 0xebf6a475; + decrypt_ref_1[idx++] = 0xec830b39; + decrypt_ref_1[idx++] = 0xef6040aa; + decrypt_ref_1[idx++] = 0x9f715e06; + decrypt_ref_1[idx++] = 0x106ebd51; + decrypt_ref_1[idx++] = 0x8a213ef9; + decrypt_ref_1[idx++] = 0x06dd963d; + decrypt_ref_1[idx++] = 0x053eddae; + decrypt_ref_1[idx++] = 0xbde64d46; + decrypt_ref_1[idx++] = 0x8d5491b5; + decrypt_ref_1[idx++] = 0x5dc47105; + decrypt_ref_1[idx++] = 0xd406046f; + decrypt_ref_1[idx++] = 0x155060ff; + decrypt_ref_1[idx++] = 0xfb981924; + decrypt_ref_1[idx++] = 0xe9bdd697; + decrypt_ref_1[idx++] = 0x434089cc; + decrypt_ref_1[idx++] = 0x9ed96777; + decrypt_ref_1[idx++] = 0x42e8b0bd; + decrypt_ref_1[idx++] = 0x8b890788; + decrypt_ref_1[idx++] = 0x5b19e738; + decrypt_ref_1[idx++] = 0xeec879db; + decrypt_ref_1[idx++] = 0x0a7ca147; + decrypt_ref_1[idx++] = 0x0f427ce9; + decrypt_ref_1[idx++] = 0x1e84f8c9; + decrypt_ref_1[idx++] = 0x00000000; + decrypt_ref_1[idx++] = 0x86800983; + decrypt_ref_1[idx++] = 0xed2b3248; + decrypt_ref_1[idx++] = 0x70111eac; + decrypt_ref_1[idx++] = 0x725a6c4e; + decrypt_ref_1[idx++] = 0xff0efdfb; + decrypt_ref_1[idx++] = 0x38850f56; + decrypt_ref_1[idx++] = 0xd5ae3d1e; + decrypt_ref_1[idx++] = 0x392d3627; + decrypt_ref_1[idx++] = 0xd90f0a64; + decrypt_ref_1[idx++] = 0xa65c6821; + decrypt_ref_1[idx++] = 0x545b9bd1; + decrypt_ref_1[idx++] = 0x2e36243a; + decrypt_ref_1[idx++] = 0x670a0cb1; + decrypt_ref_1[idx++] = 0xe757930f; + decrypt_ref_1[idx++] = 0x96eeb4d2; + decrypt_ref_1[idx++] = 0x919b1b9e; + decrypt_ref_1[idx++] = 0xc5c0804f; + decrypt_ref_1[idx++] = 0x20dc61a2; + decrypt_ref_1[idx++] = 0x4b775a69; + decrypt_ref_1[idx++] = 0x1a121c16; + decrypt_ref_1[idx++] = 0xba93e20a; + decrypt_ref_1[idx++] = 0x2aa0c0e5; + decrypt_ref_1[idx++] = 0xe0223c43; + decrypt_ref_1[idx++] = 0x171b121d; + decrypt_ref_1[idx++] = 0x0d090e0b; + decrypt_ref_1[idx++] = 0xc78bf2ad; + decrypt_ref_1[idx++] = 0xa8b62db9; + decrypt_ref_1[idx++] = 0xa91e14c8; + decrypt_ref_1[idx++] = 0x19f15785; + decrypt_ref_1[idx++] = 0x0775af4c; + decrypt_ref_1[idx++] = 0xdd99eebb; + decrypt_ref_1[idx++] = 0x607fa3fd; + decrypt_ref_1[idx++] = 0x2601f79f; + decrypt_ref_1[idx++] = 0xf5725cbc; + decrypt_ref_1[idx++] = 0x3b6644c5; + decrypt_ref_1[idx++] = 0x7efb5b34; + decrypt_ref_1[idx++] = 0x29438b76; + decrypt_ref_1[idx++] = 0xc623cbdc; + decrypt_ref_1[idx++] = 0xfcedb668; + decrypt_ref_1[idx++] = 0xf1e4b863; + decrypt_ref_1[idx++] = 0xdc31d7ca; + decrypt_ref_1[idx++] = 0x85634210; + decrypt_ref_1[idx++] = 0x22971340; + decrypt_ref_1[idx++] = 0x11c68420; + decrypt_ref_1[idx++] = 0x244a857d; + decrypt_ref_1[idx++] = 0x3dbbd2f8; + decrypt_ref_1[idx++] = 0x32f9ae11; + decrypt_ref_1[idx++] = 0xa129c76d; + decrypt_ref_1[idx++] = 0x2f9e1d4b; + decrypt_ref_1[idx++] = 0x30b2dcf3; + decrypt_ref_1[idx++] = 0x52860dec; + decrypt_ref_1[idx++] = 0xe3c177d0; + decrypt_ref_1[idx++] = 0x16b32b6c; + decrypt_ref_1[idx++] = 0xb970a999; + decrypt_ref_1[idx++] = 0x489411fa; + decrypt_ref_1[idx++] = 0x64e94722; + decrypt_ref_1[idx++] = 0x8cfca8c4; + decrypt_ref_1[idx++] = 0x3ff0a01a; + decrypt_ref_1[idx++] = 0x2c7d56d8; + decrypt_ref_1[idx++] = 0x903322ef; + decrypt_ref_1[idx++] = 0x4e4987c7; + decrypt_ref_1[idx++] = 0xd138d9c1; + decrypt_ref_1[idx++] = 0xa2ca8cfe; + decrypt_ref_1[idx++] = 0x0bd49836; + decrypt_ref_1[idx++] = 0x81f5a6cf; + decrypt_ref_1[idx++] = 0xde7aa528; + decrypt_ref_1[idx++] = 0x8eb7da26; + decrypt_ref_1[idx++] = 0xbfad3fa4; + decrypt_ref_1[idx++] = 0x9d3a2ce4; + decrypt_ref_1[idx++] = 0x9278500d; + decrypt_ref_1[idx++] = 0xcc5f6a9b; + decrypt_ref_1[idx++] = 0x467e5462; + decrypt_ref_1[idx++] = 0x138df6c2; + decrypt_ref_1[idx++] = 0xb8d890e8; + decrypt_ref_1[idx++] = 0xf7392e5e; + decrypt_ref_1[idx++] = 0xafc382f5; + decrypt_ref_1[idx++] = 0x805d9fbe; + decrypt_ref_1[idx++] = 0x93d0697c; + decrypt_ref_1[idx++] = 0x2dd56fa9; + decrypt_ref_1[idx++] = 0x1225cfb3; + decrypt_ref_1[idx++] = 0x99acc83b; + decrypt_ref_1[idx++] = 0x7d1810a7; + decrypt_ref_1[idx++] = 0x639ce86e; + decrypt_ref_1[idx++] = 0xbb3bdb7b; + decrypt_ref_1[idx++] = 0x7826cd09; + decrypt_ref_1[idx++] = 0x18596ef4; + decrypt_ref_1[idx++] = 0xb79aec01; + decrypt_ref_1[idx++] = 0x9a4f83a8; + decrypt_ref_1[idx++] = 0x6e95e665; + decrypt_ref_1[idx++] = 0xe6ffaa7e; + decrypt_ref_1[idx++] = 0xcfbc2108; + decrypt_ref_1[idx++] = 0xe815efe6; + decrypt_ref_1[idx++] = 0x9be7bad9; + decrypt_ref_1[idx++] = 0x366f4ace; + decrypt_ref_1[idx++] = 0x099fead4; + decrypt_ref_1[idx++] = 0x7cb029d6; + decrypt_ref_1[idx++] = 0xb2a431af; + decrypt_ref_1[idx++] = 0x233f2a31; + decrypt_ref_1[idx++] = 0x94a5c630; + decrypt_ref_1[idx++] = 0x66a235c0; + decrypt_ref_1[idx++] = 0xbc4e7437; + decrypt_ref_1[idx++] = 0xca82fca6; + decrypt_ref_1[idx++] = 0xd090e0b0; + decrypt_ref_1[idx++] = 0xd8a73315; + decrypt_ref_1[idx++] = 0x9804f14a; + decrypt_ref_1[idx++] = 0xdaec41f7; + decrypt_ref_1[idx++] = 0x50cd7f0e; + decrypt_ref_1[idx++] = 0xf691172f; + decrypt_ref_1[idx++] = 0xd64d768d; + decrypt_ref_1[idx++] = 0xb0ef434d; + decrypt_ref_1[idx++] = 0x4daacc54; + decrypt_ref_1[idx++] = 0x0496e4df; + decrypt_ref_1[idx++] = 0xb5d19ee3; + decrypt_ref_1[idx++] = 0x886a4c1b; + decrypt_ref_1[idx++] = 0x1f2cc1b8; + decrypt_ref_1[idx++] = 0x5165467f; + decrypt_ref_1[idx++] = 0xea5e9d04; + decrypt_ref_1[idx++] = 0x358c015d; + decrypt_ref_1[idx++] = 0x7487fa73; + decrypt_ref_1[idx++] = 0x410bfb2e; + decrypt_ref_1[idx++] = 0x1d67b35a; + decrypt_ref_1[idx++] = 0xd2db9252; + decrypt_ref_1[idx++] = 0x5610e933; + decrypt_ref_1[idx++] = 0x47d66d13; + decrypt_ref_1[idx++] = 0x61d79a8c; + decrypt_ref_1[idx++] = 0x0ca1377a; + decrypt_ref_1[idx++] = 0x14f8598e; + decrypt_ref_1[idx++] = 0x3c13eb89; + decrypt_ref_1[idx++] = 0x27a9ceee; + decrypt_ref_1[idx++] = 0xc961b735; + decrypt_ref_1[idx++] = 0xe51ce1ed; + decrypt_ref_1[idx++] = 0xb1477a3c; + decrypt_ref_1[idx++] = 0xdfd29c59; + decrypt_ref_1[idx++] = 0x73f2553f; + decrypt_ref_1[idx++] = 0xce141879; + decrypt_ref_1[idx++] = 0x37c773bf; + decrypt_ref_1[idx++] = 0xcdf753ea; + decrypt_ref_1[idx++] = 0xaafd5f5b; + decrypt_ref_1[idx++] = 0x6f3ddf14; + decrypt_ref_1[idx++] = 0xdb447886; + decrypt_ref_1[idx++] = 0xf3afca81; + decrypt_ref_1[idx++] = 0xc468b93e; + decrypt_ref_1[idx++] = 0x3424382c; + decrypt_ref_1[idx++] = 0x40a3c25f; + decrypt_ref_1[idx++] = 0xc31d1672; + decrypt_ref_1[idx++] = 0x25e2bc0c; + decrypt_ref_1[idx++] = 0x493c288b; + decrypt_ref_1[idx++] = 0x950dff41; + decrypt_ref_1[idx++] = 0x01a83971; + decrypt_ref_1[idx++] = 0xb30c08de; + decrypt_ref_1[idx++] = 0xe4b4d89c; + decrypt_ref_1[idx++] = 0xc1566490; + decrypt_ref_1[idx++] = 0x84cb7b61; + decrypt_ref_1[idx++] = 0xb632d570; + decrypt_ref_1[idx++] = 0x5c6c4874; + decrypt_ref_1[idx++] = 0x57b8d042; + + idx = 0; + decrypt_ref_2[idx++] = 0xf45150a7; + decrypt_ref_2[idx++] = 0x417e5365; + decrypt_ref_2[idx++] = 0x171ac3a4; + decrypt_ref_2[idx++] = 0x273a965e; + decrypt_ref_2[idx++] = 0xab3bcb6b; + decrypt_ref_2[idx++] = 0x9d1ff145; + decrypt_ref_2[idx++] = 0xfaacab58; + decrypt_ref_2[idx++] = 0xe34b9303; + decrypt_ref_2[idx++] = 0x302055fa; + decrypt_ref_2[idx++] = 0x76adf66d; + decrypt_ref_2[idx++] = 0xcc889176; + decrypt_ref_2[idx++] = 0x02f5254c; + decrypt_ref_2[idx++] = 0xe54ffcd7; + decrypt_ref_2[idx++] = 0x2ac5d7cb; + decrypt_ref_2[idx++] = 0x35268044; + decrypt_ref_2[idx++] = 0x62b58fa3; + decrypt_ref_2[idx++] = 0xb1de495a; + decrypt_ref_2[idx++] = 0xba25671b; + decrypt_ref_2[idx++] = 0xea45980e; + decrypt_ref_2[idx++] = 0xfe5de1c0; + decrypt_ref_2[idx++] = 0x2fc30275; + decrypt_ref_2[idx++] = 0x4c8112f0; + decrypt_ref_2[idx++] = 0x468da397; + decrypt_ref_2[idx++] = 0xd36bc6f9; + decrypt_ref_2[idx++] = 0x8f03e75f; + decrypt_ref_2[idx++] = 0x9215959c; + decrypt_ref_2[idx++] = 0x6dbfeb7a; + decrypt_ref_2[idx++] = 0x5295da59; + decrypt_ref_2[idx++] = 0xbed42d83; + decrypt_ref_2[idx++] = 0x7458d321; + decrypt_ref_2[idx++] = 0xe0492969; + decrypt_ref_2[idx++] = 0xc98e44c8; + decrypt_ref_2[idx++] = 0xc2756a89; + decrypt_ref_2[idx++] = 0x8ef47879; + decrypt_ref_2[idx++] = 0x58996b3e; + decrypt_ref_2[idx++] = 0xb927dd71; + decrypt_ref_2[idx++] = 0xe1beb64f; + decrypt_ref_2[idx++] = 0x88f017ad; + decrypt_ref_2[idx++] = 0x20c966ac; + decrypt_ref_2[idx++] = 0xce7db43a; + decrypt_ref_2[idx++] = 0xdf63184a; + decrypt_ref_2[idx++] = 0x1ae58231; + decrypt_ref_2[idx++] = 0x51976033; + decrypt_ref_2[idx++] = 0x5362457f; + decrypt_ref_2[idx++] = 0x64b1e077; + decrypt_ref_2[idx++] = 0x6bbb84ae; + decrypt_ref_2[idx++] = 0x81fe1ca0; + decrypt_ref_2[idx++] = 0x08f9942b; + decrypt_ref_2[idx++] = 0x48705868; + decrypt_ref_2[idx++] = 0x458f19fd; + decrypt_ref_2[idx++] = 0xde94876c; + decrypt_ref_2[idx++] = 0x7b52b7f8; + decrypt_ref_2[idx++] = 0x73ab23d3; + decrypt_ref_2[idx++] = 0x4b72e202; + decrypt_ref_2[idx++] = 0x1fe3578f; + decrypt_ref_2[idx++] = 0x55662aab; + decrypt_ref_2[idx++] = 0xebb20728; + decrypt_ref_2[idx++] = 0xb52f03c2; + decrypt_ref_2[idx++] = 0xc5869a7b; + decrypt_ref_2[idx++] = 0x37d3a508; + decrypt_ref_2[idx++] = 0x2830f287; + decrypt_ref_2[idx++] = 0xbf23b2a5; + decrypt_ref_2[idx++] = 0x0302ba6a; + decrypt_ref_2[idx++] = 0x16ed5c82; + decrypt_ref_2[idx++] = 0xcf8a2b1c; + decrypt_ref_2[idx++] = 0x79a792b4; + decrypt_ref_2[idx++] = 0x07f3f0f2; + decrypt_ref_2[idx++] = 0x694ea1e2; + decrypt_ref_2[idx++] = 0xda65cdf4; + decrypt_ref_2[idx++] = 0x0506d5be; + decrypt_ref_2[idx++] = 0x34d11f62; + decrypt_ref_2[idx++] = 0xa6c48afe; + decrypt_ref_2[idx++] = 0x2e349d53; + decrypt_ref_2[idx++] = 0xf3a2a055; + decrypt_ref_2[idx++] = 0x8a0532e1; + decrypt_ref_2[idx++] = 0xf6a475eb; + decrypt_ref_2[idx++] = 0x830b39ec; + decrypt_ref_2[idx++] = 0x6040aaef; + decrypt_ref_2[idx++] = 0x715e069f; + decrypt_ref_2[idx++] = 0x6ebd5110; + decrypt_ref_2[idx++] = 0x213ef98a; + decrypt_ref_2[idx++] = 0xdd963d06; + decrypt_ref_2[idx++] = 0x3eddae05; + decrypt_ref_2[idx++] = 0xe64d46bd; + decrypt_ref_2[idx++] = 0x5491b58d; + decrypt_ref_2[idx++] = 0xc471055d; + decrypt_ref_2[idx++] = 0x06046fd4; + decrypt_ref_2[idx++] = 0x5060ff15; + decrypt_ref_2[idx++] = 0x981924fb; + decrypt_ref_2[idx++] = 0xbdd697e9; + decrypt_ref_2[idx++] = 0x4089cc43; + decrypt_ref_2[idx++] = 0xd967779e; + decrypt_ref_2[idx++] = 0xe8b0bd42; + decrypt_ref_2[idx++] = 0x8907888b; + decrypt_ref_2[idx++] = 0x19e7385b; + decrypt_ref_2[idx++] = 0xc879dbee; + decrypt_ref_2[idx++] = 0x7ca1470a; + decrypt_ref_2[idx++] = 0x427ce90f; + decrypt_ref_2[idx++] = 0x84f8c91e; + decrypt_ref_2[idx++] = 0x00000000; + decrypt_ref_2[idx++] = 0x80098386; + decrypt_ref_2[idx++] = 0x2b3248ed; + decrypt_ref_2[idx++] = 0x111eac70; + decrypt_ref_2[idx++] = 0x5a6c4e72; + decrypt_ref_2[idx++] = 0x0efdfbff; + decrypt_ref_2[idx++] = 0x850f5638; + decrypt_ref_2[idx++] = 0xae3d1ed5; + decrypt_ref_2[idx++] = 0x2d362739; + decrypt_ref_2[idx++] = 0x0f0a64d9; + decrypt_ref_2[idx++] = 0x5c6821a6; + decrypt_ref_2[idx++] = 0x5b9bd154; + decrypt_ref_2[idx++] = 0x36243a2e; + decrypt_ref_2[idx++] = 0x0a0cb167; + decrypt_ref_2[idx++] = 0x57930fe7; + decrypt_ref_2[idx++] = 0xeeb4d296; + decrypt_ref_2[idx++] = 0x9b1b9e91; + decrypt_ref_2[idx++] = 0xc0804fc5; + decrypt_ref_2[idx++] = 0xdc61a220; + decrypt_ref_2[idx++] = 0x775a694b; + decrypt_ref_2[idx++] = 0x121c161a; + decrypt_ref_2[idx++] = 0x93e20aba; + decrypt_ref_2[idx++] = 0xa0c0e52a; + decrypt_ref_2[idx++] = 0x223c43e0; + decrypt_ref_2[idx++] = 0x1b121d17; + decrypt_ref_2[idx++] = 0x090e0b0d; + decrypt_ref_2[idx++] = 0x8bf2adc7; + decrypt_ref_2[idx++] = 0xb62db9a8; + decrypt_ref_2[idx++] = 0x1e14c8a9; + decrypt_ref_2[idx++] = 0xf1578519; + decrypt_ref_2[idx++] = 0x75af4c07; + decrypt_ref_2[idx++] = 0x99eebbdd; + decrypt_ref_2[idx++] = 0x7fa3fd60; + decrypt_ref_2[idx++] = 0x01f79f26; + decrypt_ref_2[idx++] = 0x725cbcf5; + decrypt_ref_2[idx++] = 0x6644c53b; + decrypt_ref_2[idx++] = 0xfb5b347e; + decrypt_ref_2[idx++] = 0x438b7629; + decrypt_ref_2[idx++] = 0x23cbdcc6; + decrypt_ref_2[idx++] = 0xedb668fc; + decrypt_ref_2[idx++] = 0xe4b863f1; + decrypt_ref_2[idx++] = 0x31d7cadc; + decrypt_ref_2[idx++] = 0x63421085; + decrypt_ref_2[idx++] = 0x97134022; + decrypt_ref_2[idx++] = 0xc6842011; + decrypt_ref_2[idx++] = 0x4a857d24; + decrypt_ref_2[idx++] = 0xbbd2f83d; + decrypt_ref_2[idx++] = 0xf9ae1132; + decrypt_ref_2[idx++] = 0x29c76da1; + decrypt_ref_2[idx++] = 0x9e1d4b2f; + decrypt_ref_2[idx++] = 0xb2dcf330; + decrypt_ref_2[idx++] = 0x860dec52; + decrypt_ref_2[idx++] = 0xc177d0e3; + decrypt_ref_2[idx++] = 0xb32b6c16; + decrypt_ref_2[idx++] = 0x70a999b9; + decrypt_ref_2[idx++] = 0x9411fa48; + decrypt_ref_2[idx++] = 0xe9472264; + decrypt_ref_2[idx++] = 0xfca8c48c; + decrypt_ref_2[idx++] = 0xf0a01a3f; + decrypt_ref_2[idx++] = 0x7d56d82c; + decrypt_ref_2[idx++] = 0x3322ef90; + decrypt_ref_2[idx++] = 0x4987c74e; + decrypt_ref_2[idx++] = 0x38d9c1d1; + decrypt_ref_2[idx++] = 0xca8cfea2; + decrypt_ref_2[idx++] = 0xd498360b; + decrypt_ref_2[idx++] = 0xf5a6cf81; + decrypt_ref_2[idx++] = 0x7aa528de; + decrypt_ref_2[idx++] = 0xb7da268e; + decrypt_ref_2[idx++] = 0xad3fa4bf; + decrypt_ref_2[idx++] = 0x3a2ce49d; + decrypt_ref_2[idx++] = 0x78500d92; + decrypt_ref_2[idx++] = 0x5f6a9bcc; + decrypt_ref_2[idx++] = 0x7e546246; + decrypt_ref_2[idx++] = 0x8df6c213; + decrypt_ref_2[idx++] = 0xd890e8b8; + decrypt_ref_2[idx++] = 0x392e5ef7; + decrypt_ref_2[idx++] = 0xc382f5af; + decrypt_ref_2[idx++] = 0x5d9fbe80; + decrypt_ref_2[idx++] = 0xd0697c93; + decrypt_ref_2[idx++] = 0xd56fa92d; + decrypt_ref_2[idx++] = 0x25cfb312; + decrypt_ref_2[idx++] = 0xacc83b99; + decrypt_ref_2[idx++] = 0x1810a77d; + decrypt_ref_2[idx++] = 0x9ce86e63; + decrypt_ref_2[idx++] = 0x3bdb7bbb; + decrypt_ref_2[idx++] = 0x26cd0978; + decrypt_ref_2[idx++] = 0x596ef418; + decrypt_ref_2[idx++] = 0x9aec01b7; + decrypt_ref_2[idx++] = 0x4f83a89a; + decrypt_ref_2[idx++] = 0x95e6656e; + decrypt_ref_2[idx++] = 0xffaa7ee6; + decrypt_ref_2[idx++] = 0xbc2108cf; + decrypt_ref_2[idx++] = 0x15efe6e8; + decrypt_ref_2[idx++] = 0xe7bad99b; + decrypt_ref_2[idx++] = 0x6f4ace36; + decrypt_ref_2[idx++] = 0x9fead409; + decrypt_ref_2[idx++] = 0xb029d67c; + decrypt_ref_2[idx++] = 0xa431afb2; + decrypt_ref_2[idx++] = 0x3f2a3123; + decrypt_ref_2[idx++] = 0xa5c63094; + decrypt_ref_2[idx++] = 0xa235c066; + decrypt_ref_2[idx++] = 0x4e7437bc; + decrypt_ref_2[idx++] = 0x82fca6ca; + decrypt_ref_2[idx++] = 0x90e0b0d0; + decrypt_ref_2[idx++] = 0xa73315d8; + decrypt_ref_2[idx++] = 0x04f14a98; + decrypt_ref_2[idx++] = 0xec41f7da; + decrypt_ref_2[idx++] = 0xcd7f0e50; + decrypt_ref_2[idx++] = 0x91172ff6; + decrypt_ref_2[idx++] = 0x4d768dd6; + decrypt_ref_2[idx++] = 0xef434db0; + decrypt_ref_2[idx++] = 0xaacc544d; + decrypt_ref_2[idx++] = 0x96e4df04; + decrypt_ref_2[idx++] = 0xd19ee3b5; + decrypt_ref_2[idx++] = 0x6a4c1b88; + decrypt_ref_2[idx++] = 0x2cc1b81f; + decrypt_ref_2[idx++] = 0x65467f51; + decrypt_ref_2[idx++] = 0x5e9d04ea; + decrypt_ref_2[idx++] = 0x8c015d35; + decrypt_ref_2[idx++] = 0x87fa7374; + decrypt_ref_2[idx++] = 0x0bfb2e41; + decrypt_ref_2[idx++] = 0x67b35a1d; + decrypt_ref_2[idx++] = 0xdb9252d2; + decrypt_ref_2[idx++] = 0x10e93356; + decrypt_ref_2[idx++] = 0xd66d1347; + decrypt_ref_2[idx++] = 0xd79a8c61; + decrypt_ref_2[idx++] = 0xa1377a0c; + decrypt_ref_2[idx++] = 0xf8598e14; + decrypt_ref_2[idx++] = 0x13eb893c; + decrypt_ref_2[idx++] = 0xa9ceee27; + decrypt_ref_2[idx++] = 0x61b735c9; + decrypt_ref_2[idx++] = 0x1ce1ede5; + decrypt_ref_2[idx++] = 0x477a3cb1; + decrypt_ref_2[idx++] = 0xd29c59df; + decrypt_ref_2[idx++] = 0xf2553f73; + decrypt_ref_2[idx++] = 0x141879ce; + decrypt_ref_2[idx++] = 0xc773bf37; + decrypt_ref_2[idx++] = 0xf753eacd; + decrypt_ref_2[idx++] = 0xfd5f5baa; + decrypt_ref_2[idx++] = 0x3ddf146f; + decrypt_ref_2[idx++] = 0x447886db; + decrypt_ref_2[idx++] = 0xafca81f3; + decrypt_ref_2[idx++] = 0x68b93ec4; + decrypt_ref_2[idx++] = 0x24382c34; + decrypt_ref_2[idx++] = 0xa3c25f40; + decrypt_ref_2[idx++] = 0x1d1672c3; + decrypt_ref_2[idx++] = 0xe2bc0c25; + decrypt_ref_2[idx++] = 0x3c288b49; + decrypt_ref_2[idx++] = 0x0dff4195; + decrypt_ref_2[idx++] = 0xa8397101; + decrypt_ref_2[idx++] = 0x0c08deb3; + decrypt_ref_2[idx++] = 0xb4d89ce4; + decrypt_ref_2[idx++] = 0x566490c1; + decrypt_ref_2[idx++] = 0xcb7b6184; + decrypt_ref_2[idx++] = 0x32d570b6; + decrypt_ref_2[idx++] = 0x6c48745c; + decrypt_ref_2[idx++] = 0xb8d04257; + + idx = 0; + decrypt_ref_3[idx++] = 0x5150a7f4; + decrypt_ref_3[idx++] = 0x7e536541; + decrypt_ref_3[idx++] = 0x1ac3a417; + decrypt_ref_3[idx++] = 0x3a965e27; + decrypt_ref_3[idx++] = 0x3bcb6bab; + decrypt_ref_3[idx++] = 0x1ff1459d; + decrypt_ref_3[idx++] = 0xacab58fa; + decrypt_ref_3[idx++] = 0x4b9303e3; + decrypt_ref_3[idx++] = 0x2055fa30; + decrypt_ref_3[idx++] = 0xadf66d76; + decrypt_ref_3[idx++] = 0x889176cc; + decrypt_ref_3[idx++] = 0xf5254c02; + decrypt_ref_3[idx++] = 0x4ffcd7e5; + decrypt_ref_3[idx++] = 0xc5d7cb2a; + decrypt_ref_3[idx++] = 0x26804435; + decrypt_ref_3[idx++] = 0xb58fa362; + decrypt_ref_3[idx++] = 0xde495ab1; + decrypt_ref_3[idx++] = 0x25671bba; + decrypt_ref_3[idx++] = 0x45980eea; + decrypt_ref_3[idx++] = 0x5de1c0fe; + decrypt_ref_3[idx++] = 0xc302752f; + decrypt_ref_3[idx++] = 0x8112f04c; + decrypt_ref_3[idx++] = 0x8da39746; + decrypt_ref_3[idx++] = 0x6bc6f9d3; + decrypt_ref_3[idx++] = 0x03e75f8f; + decrypt_ref_3[idx++] = 0x15959c92; + decrypt_ref_3[idx++] = 0xbfeb7a6d; + decrypt_ref_3[idx++] = 0x95da5952; + decrypt_ref_3[idx++] = 0xd42d83be; + decrypt_ref_3[idx++] = 0x58d32174; + decrypt_ref_3[idx++] = 0x492969e0; + decrypt_ref_3[idx++] = 0x8e44c8c9; + decrypt_ref_3[idx++] = 0x756a89c2; + decrypt_ref_3[idx++] = 0xf478798e; + decrypt_ref_3[idx++] = 0x996b3e58; + decrypt_ref_3[idx++] = 0x27dd71b9; + decrypt_ref_3[idx++] = 0xbeb64fe1; + decrypt_ref_3[idx++] = 0xf017ad88; + decrypt_ref_3[idx++] = 0xc966ac20; + decrypt_ref_3[idx++] = 0x7db43ace; + decrypt_ref_3[idx++] = 0x63184adf; + decrypt_ref_3[idx++] = 0xe582311a; + decrypt_ref_3[idx++] = 0x97603351; + decrypt_ref_3[idx++] = 0x62457f53; + decrypt_ref_3[idx++] = 0xb1e07764; + decrypt_ref_3[idx++] = 0xbb84ae6b; + decrypt_ref_3[idx++] = 0xfe1ca081; + decrypt_ref_3[idx++] = 0xf9942b08; + decrypt_ref_3[idx++] = 0x70586848; + decrypt_ref_3[idx++] = 0x8f19fd45; + decrypt_ref_3[idx++] = 0x94876cde; + decrypt_ref_3[idx++] = 0x52b7f87b; + decrypt_ref_3[idx++] = 0xab23d373; + decrypt_ref_3[idx++] = 0x72e2024b; + decrypt_ref_3[idx++] = 0xe3578f1f; + decrypt_ref_3[idx++] = 0x662aab55; + decrypt_ref_3[idx++] = 0xb20728eb; + decrypt_ref_3[idx++] = 0x2f03c2b5; + decrypt_ref_3[idx++] = 0x869a7bc5; + decrypt_ref_3[idx++] = 0xd3a50837; + decrypt_ref_3[idx++] = 0x30f28728; + decrypt_ref_3[idx++] = 0x23b2a5bf; + decrypt_ref_3[idx++] = 0x02ba6a03; + decrypt_ref_3[idx++] = 0xed5c8216; + decrypt_ref_3[idx++] = 0x8a2b1ccf; + decrypt_ref_3[idx++] = 0xa792b479; + decrypt_ref_3[idx++] = 0xf3f0f207; + decrypt_ref_3[idx++] = 0x4ea1e269; + decrypt_ref_3[idx++] = 0x65cdf4da; + decrypt_ref_3[idx++] = 0x06d5be05; + decrypt_ref_3[idx++] = 0xd11f6234; + decrypt_ref_3[idx++] = 0xc48afea6; + decrypt_ref_3[idx++] = 0x349d532e; + decrypt_ref_3[idx++] = 0xa2a055f3; + decrypt_ref_3[idx++] = 0x0532e18a; + decrypt_ref_3[idx++] = 0xa475ebf6; + decrypt_ref_3[idx++] = 0x0b39ec83; + decrypt_ref_3[idx++] = 0x40aaef60; + decrypt_ref_3[idx++] = 0x5e069f71; + decrypt_ref_3[idx++] = 0xbd51106e; + decrypt_ref_3[idx++] = 0x3ef98a21; + decrypt_ref_3[idx++] = 0x963d06dd; + decrypt_ref_3[idx++] = 0xddae053e; + decrypt_ref_3[idx++] = 0x4d46bde6; + decrypt_ref_3[idx++] = 0x91b58d54; + decrypt_ref_3[idx++] = 0x71055dc4; + decrypt_ref_3[idx++] = 0x046fd406; + decrypt_ref_3[idx++] = 0x60ff1550; + decrypt_ref_3[idx++] = 0x1924fb98; + decrypt_ref_3[idx++] = 0xd697e9bd; + decrypt_ref_3[idx++] = 0x89cc4340; + decrypt_ref_3[idx++] = 0x67779ed9; + decrypt_ref_3[idx++] = 0xb0bd42e8; + decrypt_ref_3[idx++] = 0x07888b89; + decrypt_ref_3[idx++] = 0xe7385b19; + decrypt_ref_3[idx++] = 0x79dbeec8; + decrypt_ref_3[idx++] = 0xa1470a7c; + decrypt_ref_3[idx++] = 0x7ce90f42; + decrypt_ref_3[idx++] = 0xf8c91e84; + decrypt_ref_3[idx++] = 0x00000000; + decrypt_ref_3[idx++] = 0x09838680; + decrypt_ref_3[idx++] = 0x3248ed2b; + decrypt_ref_3[idx++] = 0x1eac7011; + decrypt_ref_3[idx++] = 0x6c4e725a; + decrypt_ref_3[idx++] = 0xfdfbff0e; + decrypt_ref_3[idx++] = 0x0f563885; + decrypt_ref_3[idx++] = 0x3d1ed5ae; + decrypt_ref_3[idx++] = 0x3627392d; + decrypt_ref_3[idx++] = 0x0a64d90f; + decrypt_ref_3[idx++] = 0x6821a65c; + decrypt_ref_3[idx++] = 0x9bd1545b; + decrypt_ref_3[idx++] = 0x243a2e36; + decrypt_ref_3[idx++] = 0x0cb1670a; + decrypt_ref_3[idx++] = 0x930fe757; + decrypt_ref_3[idx++] = 0xb4d296ee; + decrypt_ref_3[idx++] = 0x1b9e919b; + decrypt_ref_3[idx++] = 0x804fc5c0; + decrypt_ref_3[idx++] = 0x61a220dc; + decrypt_ref_3[idx++] = 0x5a694b77; + decrypt_ref_3[idx++] = 0x1c161a12; + decrypt_ref_3[idx++] = 0xe20aba93; + decrypt_ref_3[idx++] = 0xc0e52aa0; + decrypt_ref_3[idx++] = 0x3c43e022; + decrypt_ref_3[idx++] = 0x121d171b; + decrypt_ref_3[idx++] = 0x0e0b0d09; + decrypt_ref_3[idx++] = 0xf2adc78b; + decrypt_ref_3[idx++] = 0x2db9a8b6; + decrypt_ref_3[idx++] = 0x14c8a91e; + decrypt_ref_3[idx++] = 0x578519f1; + decrypt_ref_3[idx++] = 0xaf4c0775; + decrypt_ref_3[idx++] = 0xeebbdd99; + decrypt_ref_3[idx++] = 0xa3fd607f; + decrypt_ref_3[idx++] = 0xf79f2601; + decrypt_ref_3[idx++] = 0x5cbcf572; + decrypt_ref_3[idx++] = 0x44c53b66; + decrypt_ref_3[idx++] = 0x5b347efb; + decrypt_ref_3[idx++] = 0x8b762943; + decrypt_ref_3[idx++] = 0xcbdcc623; + decrypt_ref_3[idx++] = 0xb668fced; + decrypt_ref_3[idx++] = 0xb863f1e4; + decrypt_ref_3[idx++] = 0xd7cadc31; + decrypt_ref_3[idx++] = 0x42108563; + decrypt_ref_3[idx++] = 0x13402297; + decrypt_ref_3[idx++] = 0x842011c6; + decrypt_ref_3[idx++] = 0x857d244a; + decrypt_ref_3[idx++] = 0xd2f83dbb; + decrypt_ref_3[idx++] = 0xae1132f9; + decrypt_ref_3[idx++] = 0xc76da129; + decrypt_ref_3[idx++] = 0x1d4b2f9e; + decrypt_ref_3[idx++] = 0xdcf330b2; + decrypt_ref_3[idx++] = 0x0dec5286; + decrypt_ref_3[idx++] = 0x77d0e3c1; + decrypt_ref_3[idx++] = 0x2b6c16b3; + decrypt_ref_3[idx++] = 0xa999b970; + decrypt_ref_3[idx++] = 0x11fa4894; + decrypt_ref_3[idx++] = 0x472264e9; + decrypt_ref_3[idx++] = 0xa8c48cfc; + decrypt_ref_3[idx++] = 0xa01a3ff0; + decrypt_ref_3[idx++] = 0x56d82c7d; + decrypt_ref_3[idx++] = 0x22ef9033; + decrypt_ref_3[idx++] = 0x87c74e49; + decrypt_ref_3[idx++] = 0xd9c1d138; + decrypt_ref_3[idx++] = 0x8cfea2ca; + decrypt_ref_3[idx++] = 0x98360bd4; + decrypt_ref_3[idx++] = 0xa6cf81f5; + decrypt_ref_3[idx++] = 0xa528de7a; + decrypt_ref_3[idx++] = 0xda268eb7; + decrypt_ref_3[idx++] = 0x3fa4bfad; + decrypt_ref_3[idx++] = 0x2ce49d3a; + decrypt_ref_3[idx++] = 0x500d9278; + decrypt_ref_3[idx++] = 0x6a9bcc5f; + decrypt_ref_3[idx++] = 0x5462467e; + decrypt_ref_3[idx++] = 0xf6c2138d; + decrypt_ref_3[idx++] = 0x90e8b8d8; + decrypt_ref_3[idx++] = 0x2e5ef739; + decrypt_ref_3[idx++] = 0x82f5afc3; + decrypt_ref_3[idx++] = 0x9fbe805d; + decrypt_ref_3[idx++] = 0x697c93d0; + decrypt_ref_3[idx++] = 0x6fa92dd5; + decrypt_ref_3[idx++] = 0xcfb31225; + decrypt_ref_3[idx++] = 0xc83b99ac; + decrypt_ref_3[idx++] = 0x10a77d18; + decrypt_ref_3[idx++] = 0xe86e639c; + decrypt_ref_3[idx++] = 0xdb7bbb3b; + decrypt_ref_3[idx++] = 0xcd097826; + decrypt_ref_3[idx++] = 0x6ef41859; + decrypt_ref_3[idx++] = 0xec01b79a; + decrypt_ref_3[idx++] = 0x83a89a4f; + decrypt_ref_3[idx++] = 0xe6656e95; + decrypt_ref_3[idx++] = 0xaa7ee6ff; + decrypt_ref_3[idx++] = 0x2108cfbc; + decrypt_ref_3[idx++] = 0xefe6e815; + decrypt_ref_3[idx++] = 0xbad99be7; + decrypt_ref_3[idx++] = 0x4ace366f; + decrypt_ref_3[idx++] = 0xead4099f; + decrypt_ref_3[idx++] = 0x29d67cb0; + decrypt_ref_3[idx++] = 0x31afb2a4; + decrypt_ref_3[idx++] = 0x2a31233f; + decrypt_ref_3[idx++] = 0xc63094a5; + decrypt_ref_3[idx++] = 0x35c066a2; + decrypt_ref_3[idx++] = 0x7437bc4e; + decrypt_ref_3[idx++] = 0xfca6ca82; + decrypt_ref_3[idx++] = 0xe0b0d090; + decrypt_ref_3[idx++] = 0x3315d8a7; + decrypt_ref_3[idx++] = 0xf14a9804; + decrypt_ref_3[idx++] = 0x41f7daec; + decrypt_ref_3[idx++] = 0x7f0e50cd; + decrypt_ref_3[idx++] = 0x172ff691; + decrypt_ref_3[idx++] = 0x768dd64d; + decrypt_ref_3[idx++] = 0x434db0ef; + decrypt_ref_3[idx++] = 0xcc544daa; + decrypt_ref_3[idx++] = 0xe4df0496; + decrypt_ref_3[idx++] = 0x9ee3b5d1; + decrypt_ref_3[idx++] = 0x4c1b886a; + decrypt_ref_3[idx++] = 0xc1b81f2c; + decrypt_ref_3[idx++] = 0x467f5165; + decrypt_ref_3[idx++] = 0x9d04ea5e; + decrypt_ref_3[idx++] = 0x015d358c; + decrypt_ref_3[idx++] = 0xfa737487; + decrypt_ref_3[idx++] = 0xfb2e410b; + decrypt_ref_3[idx++] = 0xb35a1d67; + decrypt_ref_3[idx++] = 0x9252d2db; + decrypt_ref_3[idx++] = 0xe9335610; + decrypt_ref_3[idx++] = 0x6d1347d6; + decrypt_ref_3[idx++] = 0x9a8c61d7; + decrypt_ref_3[idx++] = 0x377a0ca1; + decrypt_ref_3[idx++] = 0x598e14f8; + decrypt_ref_3[idx++] = 0xeb893c13; + decrypt_ref_3[idx++] = 0xceee27a9; + decrypt_ref_3[idx++] = 0xb735c961; + decrypt_ref_3[idx++] = 0xe1ede51c; + decrypt_ref_3[idx++] = 0x7a3cb147; + decrypt_ref_3[idx++] = 0x9c59dfd2; + decrypt_ref_3[idx++] = 0x553f73f2; + decrypt_ref_3[idx++] = 0x1879ce14; + decrypt_ref_3[idx++] = 0x73bf37c7; + decrypt_ref_3[idx++] = 0x53eacdf7; + decrypt_ref_3[idx++] = 0x5f5baafd; + decrypt_ref_3[idx++] = 0xdf146f3d; + decrypt_ref_3[idx++] = 0x7886db44; + decrypt_ref_3[idx++] = 0xca81f3af; + decrypt_ref_3[idx++] = 0xb93ec468; + decrypt_ref_3[idx++] = 0x382c3424; + decrypt_ref_3[idx++] = 0xc25f40a3; + decrypt_ref_3[idx++] = 0x1672c31d; + decrypt_ref_3[idx++] = 0xbc0c25e2; + decrypt_ref_3[idx++] = 0x288b493c; + decrypt_ref_3[idx++] = 0xff41950d; + decrypt_ref_3[idx++] = 0x397101a8; + decrypt_ref_3[idx++] = 0x08deb30c; + decrypt_ref_3[idx++] = 0xd89ce4b4; + decrypt_ref_3[idx++] = 0x6490c156; + decrypt_ref_3[idx++] = 0x7b6184cb; + decrypt_ref_3[idx++] = 0xd570b632; + decrypt_ref_3[idx++] = 0x48745c6c; + decrypt_ref_3[idx++] = 0xd04257b8; + + idx = 0; + decrypt_last_ref_0[idx++] = 0x00000052; + decrypt_last_ref_0[idx++] = 0x00000009; + decrypt_last_ref_0[idx++] = 0x0000006a; + decrypt_last_ref_0[idx++] = 0x000000d5; + decrypt_last_ref_0[idx++] = 0x00000030; + decrypt_last_ref_0[idx++] = 0x00000036; + decrypt_last_ref_0[idx++] = 0x000000a5; + decrypt_last_ref_0[idx++] = 0x00000038; + decrypt_last_ref_0[idx++] = 0x000000bf; + decrypt_last_ref_0[idx++] = 0x00000040; + decrypt_last_ref_0[idx++] = 0x000000a3; + decrypt_last_ref_0[idx++] = 0x0000009e; + decrypt_last_ref_0[idx++] = 0x00000081; + decrypt_last_ref_0[idx++] = 0x000000f3; + decrypt_last_ref_0[idx++] = 0x000000d7; + decrypt_last_ref_0[idx++] = 0x000000fb; + decrypt_last_ref_0[idx++] = 0x0000007c; + decrypt_last_ref_0[idx++] = 0x000000e3; + decrypt_last_ref_0[idx++] = 0x00000039; + decrypt_last_ref_0[idx++] = 0x00000082; + decrypt_last_ref_0[idx++] = 0x0000009b; + decrypt_last_ref_0[idx++] = 0x0000002f; + decrypt_last_ref_0[idx++] = 0x000000ff; + decrypt_last_ref_0[idx++] = 0x00000087; + decrypt_last_ref_0[idx++] = 0x00000034; + decrypt_last_ref_0[idx++] = 0x0000008e; + decrypt_last_ref_0[idx++] = 0x00000043; + decrypt_last_ref_0[idx++] = 0x00000044; + decrypt_last_ref_0[idx++] = 0x000000c4; + decrypt_last_ref_0[idx++] = 0x000000de; + decrypt_last_ref_0[idx++] = 0x000000e9; + decrypt_last_ref_0[idx++] = 0x000000cb; + decrypt_last_ref_0[idx++] = 0x00000054; + decrypt_last_ref_0[idx++] = 0x0000007b; + decrypt_last_ref_0[idx++] = 0x00000094; + decrypt_last_ref_0[idx++] = 0x00000032; + decrypt_last_ref_0[idx++] = 0x000000a6; + decrypt_last_ref_0[idx++] = 0x000000c2; + decrypt_last_ref_0[idx++] = 0x00000023; + decrypt_last_ref_0[idx++] = 0x0000003d; + decrypt_last_ref_0[idx++] = 0x000000ee; + decrypt_last_ref_0[idx++] = 0x0000004c; + decrypt_last_ref_0[idx++] = 0x00000095; + decrypt_last_ref_0[idx++] = 0x0000000b; + decrypt_last_ref_0[idx++] = 0x00000042; + decrypt_last_ref_0[idx++] = 0x000000fa; + decrypt_last_ref_0[idx++] = 0x000000c3; + decrypt_last_ref_0[idx++] = 0x0000004e; + decrypt_last_ref_0[idx++] = 0x00000008; + decrypt_last_ref_0[idx++] = 0x0000002e; + decrypt_last_ref_0[idx++] = 0x000000a1; + decrypt_last_ref_0[idx++] = 0x00000066; + decrypt_last_ref_0[idx++] = 0x00000028; + decrypt_last_ref_0[idx++] = 0x000000d9; + decrypt_last_ref_0[idx++] = 0x00000024; + decrypt_last_ref_0[idx++] = 0x000000b2; + decrypt_last_ref_0[idx++] = 0x00000076; + decrypt_last_ref_0[idx++] = 0x0000005b; + decrypt_last_ref_0[idx++] = 0x000000a2; + decrypt_last_ref_0[idx++] = 0x00000049; + decrypt_last_ref_0[idx++] = 0x0000006d; + decrypt_last_ref_0[idx++] = 0x0000008b; + decrypt_last_ref_0[idx++] = 0x000000d1; + decrypt_last_ref_0[idx++] = 0x00000025; + decrypt_last_ref_0[idx++] = 0x00000072; + decrypt_last_ref_0[idx++] = 0x000000f8; + decrypt_last_ref_0[idx++] = 0x000000f6; + decrypt_last_ref_0[idx++] = 0x00000064; + decrypt_last_ref_0[idx++] = 0x00000086; + decrypt_last_ref_0[idx++] = 0x00000068; + decrypt_last_ref_0[idx++] = 0x00000098; + decrypt_last_ref_0[idx++] = 0x00000016; + decrypt_last_ref_0[idx++] = 0x000000d4; + decrypt_last_ref_0[idx++] = 0x000000a4; + decrypt_last_ref_0[idx++] = 0x0000005c; + decrypt_last_ref_0[idx++] = 0x000000cc; + decrypt_last_ref_0[idx++] = 0x0000005d; + decrypt_last_ref_0[idx++] = 0x00000065; + decrypt_last_ref_0[idx++] = 0x000000b6; + decrypt_last_ref_0[idx++] = 0x00000092; + decrypt_last_ref_0[idx++] = 0x0000006c; + decrypt_last_ref_0[idx++] = 0x00000070; + decrypt_last_ref_0[idx++] = 0x00000048; + decrypt_last_ref_0[idx++] = 0x00000050; + decrypt_last_ref_0[idx++] = 0x000000fd; + decrypt_last_ref_0[idx++] = 0x000000ed; + decrypt_last_ref_0[idx++] = 0x000000b9; + decrypt_last_ref_0[idx++] = 0x000000da; + decrypt_last_ref_0[idx++] = 0x0000005e; + decrypt_last_ref_0[idx++] = 0x00000015; + decrypt_last_ref_0[idx++] = 0x00000046; + decrypt_last_ref_0[idx++] = 0x00000057; + decrypt_last_ref_0[idx++] = 0x000000a7; + decrypt_last_ref_0[idx++] = 0x0000008d; + decrypt_last_ref_0[idx++] = 0x0000009d; + decrypt_last_ref_0[idx++] = 0x00000084; + decrypt_last_ref_0[idx++] = 0x00000090; + decrypt_last_ref_0[idx++] = 0x000000d8; + decrypt_last_ref_0[idx++] = 0x000000ab; + decrypt_last_ref_0[idx++] = 0x00000000; + decrypt_last_ref_0[idx++] = 0x0000008c; + decrypt_last_ref_0[idx++] = 0x000000bc; + decrypt_last_ref_0[idx++] = 0x000000d3; + decrypt_last_ref_0[idx++] = 0x0000000a; + decrypt_last_ref_0[idx++] = 0x000000f7; + decrypt_last_ref_0[idx++] = 0x000000e4; + decrypt_last_ref_0[idx++] = 0x00000058; + decrypt_last_ref_0[idx++] = 0x00000005; + decrypt_last_ref_0[idx++] = 0x000000b8; + decrypt_last_ref_0[idx++] = 0x000000b3; + decrypt_last_ref_0[idx++] = 0x00000045; + decrypt_last_ref_0[idx++] = 0x00000006; + decrypt_last_ref_0[idx++] = 0x000000d0; + decrypt_last_ref_0[idx++] = 0x0000002c; + decrypt_last_ref_0[idx++] = 0x0000001e; + decrypt_last_ref_0[idx++] = 0x0000008f; + decrypt_last_ref_0[idx++] = 0x000000ca; + decrypt_last_ref_0[idx++] = 0x0000003f; + decrypt_last_ref_0[idx++] = 0x0000000f; + decrypt_last_ref_0[idx++] = 0x00000002; + decrypt_last_ref_0[idx++] = 0x000000c1; + decrypt_last_ref_0[idx++] = 0x000000af; + decrypt_last_ref_0[idx++] = 0x000000bd; + decrypt_last_ref_0[idx++] = 0x00000003; + decrypt_last_ref_0[idx++] = 0x00000001; + decrypt_last_ref_0[idx++] = 0x00000013; + decrypt_last_ref_0[idx++] = 0x0000008a; + decrypt_last_ref_0[idx++] = 0x0000006b; + decrypt_last_ref_0[idx++] = 0x0000003a; + decrypt_last_ref_0[idx++] = 0x00000091; + decrypt_last_ref_0[idx++] = 0x00000011; + decrypt_last_ref_0[idx++] = 0x00000041; + decrypt_last_ref_0[idx++] = 0x0000004f; + decrypt_last_ref_0[idx++] = 0x00000067; + decrypt_last_ref_0[idx++] = 0x000000dc; + decrypt_last_ref_0[idx++] = 0x000000ea; + decrypt_last_ref_0[idx++] = 0x00000097; + decrypt_last_ref_0[idx++] = 0x000000f2; + decrypt_last_ref_0[idx++] = 0x000000cf; + decrypt_last_ref_0[idx++] = 0x000000ce; + decrypt_last_ref_0[idx++] = 0x000000f0; + decrypt_last_ref_0[idx++] = 0x000000b4; + decrypt_last_ref_0[idx++] = 0x000000e6; + decrypt_last_ref_0[idx++] = 0x00000073; + decrypt_last_ref_0[idx++] = 0x00000096; + decrypt_last_ref_0[idx++] = 0x000000ac; + decrypt_last_ref_0[idx++] = 0x00000074; + decrypt_last_ref_0[idx++] = 0x00000022; + decrypt_last_ref_0[idx++] = 0x000000e7; + decrypt_last_ref_0[idx++] = 0x000000ad; + decrypt_last_ref_0[idx++] = 0x00000035; + decrypt_last_ref_0[idx++] = 0x00000085; + decrypt_last_ref_0[idx++] = 0x000000e2; + decrypt_last_ref_0[idx++] = 0x000000f9; + decrypt_last_ref_0[idx++] = 0x00000037; + decrypt_last_ref_0[idx++] = 0x000000e8; + decrypt_last_ref_0[idx++] = 0x0000001c; + decrypt_last_ref_0[idx++] = 0x00000075; + decrypt_last_ref_0[idx++] = 0x000000df; + decrypt_last_ref_0[idx++] = 0x0000006e; + decrypt_last_ref_0[idx++] = 0x00000047; + decrypt_last_ref_0[idx++] = 0x000000f1; + decrypt_last_ref_0[idx++] = 0x0000001a; + decrypt_last_ref_0[idx++] = 0x00000071; + decrypt_last_ref_0[idx++] = 0x0000001d; + decrypt_last_ref_0[idx++] = 0x00000029; + decrypt_last_ref_0[idx++] = 0x000000c5; + decrypt_last_ref_0[idx++] = 0x00000089; + decrypt_last_ref_0[idx++] = 0x0000006f; + decrypt_last_ref_0[idx++] = 0x000000b7; + decrypt_last_ref_0[idx++] = 0x00000062; + decrypt_last_ref_0[idx++] = 0x0000000e; + decrypt_last_ref_0[idx++] = 0x000000aa; + decrypt_last_ref_0[idx++] = 0x00000018; + decrypt_last_ref_0[idx++] = 0x000000be; + decrypt_last_ref_0[idx++] = 0x0000001b; + decrypt_last_ref_0[idx++] = 0x000000fc; + decrypt_last_ref_0[idx++] = 0x00000056; + decrypt_last_ref_0[idx++] = 0x0000003e; + decrypt_last_ref_0[idx++] = 0x0000004b; + decrypt_last_ref_0[idx++] = 0x000000c6; + decrypt_last_ref_0[idx++] = 0x000000d2; + decrypt_last_ref_0[idx++] = 0x00000079; + decrypt_last_ref_0[idx++] = 0x00000020; + decrypt_last_ref_0[idx++] = 0x0000009a; + decrypt_last_ref_0[idx++] = 0x000000db; + decrypt_last_ref_0[idx++] = 0x000000c0; + decrypt_last_ref_0[idx++] = 0x000000fe; + decrypt_last_ref_0[idx++] = 0x00000078; + decrypt_last_ref_0[idx++] = 0x000000cd; + decrypt_last_ref_0[idx++] = 0x0000005a; + decrypt_last_ref_0[idx++] = 0x000000f4; + decrypt_last_ref_0[idx++] = 0x0000001f; + decrypt_last_ref_0[idx++] = 0x000000dd; + decrypt_last_ref_0[idx++] = 0x000000a8; + decrypt_last_ref_0[idx++] = 0x00000033; + decrypt_last_ref_0[idx++] = 0x00000088; + decrypt_last_ref_0[idx++] = 0x00000007; + decrypt_last_ref_0[idx++] = 0x000000c7; + decrypt_last_ref_0[idx++] = 0x00000031; + decrypt_last_ref_0[idx++] = 0x000000b1; + decrypt_last_ref_0[idx++] = 0x00000012; + decrypt_last_ref_0[idx++] = 0x00000010; + decrypt_last_ref_0[idx++] = 0x00000059; + decrypt_last_ref_0[idx++] = 0x00000027; + decrypt_last_ref_0[idx++] = 0x00000080; + decrypt_last_ref_0[idx++] = 0x000000ec; + decrypt_last_ref_0[idx++] = 0x0000005f; + decrypt_last_ref_0[idx++] = 0x00000060; + decrypt_last_ref_0[idx++] = 0x00000051; + decrypt_last_ref_0[idx++] = 0x0000007f; + decrypt_last_ref_0[idx++] = 0x000000a9; + decrypt_last_ref_0[idx++] = 0x00000019; + decrypt_last_ref_0[idx++] = 0x000000b5; + decrypt_last_ref_0[idx++] = 0x0000004a; + decrypt_last_ref_0[idx++] = 0x0000000d; + decrypt_last_ref_0[idx++] = 0x0000002d; + decrypt_last_ref_0[idx++] = 0x000000e5; + decrypt_last_ref_0[idx++] = 0x0000007a; + decrypt_last_ref_0[idx++] = 0x0000009f; + decrypt_last_ref_0[idx++] = 0x00000093; + decrypt_last_ref_0[idx++] = 0x000000c9; + decrypt_last_ref_0[idx++] = 0x0000009c; + decrypt_last_ref_0[idx++] = 0x000000ef; + decrypt_last_ref_0[idx++] = 0x000000a0; + decrypt_last_ref_0[idx++] = 0x000000e0; + decrypt_last_ref_0[idx++] = 0x0000003b; + decrypt_last_ref_0[idx++] = 0x0000004d; + decrypt_last_ref_0[idx++] = 0x000000ae; + decrypt_last_ref_0[idx++] = 0x0000002a; + decrypt_last_ref_0[idx++] = 0x000000f5; + decrypt_last_ref_0[idx++] = 0x000000b0; + decrypt_last_ref_0[idx++] = 0x000000c8; + decrypt_last_ref_0[idx++] = 0x000000eb; + decrypt_last_ref_0[idx++] = 0x000000bb; + decrypt_last_ref_0[idx++] = 0x0000003c; + decrypt_last_ref_0[idx++] = 0x00000083; + decrypt_last_ref_0[idx++] = 0x00000053; + decrypt_last_ref_0[idx++] = 0x00000099; + decrypt_last_ref_0[idx++] = 0x00000061; + decrypt_last_ref_0[idx++] = 0x00000017; + decrypt_last_ref_0[idx++] = 0x0000002b; + decrypt_last_ref_0[idx++] = 0x00000004; + decrypt_last_ref_0[idx++] = 0x0000007e; + decrypt_last_ref_0[idx++] = 0x000000ba; + decrypt_last_ref_0[idx++] = 0x00000077; + decrypt_last_ref_0[idx++] = 0x000000d6; + decrypt_last_ref_0[idx++] = 0x00000026; + decrypt_last_ref_0[idx++] = 0x000000e1; + decrypt_last_ref_0[idx++] = 0x00000069; + decrypt_last_ref_0[idx++] = 0x00000014; + decrypt_last_ref_0[idx++] = 0x00000063; + decrypt_last_ref_0[idx++] = 0x00000055; + decrypt_last_ref_0[idx++] = 0x00000021; + decrypt_last_ref_0[idx++] = 0x0000000c; + decrypt_last_ref_0[idx++] = 0x0000007d; + + idx = 0; + decrypt_last_ref_1[idx++] = 0x00005200; + decrypt_last_ref_1[idx++] = 0x00000900; + decrypt_last_ref_1[idx++] = 0x00006a00; + decrypt_last_ref_1[idx++] = 0x0000d500; + decrypt_last_ref_1[idx++] = 0x00003000; + decrypt_last_ref_1[idx++] = 0x00003600; + decrypt_last_ref_1[idx++] = 0x0000a500; + decrypt_last_ref_1[idx++] = 0x00003800; + decrypt_last_ref_1[idx++] = 0x0000bf00; + decrypt_last_ref_1[idx++] = 0x00004000; + decrypt_last_ref_1[idx++] = 0x0000a300; + decrypt_last_ref_1[idx++] = 0x00009e00; + decrypt_last_ref_1[idx++] = 0x00008100; + decrypt_last_ref_1[idx++] = 0x0000f300; + decrypt_last_ref_1[idx++] = 0x0000d700; + decrypt_last_ref_1[idx++] = 0x0000fb00; + decrypt_last_ref_1[idx++] = 0x00007c00; + decrypt_last_ref_1[idx++] = 0x0000e300; + decrypt_last_ref_1[idx++] = 0x00003900; + decrypt_last_ref_1[idx++] = 0x00008200; + decrypt_last_ref_1[idx++] = 0x00009b00; + decrypt_last_ref_1[idx++] = 0x00002f00; + decrypt_last_ref_1[idx++] = 0x0000ff00; + decrypt_last_ref_1[idx++] = 0x00008700; + decrypt_last_ref_1[idx++] = 0x00003400; + decrypt_last_ref_1[idx++] = 0x00008e00; + decrypt_last_ref_1[idx++] = 0x00004300; + decrypt_last_ref_1[idx++] = 0x00004400; + decrypt_last_ref_1[idx++] = 0x0000c400; + decrypt_last_ref_1[idx++] = 0x0000de00; + decrypt_last_ref_1[idx++] = 0x0000e900; + decrypt_last_ref_1[idx++] = 0x0000cb00; + decrypt_last_ref_1[idx++] = 0x00005400; + decrypt_last_ref_1[idx++] = 0x00007b00; + decrypt_last_ref_1[idx++] = 0x00009400; + decrypt_last_ref_1[idx++] = 0x00003200; + decrypt_last_ref_1[idx++] = 0x0000a600; + decrypt_last_ref_1[idx++] = 0x0000c200; + decrypt_last_ref_1[idx++] = 0x00002300; + decrypt_last_ref_1[idx++] = 0x00003d00; + decrypt_last_ref_1[idx++] = 0x0000ee00; + decrypt_last_ref_1[idx++] = 0x00004c00; + decrypt_last_ref_1[idx++] = 0x00009500; + decrypt_last_ref_1[idx++] = 0x00000b00; + decrypt_last_ref_1[idx++] = 0x00004200; + decrypt_last_ref_1[idx++] = 0x0000fa00; + decrypt_last_ref_1[idx++] = 0x0000c300; + decrypt_last_ref_1[idx++] = 0x00004e00; + decrypt_last_ref_1[idx++] = 0x00000800; + decrypt_last_ref_1[idx++] = 0x00002e00; + decrypt_last_ref_1[idx++] = 0x0000a100; + decrypt_last_ref_1[idx++] = 0x00006600; + decrypt_last_ref_1[idx++] = 0x00002800; + decrypt_last_ref_1[idx++] = 0x0000d900; + decrypt_last_ref_1[idx++] = 0x00002400; + decrypt_last_ref_1[idx++] = 0x0000b200; + decrypt_last_ref_1[idx++] = 0x00007600; + decrypt_last_ref_1[idx++] = 0x00005b00; + decrypt_last_ref_1[idx++] = 0x0000a200; + decrypt_last_ref_1[idx++] = 0x00004900; + decrypt_last_ref_1[idx++] = 0x00006d00; + decrypt_last_ref_1[idx++] = 0x00008b00; + decrypt_last_ref_1[idx++] = 0x0000d100; + decrypt_last_ref_1[idx++] = 0x00002500; + decrypt_last_ref_1[idx++] = 0x00007200; + decrypt_last_ref_1[idx++] = 0x0000f800; + decrypt_last_ref_1[idx++] = 0x0000f600; + decrypt_last_ref_1[idx++] = 0x00006400; + decrypt_last_ref_1[idx++] = 0x00008600; + decrypt_last_ref_1[idx++] = 0x00006800; + decrypt_last_ref_1[idx++] = 0x00009800; + decrypt_last_ref_1[idx++] = 0x00001600; + decrypt_last_ref_1[idx++] = 0x0000d400; + decrypt_last_ref_1[idx++] = 0x0000a400; + decrypt_last_ref_1[idx++] = 0x00005c00; + decrypt_last_ref_1[idx++] = 0x0000cc00; + decrypt_last_ref_1[idx++] = 0x00005d00; + decrypt_last_ref_1[idx++] = 0x00006500; + decrypt_last_ref_1[idx++] = 0x0000b600; + decrypt_last_ref_1[idx++] = 0x00009200; + decrypt_last_ref_1[idx++] = 0x00006c00; + decrypt_last_ref_1[idx++] = 0x00007000; + decrypt_last_ref_1[idx++] = 0x00004800; + decrypt_last_ref_1[idx++] = 0x00005000; + decrypt_last_ref_1[idx++] = 0x0000fd00; + decrypt_last_ref_1[idx++] = 0x0000ed00; + decrypt_last_ref_1[idx++] = 0x0000b900; + decrypt_last_ref_1[idx++] = 0x0000da00; + decrypt_last_ref_1[idx++] = 0x00005e00; + decrypt_last_ref_1[idx++] = 0x00001500; + decrypt_last_ref_1[idx++] = 0x00004600; + decrypt_last_ref_1[idx++] = 0x00005700; + decrypt_last_ref_1[idx++] = 0x0000a700; + decrypt_last_ref_1[idx++] = 0x00008d00; + decrypt_last_ref_1[idx++] = 0x00009d00; + decrypt_last_ref_1[idx++] = 0x00008400; + decrypt_last_ref_1[idx++] = 0x00009000; + decrypt_last_ref_1[idx++] = 0x0000d800; + decrypt_last_ref_1[idx++] = 0x0000ab00; + decrypt_last_ref_1[idx++] = 0x00000000; + decrypt_last_ref_1[idx++] = 0x00008c00; + decrypt_last_ref_1[idx++] = 0x0000bc00; + decrypt_last_ref_1[idx++] = 0x0000d300; + decrypt_last_ref_1[idx++] = 0x00000a00; + decrypt_last_ref_1[idx++] = 0x0000f700; + decrypt_last_ref_1[idx++] = 0x0000e400; + decrypt_last_ref_1[idx++] = 0x00005800; + decrypt_last_ref_1[idx++] = 0x00000500; + decrypt_last_ref_1[idx++] = 0x0000b800; + decrypt_last_ref_1[idx++] = 0x0000b300; + decrypt_last_ref_1[idx++] = 0x00004500; + decrypt_last_ref_1[idx++] = 0x00000600; + decrypt_last_ref_1[idx++] = 0x0000d000; + decrypt_last_ref_1[idx++] = 0x00002c00; + decrypt_last_ref_1[idx++] = 0x00001e00; + decrypt_last_ref_1[idx++] = 0x00008f00; + decrypt_last_ref_1[idx++] = 0x0000ca00; + decrypt_last_ref_1[idx++] = 0x00003f00; + decrypt_last_ref_1[idx++] = 0x00000f00; + decrypt_last_ref_1[idx++] = 0x00000200; + decrypt_last_ref_1[idx++] = 0x0000c100; + decrypt_last_ref_1[idx++] = 0x0000af00; + decrypt_last_ref_1[idx++] = 0x0000bd00; + decrypt_last_ref_1[idx++] = 0x00000300; + decrypt_last_ref_1[idx++] = 0x00000100; + decrypt_last_ref_1[idx++] = 0x00001300; + decrypt_last_ref_1[idx++] = 0x00008a00; + decrypt_last_ref_1[idx++] = 0x00006b00; + decrypt_last_ref_1[idx++] = 0x00003a00; + decrypt_last_ref_1[idx++] = 0x00009100; + decrypt_last_ref_1[idx++] = 0x00001100; + decrypt_last_ref_1[idx++] = 0x00004100; + decrypt_last_ref_1[idx++] = 0x00004f00; + decrypt_last_ref_1[idx++] = 0x00006700; + decrypt_last_ref_1[idx++] = 0x0000dc00; + decrypt_last_ref_1[idx++] = 0x0000ea00; + decrypt_last_ref_1[idx++] = 0x00009700; + decrypt_last_ref_1[idx++] = 0x0000f200; + decrypt_last_ref_1[idx++] = 0x0000cf00; + decrypt_last_ref_1[idx++] = 0x0000ce00; + decrypt_last_ref_1[idx++] = 0x0000f000; + decrypt_last_ref_1[idx++] = 0x0000b400; + decrypt_last_ref_1[idx++] = 0x0000e600; + decrypt_last_ref_1[idx++] = 0x00007300; + decrypt_last_ref_1[idx++] = 0x00009600; + decrypt_last_ref_1[idx++] = 0x0000ac00; + decrypt_last_ref_1[idx++] = 0x00007400; + decrypt_last_ref_1[idx++] = 0x00002200; + decrypt_last_ref_1[idx++] = 0x0000e700; + decrypt_last_ref_1[idx++] = 0x0000ad00; + decrypt_last_ref_1[idx++] = 0x00003500; + decrypt_last_ref_1[idx++] = 0x00008500; + decrypt_last_ref_1[idx++] = 0x0000e200; + decrypt_last_ref_1[idx++] = 0x0000f900; + decrypt_last_ref_1[idx++] = 0x00003700; + decrypt_last_ref_1[idx++] = 0x0000e800; + decrypt_last_ref_1[idx++] = 0x00001c00; + decrypt_last_ref_1[idx++] = 0x00007500; + decrypt_last_ref_1[idx++] = 0x0000df00; + decrypt_last_ref_1[idx++] = 0x00006e00; + decrypt_last_ref_1[idx++] = 0x00004700; + decrypt_last_ref_1[idx++] = 0x0000f100; + decrypt_last_ref_1[idx++] = 0x00001a00; + decrypt_last_ref_1[idx++] = 0x00007100; + decrypt_last_ref_1[idx++] = 0x00001d00; + decrypt_last_ref_1[idx++] = 0x00002900; + decrypt_last_ref_1[idx++] = 0x0000c500; + decrypt_last_ref_1[idx++] = 0x00008900; + decrypt_last_ref_1[idx++] = 0x00006f00; + decrypt_last_ref_1[idx++] = 0x0000b700; + decrypt_last_ref_1[idx++] = 0x00006200; + decrypt_last_ref_1[idx++] = 0x00000e00; + decrypt_last_ref_1[idx++] = 0x0000aa00; + decrypt_last_ref_1[idx++] = 0x00001800; + decrypt_last_ref_1[idx++] = 0x0000be00; + decrypt_last_ref_1[idx++] = 0x00001b00; + decrypt_last_ref_1[idx++] = 0x0000fc00; + decrypt_last_ref_1[idx++] = 0x00005600; + decrypt_last_ref_1[idx++] = 0x00003e00; + decrypt_last_ref_1[idx++] = 0x00004b00; + decrypt_last_ref_1[idx++] = 0x0000c600; + decrypt_last_ref_1[idx++] = 0x0000d200; + decrypt_last_ref_1[idx++] = 0x00007900; + decrypt_last_ref_1[idx++] = 0x00002000; + decrypt_last_ref_1[idx++] = 0x00009a00; + decrypt_last_ref_1[idx++] = 0x0000db00; + decrypt_last_ref_1[idx++] = 0x0000c000; + decrypt_last_ref_1[idx++] = 0x0000fe00; + decrypt_last_ref_1[idx++] = 0x00007800; + decrypt_last_ref_1[idx++] = 0x0000cd00; + decrypt_last_ref_1[idx++] = 0x00005a00; + decrypt_last_ref_1[idx++] = 0x0000f400; + decrypt_last_ref_1[idx++] = 0x00001f00; + decrypt_last_ref_1[idx++] = 0x0000dd00; + decrypt_last_ref_1[idx++] = 0x0000a800; + decrypt_last_ref_1[idx++] = 0x00003300; + decrypt_last_ref_1[idx++] = 0x00008800; + decrypt_last_ref_1[idx++] = 0x00000700; + decrypt_last_ref_1[idx++] = 0x0000c700; + decrypt_last_ref_1[idx++] = 0x00003100; + decrypt_last_ref_1[idx++] = 0x0000b100; + decrypt_last_ref_1[idx++] = 0x00001200; + decrypt_last_ref_1[idx++] = 0x00001000; + decrypt_last_ref_1[idx++] = 0x00005900; + decrypt_last_ref_1[idx++] = 0x00002700; + decrypt_last_ref_1[idx++] = 0x00008000; + decrypt_last_ref_1[idx++] = 0x0000ec00; + decrypt_last_ref_1[idx++] = 0x00005f00; + decrypt_last_ref_1[idx++] = 0x00006000; + decrypt_last_ref_1[idx++] = 0x00005100; + decrypt_last_ref_1[idx++] = 0x00007f00; + decrypt_last_ref_1[idx++] = 0x0000a900; + decrypt_last_ref_1[idx++] = 0x00001900; + decrypt_last_ref_1[idx++] = 0x0000b500; + decrypt_last_ref_1[idx++] = 0x00004a00; + decrypt_last_ref_1[idx++] = 0x00000d00; + decrypt_last_ref_1[idx++] = 0x00002d00; + decrypt_last_ref_1[idx++] = 0x0000e500; + decrypt_last_ref_1[idx++] = 0x00007a00; + decrypt_last_ref_1[idx++] = 0x00009f00; + decrypt_last_ref_1[idx++] = 0x00009300; + decrypt_last_ref_1[idx++] = 0x0000c900; + decrypt_last_ref_1[idx++] = 0x00009c00; + decrypt_last_ref_1[idx++] = 0x0000ef00; + decrypt_last_ref_1[idx++] = 0x0000a000; + decrypt_last_ref_1[idx++] = 0x0000e000; + decrypt_last_ref_1[idx++] = 0x00003b00; + decrypt_last_ref_1[idx++] = 0x00004d00; + decrypt_last_ref_1[idx++] = 0x0000ae00; + decrypt_last_ref_1[idx++] = 0x00002a00; + decrypt_last_ref_1[idx++] = 0x0000f500; + decrypt_last_ref_1[idx++] = 0x0000b000; + decrypt_last_ref_1[idx++] = 0x0000c800; + decrypt_last_ref_1[idx++] = 0x0000eb00; + decrypt_last_ref_1[idx++] = 0x0000bb00; + decrypt_last_ref_1[idx++] = 0x00003c00; + decrypt_last_ref_1[idx++] = 0x00008300; + decrypt_last_ref_1[idx++] = 0x00005300; + decrypt_last_ref_1[idx++] = 0x00009900; + decrypt_last_ref_1[idx++] = 0x00006100; + decrypt_last_ref_1[idx++] = 0x00001700; + decrypt_last_ref_1[idx++] = 0x00002b00; + decrypt_last_ref_1[idx++] = 0x00000400; + decrypt_last_ref_1[idx++] = 0x00007e00; + decrypt_last_ref_1[idx++] = 0x0000ba00; + decrypt_last_ref_1[idx++] = 0x00007700; + decrypt_last_ref_1[idx++] = 0x0000d600; + decrypt_last_ref_1[idx++] = 0x00002600; + decrypt_last_ref_1[idx++] = 0x0000e100; + decrypt_last_ref_1[idx++] = 0x00006900; + decrypt_last_ref_1[idx++] = 0x00001400; + decrypt_last_ref_1[idx++] = 0x00006300; + decrypt_last_ref_1[idx++] = 0x00005500; + decrypt_last_ref_1[idx++] = 0x00002100; + decrypt_last_ref_1[idx++] = 0x00000c00; + decrypt_last_ref_1[idx++] = 0x00007d00; + + idx = 0; + decrypt_last_ref_2[idx++] = 0x00520000; + decrypt_last_ref_2[idx++] = 0x00090000; + decrypt_last_ref_2[idx++] = 0x006a0000; + decrypt_last_ref_2[idx++] = 0x00d50000; + decrypt_last_ref_2[idx++] = 0x00300000; + decrypt_last_ref_2[idx++] = 0x00360000; + decrypt_last_ref_2[idx++] = 0x00a50000; + decrypt_last_ref_2[idx++] = 0x00380000; + decrypt_last_ref_2[idx++] = 0x00bf0000; + decrypt_last_ref_2[idx++] = 0x00400000; + decrypt_last_ref_2[idx++] = 0x00a30000; + decrypt_last_ref_2[idx++] = 0x009e0000; + decrypt_last_ref_2[idx++] = 0x00810000; + decrypt_last_ref_2[idx++] = 0x00f30000; + decrypt_last_ref_2[idx++] = 0x00d70000; + decrypt_last_ref_2[idx++] = 0x00fb0000; + decrypt_last_ref_2[idx++] = 0x007c0000; + decrypt_last_ref_2[idx++] = 0x00e30000; + decrypt_last_ref_2[idx++] = 0x00390000; + decrypt_last_ref_2[idx++] = 0x00820000; + decrypt_last_ref_2[idx++] = 0x009b0000; + decrypt_last_ref_2[idx++] = 0x002f0000; + decrypt_last_ref_2[idx++] = 0x00ff0000; + decrypt_last_ref_2[idx++] = 0x00870000; + decrypt_last_ref_2[idx++] = 0x00340000; + decrypt_last_ref_2[idx++] = 0x008e0000; + decrypt_last_ref_2[idx++] = 0x00430000; + decrypt_last_ref_2[idx++] = 0x00440000; + decrypt_last_ref_2[idx++] = 0x00c40000; + decrypt_last_ref_2[idx++] = 0x00de0000; + decrypt_last_ref_2[idx++] = 0x00e90000; + decrypt_last_ref_2[idx++] = 0x00cb0000; + decrypt_last_ref_2[idx++] = 0x00540000; + decrypt_last_ref_2[idx++] = 0x007b0000; + decrypt_last_ref_2[idx++] = 0x00940000; + decrypt_last_ref_2[idx++] = 0x00320000; + decrypt_last_ref_2[idx++] = 0x00a60000; + decrypt_last_ref_2[idx++] = 0x00c20000; + decrypt_last_ref_2[idx++] = 0x00230000; + decrypt_last_ref_2[idx++] = 0x003d0000; + decrypt_last_ref_2[idx++] = 0x00ee0000; + decrypt_last_ref_2[idx++] = 0x004c0000; + decrypt_last_ref_2[idx++] = 0x00950000; + decrypt_last_ref_2[idx++] = 0x000b0000; + decrypt_last_ref_2[idx++] = 0x00420000; + decrypt_last_ref_2[idx++] = 0x00fa0000; + decrypt_last_ref_2[idx++] = 0x00c30000; + decrypt_last_ref_2[idx++] = 0x004e0000; + decrypt_last_ref_2[idx++] = 0x00080000; + decrypt_last_ref_2[idx++] = 0x002e0000; + decrypt_last_ref_2[idx++] = 0x00a10000; + decrypt_last_ref_2[idx++] = 0x00660000; + decrypt_last_ref_2[idx++] = 0x00280000; + decrypt_last_ref_2[idx++] = 0x00d90000; + decrypt_last_ref_2[idx++] = 0x00240000; + decrypt_last_ref_2[idx++] = 0x00b20000; + decrypt_last_ref_2[idx++] = 0x00760000; + decrypt_last_ref_2[idx++] = 0x005b0000; + decrypt_last_ref_2[idx++] = 0x00a20000; + decrypt_last_ref_2[idx++] = 0x00490000; + decrypt_last_ref_2[idx++] = 0x006d0000; + decrypt_last_ref_2[idx++] = 0x008b0000; + decrypt_last_ref_2[idx++] = 0x00d10000; + decrypt_last_ref_2[idx++] = 0x00250000; + decrypt_last_ref_2[idx++] = 0x00720000; + decrypt_last_ref_2[idx++] = 0x00f80000; + decrypt_last_ref_2[idx++] = 0x00f60000; + decrypt_last_ref_2[idx++] = 0x00640000; + decrypt_last_ref_2[idx++] = 0x00860000; + decrypt_last_ref_2[idx++] = 0x00680000; + decrypt_last_ref_2[idx++] = 0x00980000; + decrypt_last_ref_2[idx++] = 0x00160000; + decrypt_last_ref_2[idx++] = 0x00d40000; + decrypt_last_ref_2[idx++] = 0x00a40000; + decrypt_last_ref_2[idx++] = 0x005c0000; + decrypt_last_ref_2[idx++] = 0x00cc0000; + decrypt_last_ref_2[idx++] = 0x005d0000; + decrypt_last_ref_2[idx++] = 0x00650000; + decrypt_last_ref_2[idx++] = 0x00b60000; + decrypt_last_ref_2[idx++] = 0x00920000; + decrypt_last_ref_2[idx++] = 0x006c0000; + decrypt_last_ref_2[idx++] = 0x00700000; + decrypt_last_ref_2[idx++] = 0x00480000; + decrypt_last_ref_2[idx++] = 0x00500000; + decrypt_last_ref_2[idx++] = 0x00fd0000; + decrypt_last_ref_2[idx++] = 0x00ed0000; + decrypt_last_ref_2[idx++] = 0x00b90000; + decrypt_last_ref_2[idx++] = 0x00da0000; + decrypt_last_ref_2[idx++] = 0x005e0000; + decrypt_last_ref_2[idx++] = 0x00150000; + decrypt_last_ref_2[idx++] = 0x00460000; + decrypt_last_ref_2[idx++] = 0x00570000; + decrypt_last_ref_2[idx++] = 0x00a70000; + decrypt_last_ref_2[idx++] = 0x008d0000; + decrypt_last_ref_2[idx++] = 0x009d0000; + decrypt_last_ref_2[idx++] = 0x00840000; + decrypt_last_ref_2[idx++] = 0x00900000; + decrypt_last_ref_2[idx++] = 0x00d80000; + decrypt_last_ref_2[idx++] = 0x00ab0000; + decrypt_last_ref_2[idx++] = 0x00000000; + decrypt_last_ref_2[idx++] = 0x008c0000; + decrypt_last_ref_2[idx++] = 0x00bc0000; + decrypt_last_ref_2[idx++] = 0x00d30000; + decrypt_last_ref_2[idx++] = 0x000a0000; + decrypt_last_ref_2[idx++] = 0x00f70000; + decrypt_last_ref_2[idx++] = 0x00e40000; + decrypt_last_ref_2[idx++] = 0x00580000; + decrypt_last_ref_2[idx++] = 0x00050000; + decrypt_last_ref_2[idx++] = 0x00b80000; + decrypt_last_ref_2[idx++] = 0x00b30000; + decrypt_last_ref_2[idx++] = 0x00450000; + decrypt_last_ref_2[idx++] = 0x00060000; + decrypt_last_ref_2[idx++] = 0x00d00000; + decrypt_last_ref_2[idx++] = 0x002c0000; + decrypt_last_ref_2[idx++] = 0x001e0000; + decrypt_last_ref_2[idx++] = 0x008f0000; + decrypt_last_ref_2[idx++] = 0x00ca0000; + decrypt_last_ref_2[idx++] = 0x003f0000; + decrypt_last_ref_2[idx++] = 0x000f0000; + decrypt_last_ref_2[idx++] = 0x00020000; + decrypt_last_ref_2[idx++] = 0x00c10000; + decrypt_last_ref_2[idx++] = 0x00af0000; + decrypt_last_ref_2[idx++] = 0x00bd0000; + decrypt_last_ref_2[idx++] = 0x00030000; + decrypt_last_ref_2[idx++] = 0x00010000; + decrypt_last_ref_2[idx++] = 0x00130000; + decrypt_last_ref_2[idx++] = 0x008a0000; + decrypt_last_ref_2[idx++] = 0x006b0000; + decrypt_last_ref_2[idx++] = 0x003a0000; + decrypt_last_ref_2[idx++] = 0x00910000; + decrypt_last_ref_2[idx++] = 0x00110000; + decrypt_last_ref_2[idx++] = 0x00410000; + decrypt_last_ref_2[idx++] = 0x004f0000; + decrypt_last_ref_2[idx++] = 0x00670000; + decrypt_last_ref_2[idx++] = 0x00dc0000; + decrypt_last_ref_2[idx++] = 0x00ea0000; + decrypt_last_ref_2[idx++] = 0x00970000; + decrypt_last_ref_2[idx++] = 0x00f20000; + decrypt_last_ref_2[idx++] = 0x00cf0000; + decrypt_last_ref_2[idx++] = 0x00ce0000; + decrypt_last_ref_2[idx++] = 0x00f00000; + decrypt_last_ref_2[idx++] = 0x00b40000; + decrypt_last_ref_2[idx++] = 0x00e60000; + decrypt_last_ref_2[idx++] = 0x00730000; + decrypt_last_ref_2[idx++] = 0x00960000; + decrypt_last_ref_2[idx++] = 0x00ac0000; + decrypt_last_ref_2[idx++] = 0x00740000; + decrypt_last_ref_2[idx++] = 0x00220000; + decrypt_last_ref_2[idx++] = 0x00e70000; + decrypt_last_ref_2[idx++] = 0x00ad0000; + decrypt_last_ref_2[idx++] = 0x00350000; + decrypt_last_ref_2[idx++] = 0x00850000; + decrypt_last_ref_2[idx++] = 0x00e20000; + decrypt_last_ref_2[idx++] = 0x00f90000; + decrypt_last_ref_2[idx++] = 0x00370000; + decrypt_last_ref_2[idx++] = 0x00e80000; + decrypt_last_ref_2[idx++] = 0x001c0000; + decrypt_last_ref_2[idx++] = 0x00750000; + decrypt_last_ref_2[idx++] = 0x00df0000; + decrypt_last_ref_2[idx++] = 0x006e0000; + decrypt_last_ref_2[idx++] = 0x00470000; + decrypt_last_ref_2[idx++] = 0x00f10000; + decrypt_last_ref_2[idx++] = 0x001a0000; + decrypt_last_ref_2[idx++] = 0x00710000; + decrypt_last_ref_2[idx++] = 0x001d0000; + decrypt_last_ref_2[idx++] = 0x00290000; + decrypt_last_ref_2[idx++] = 0x00c50000; + decrypt_last_ref_2[idx++] = 0x00890000; + decrypt_last_ref_2[idx++] = 0x006f0000; + decrypt_last_ref_2[idx++] = 0x00b70000; + decrypt_last_ref_2[idx++] = 0x00620000; + decrypt_last_ref_2[idx++] = 0x000e0000; + decrypt_last_ref_2[idx++] = 0x00aa0000; + decrypt_last_ref_2[idx++] = 0x00180000; + decrypt_last_ref_2[idx++] = 0x00be0000; + decrypt_last_ref_2[idx++] = 0x001b0000; + decrypt_last_ref_2[idx++] = 0x00fc0000; + decrypt_last_ref_2[idx++] = 0x00560000; + decrypt_last_ref_2[idx++] = 0x003e0000; + decrypt_last_ref_2[idx++] = 0x004b0000; + decrypt_last_ref_2[idx++] = 0x00c60000; + decrypt_last_ref_2[idx++] = 0x00d20000; + decrypt_last_ref_2[idx++] = 0x00790000; + decrypt_last_ref_2[idx++] = 0x00200000; + decrypt_last_ref_2[idx++] = 0x009a0000; + decrypt_last_ref_2[idx++] = 0x00db0000; + decrypt_last_ref_2[idx++] = 0x00c00000; + decrypt_last_ref_2[idx++] = 0x00fe0000; + decrypt_last_ref_2[idx++] = 0x00780000; + decrypt_last_ref_2[idx++] = 0x00cd0000; + decrypt_last_ref_2[idx++] = 0x005a0000; + decrypt_last_ref_2[idx++] = 0x00f40000; + decrypt_last_ref_2[idx++] = 0x001f0000; + decrypt_last_ref_2[idx++] = 0x00dd0000; + decrypt_last_ref_2[idx++] = 0x00a80000; + decrypt_last_ref_2[idx++] = 0x00330000; + decrypt_last_ref_2[idx++] = 0x00880000; + decrypt_last_ref_2[idx++] = 0x00070000; + decrypt_last_ref_2[idx++] = 0x00c70000; + decrypt_last_ref_2[idx++] = 0x00310000; + decrypt_last_ref_2[idx++] = 0x00b10000; + decrypt_last_ref_2[idx++] = 0x00120000; + decrypt_last_ref_2[idx++] = 0x00100000; + decrypt_last_ref_2[idx++] = 0x00590000; + decrypt_last_ref_2[idx++] = 0x00270000; + decrypt_last_ref_2[idx++] = 0x00800000; + decrypt_last_ref_2[idx++] = 0x00ec0000; + decrypt_last_ref_2[idx++] = 0x005f0000; + decrypt_last_ref_2[idx++] = 0x00600000; + decrypt_last_ref_2[idx++] = 0x00510000; + decrypt_last_ref_2[idx++] = 0x007f0000; + decrypt_last_ref_2[idx++] = 0x00a90000; + decrypt_last_ref_2[idx++] = 0x00190000; + decrypt_last_ref_2[idx++] = 0x00b50000; + decrypt_last_ref_2[idx++] = 0x004a0000; + decrypt_last_ref_2[idx++] = 0x000d0000; + decrypt_last_ref_2[idx++] = 0x002d0000; + decrypt_last_ref_2[idx++] = 0x00e50000; + decrypt_last_ref_2[idx++] = 0x007a0000; + decrypt_last_ref_2[idx++] = 0x009f0000; + decrypt_last_ref_2[idx++] = 0x00930000; + decrypt_last_ref_2[idx++] = 0x00c90000; + decrypt_last_ref_2[idx++] = 0x009c0000; + decrypt_last_ref_2[idx++] = 0x00ef0000; + decrypt_last_ref_2[idx++] = 0x00a00000; + decrypt_last_ref_2[idx++] = 0x00e00000; + decrypt_last_ref_2[idx++] = 0x003b0000; + decrypt_last_ref_2[idx++] = 0x004d0000; + decrypt_last_ref_2[idx++] = 0x00ae0000; + decrypt_last_ref_2[idx++] = 0x002a0000; + decrypt_last_ref_2[idx++] = 0x00f50000; + decrypt_last_ref_2[idx++] = 0x00b00000; + decrypt_last_ref_2[idx++] = 0x00c80000; + decrypt_last_ref_2[idx++] = 0x00eb0000; + decrypt_last_ref_2[idx++] = 0x00bb0000; + decrypt_last_ref_2[idx++] = 0x003c0000; + decrypt_last_ref_2[idx++] = 0x00830000; + decrypt_last_ref_2[idx++] = 0x00530000; + decrypt_last_ref_2[idx++] = 0x00990000; + decrypt_last_ref_2[idx++] = 0x00610000; + decrypt_last_ref_2[idx++] = 0x00170000; + decrypt_last_ref_2[idx++] = 0x002b0000; + decrypt_last_ref_2[idx++] = 0x00040000; + decrypt_last_ref_2[idx++] = 0x007e0000; + decrypt_last_ref_2[idx++] = 0x00ba0000; + decrypt_last_ref_2[idx++] = 0x00770000; + decrypt_last_ref_2[idx++] = 0x00d60000; + decrypt_last_ref_2[idx++] = 0x00260000; + decrypt_last_ref_2[idx++] = 0x00e10000; + decrypt_last_ref_2[idx++] = 0x00690000; + decrypt_last_ref_2[idx++] = 0x00140000; + decrypt_last_ref_2[idx++] = 0x00630000; + decrypt_last_ref_2[idx++] = 0x00550000; + decrypt_last_ref_2[idx++] = 0x00210000; + decrypt_last_ref_2[idx++] = 0x000c0000; + decrypt_last_ref_2[idx++] = 0x007d0000; + + idx = 0; + decrypt_last_ref_3[idx++] = 0x52000000; + decrypt_last_ref_3[idx++] = 0x09000000; + decrypt_last_ref_3[idx++] = 0x6a000000; + decrypt_last_ref_3[idx++] = 0xd5000000; + decrypt_last_ref_3[idx++] = 0x30000000; + decrypt_last_ref_3[idx++] = 0x36000000; + decrypt_last_ref_3[idx++] = 0xa5000000; + decrypt_last_ref_3[idx++] = 0x38000000; + decrypt_last_ref_3[idx++] = 0xbf000000; + decrypt_last_ref_3[idx++] = 0x40000000; + decrypt_last_ref_3[idx++] = 0xa3000000; + decrypt_last_ref_3[idx++] = 0x9e000000; + decrypt_last_ref_3[idx++] = 0x81000000; + decrypt_last_ref_3[idx++] = 0xf3000000; + decrypt_last_ref_3[idx++] = 0xd7000000; + decrypt_last_ref_3[idx++] = 0xfb000000; + decrypt_last_ref_3[idx++] = 0x7c000000; + decrypt_last_ref_3[idx++] = 0xe3000000; + decrypt_last_ref_3[idx++] = 0x39000000; + decrypt_last_ref_3[idx++] = 0x82000000; + decrypt_last_ref_3[idx++] = 0x9b000000; + decrypt_last_ref_3[idx++] = 0x2f000000; + decrypt_last_ref_3[idx++] = 0xff000000; + decrypt_last_ref_3[idx++] = 0x87000000; + decrypt_last_ref_3[idx++] = 0x34000000; + decrypt_last_ref_3[idx++] = 0x8e000000; + decrypt_last_ref_3[idx++] = 0x43000000; + decrypt_last_ref_3[idx++] = 0x44000000; + decrypt_last_ref_3[idx++] = 0xc4000000; + decrypt_last_ref_3[idx++] = 0xde000000; + decrypt_last_ref_3[idx++] = 0xe9000000; + decrypt_last_ref_3[idx++] = 0xcb000000; + decrypt_last_ref_3[idx++] = 0x54000000; + decrypt_last_ref_3[idx++] = 0x7b000000; + decrypt_last_ref_3[idx++] = 0x94000000; + decrypt_last_ref_3[idx++] = 0x32000000; + decrypt_last_ref_3[idx++] = 0xa6000000; + decrypt_last_ref_3[idx++] = 0xc2000000; + decrypt_last_ref_3[idx++] = 0x23000000; + decrypt_last_ref_3[idx++] = 0x3d000000; + decrypt_last_ref_3[idx++] = 0xee000000; + decrypt_last_ref_3[idx++] = 0x4c000000; + decrypt_last_ref_3[idx++] = 0x95000000; + decrypt_last_ref_3[idx++] = 0x0b000000; + decrypt_last_ref_3[idx++] = 0x42000000; + decrypt_last_ref_3[idx++] = 0xfa000000; + decrypt_last_ref_3[idx++] = 0xc3000000; + decrypt_last_ref_3[idx++] = 0x4e000000; + decrypt_last_ref_3[idx++] = 0x08000000; + decrypt_last_ref_3[idx++] = 0x2e000000; + decrypt_last_ref_3[idx++] = 0xa1000000; + decrypt_last_ref_3[idx++] = 0x66000000; + decrypt_last_ref_3[idx++] = 0x28000000; + decrypt_last_ref_3[idx++] = 0xd9000000; + decrypt_last_ref_3[idx++] = 0x24000000; + decrypt_last_ref_3[idx++] = 0xb2000000; + decrypt_last_ref_3[idx++] = 0x76000000; + decrypt_last_ref_3[idx++] = 0x5b000000; + decrypt_last_ref_3[idx++] = 0xa2000000; + decrypt_last_ref_3[idx++] = 0x49000000; + decrypt_last_ref_3[idx++] = 0x6d000000; + decrypt_last_ref_3[idx++] = 0x8b000000; + decrypt_last_ref_3[idx++] = 0xd1000000; + decrypt_last_ref_3[idx++] = 0x25000000; + decrypt_last_ref_3[idx++] = 0x72000000; + decrypt_last_ref_3[idx++] = 0xf8000000; + decrypt_last_ref_3[idx++] = 0xf6000000; + decrypt_last_ref_3[idx++] = 0x64000000; + decrypt_last_ref_3[idx++] = 0x86000000; + decrypt_last_ref_3[idx++] = 0x68000000; + decrypt_last_ref_3[idx++] = 0x98000000; + decrypt_last_ref_3[idx++] = 0x16000000; + decrypt_last_ref_3[idx++] = 0xd4000000; + decrypt_last_ref_3[idx++] = 0xa4000000; + decrypt_last_ref_3[idx++] = 0x5c000000; + decrypt_last_ref_3[idx++] = 0xcc000000; + decrypt_last_ref_3[idx++] = 0x5d000000; + decrypt_last_ref_3[idx++] = 0x65000000; + decrypt_last_ref_3[idx++] = 0xb6000000; + decrypt_last_ref_3[idx++] = 0x92000000; + decrypt_last_ref_3[idx++] = 0x6c000000; + decrypt_last_ref_3[idx++] = 0x70000000; + decrypt_last_ref_3[idx++] = 0x48000000; + decrypt_last_ref_3[idx++] = 0x50000000; + decrypt_last_ref_3[idx++] = 0xfd000000; + decrypt_last_ref_3[idx++] = 0xed000000; + decrypt_last_ref_3[idx++] = 0xb9000000; + decrypt_last_ref_3[idx++] = 0xda000000; + decrypt_last_ref_3[idx++] = 0x5e000000; + decrypt_last_ref_3[idx++] = 0x15000000; + decrypt_last_ref_3[idx++] = 0x46000000; + decrypt_last_ref_3[idx++] = 0x57000000; + decrypt_last_ref_3[idx++] = 0xa7000000; + decrypt_last_ref_3[idx++] = 0x8d000000; + decrypt_last_ref_3[idx++] = 0x9d000000; + decrypt_last_ref_3[idx++] = 0x84000000; + decrypt_last_ref_3[idx++] = 0x90000000; + decrypt_last_ref_3[idx++] = 0xd8000000; + decrypt_last_ref_3[idx++] = 0xab000000; + decrypt_last_ref_3[idx++] = 0x00000000; + decrypt_last_ref_3[idx++] = 0x8c000000; + decrypt_last_ref_3[idx++] = 0xbc000000; + decrypt_last_ref_3[idx++] = 0xd3000000; + decrypt_last_ref_3[idx++] = 0x0a000000; + decrypt_last_ref_3[idx++] = 0xf7000000; + decrypt_last_ref_3[idx++] = 0xe4000000; + decrypt_last_ref_3[idx++] = 0x58000000; + decrypt_last_ref_3[idx++] = 0x05000000; + decrypt_last_ref_3[idx++] = 0xb8000000; + decrypt_last_ref_3[idx++] = 0xb3000000; + decrypt_last_ref_3[idx++] = 0x45000000; + decrypt_last_ref_3[idx++] = 0x06000000; + decrypt_last_ref_3[idx++] = 0xd0000000; + decrypt_last_ref_3[idx++] = 0x2c000000; + decrypt_last_ref_3[idx++] = 0x1e000000; + decrypt_last_ref_3[idx++] = 0x8f000000; + decrypt_last_ref_3[idx++] = 0xca000000; + decrypt_last_ref_3[idx++] = 0x3f000000; + decrypt_last_ref_3[idx++] = 0x0f000000; + decrypt_last_ref_3[idx++] = 0x02000000; + decrypt_last_ref_3[idx++] = 0xc1000000; + decrypt_last_ref_3[idx++] = 0xaf000000; + decrypt_last_ref_3[idx++] = 0xbd000000; + decrypt_last_ref_3[idx++] = 0x03000000; + decrypt_last_ref_3[idx++] = 0x01000000; + decrypt_last_ref_3[idx++] = 0x13000000; + decrypt_last_ref_3[idx++] = 0x8a000000; + decrypt_last_ref_3[idx++] = 0x6b000000; + decrypt_last_ref_3[idx++] = 0x3a000000; + decrypt_last_ref_3[idx++] = 0x91000000; + decrypt_last_ref_3[idx++] = 0x11000000; + decrypt_last_ref_3[idx++] = 0x41000000; + decrypt_last_ref_3[idx++] = 0x4f000000; + decrypt_last_ref_3[idx++] = 0x67000000; + decrypt_last_ref_3[idx++] = 0xdc000000; + decrypt_last_ref_3[idx++] = 0xea000000; + decrypt_last_ref_3[idx++] = 0x97000000; + decrypt_last_ref_3[idx++] = 0xf2000000; + decrypt_last_ref_3[idx++] = 0xcf000000; + decrypt_last_ref_3[idx++] = 0xce000000; + decrypt_last_ref_3[idx++] = 0xf0000000; + decrypt_last_ref_3[idx++] = 0xb4000000; + decrypt_last_ref_3[idx++] = 0xe6000000; + decrypt_last_ref_3[idx++] = 0x73000000; + decrypt_last_ref_3[idx++] = 0x96000000; + decrypt_last_ref_3[idx++] = 0xac000000; + decrypt_last_ref_3[idx++] = 0x74000000; + decrypt_last_ref_3[idx++] = 0x22000000; + decrypt_last_ref_3[idx++] = 0xe7000000; + decrypt_last_ref_3[idx++] = 0xad000000; + decrypt_last_ref_3[idx++] = 0x35000000; + decrypt_last_ref_3[idx++] = 0x85000000; + decrypt_last_ref_3[idx++] = 0xe2000000; + decrypt_last_ref_3[idx++] = 0xf9000000; + decrypt_last_ref_3[idx++] = 0x37000000; + decrypt_last_ref_3[idx++] = 0xe8000000; + decrypt_last_ref_3[idx++] = 0x1c000000; + decrypt_last_ref_3[idx++] = 0x75000000; + decrypt_last_ref_3[idx++] = 0xdf000000; + decrypt_last_ref_3[idx++] = 0x6e000000; + decrypt_last_ref_3[idx++] = 0x47000000; + decrypt_last_ref_3[idx++] = 0xf1000000; + decrypt_last_ref_3[idx++] = 0x1a000000; + decrypt_last_ref_3[idx++] = 0x71000000; + decrypt_last_ref_3[idx++] = 0x1d000000; + decrypt_last_ref_3[idx++] = 0x29000000; + decrypt_last_ref_3[idx++] = 0xc5000000; + decrypt_last_ref_3[idx++] = 0x89000000; + decrypt_last_ref_3[idx++] = 0x6f000000; + decrypt_last_ref_3[idx++] = 0xb7000000; + decrypt_last_ref_3[idx++] = 0x62000000; + decrypt_last_ref_3[idx++] = 0x0e000000; + decrypt_last_ref_3[idx++] = 0xaa000000; + decrypt_last_ref_3[idx++] = 0x18000000; + decrypt_last_ref_3[idx++] = 0xbe000000; + decrypt_last_ref_3[idx++] = 0x1b000000; + decrypt_last_ref_3[idx++] = 0xfc000000; + decrypt_last_ref_3[idx++] = 0x56000000; + decrypt_last_ref_3[idx++] = 0x3e000000; + decrypt_last_ref_3[idx++] = 0x4b000000; + decrypt_last_ref_3[idx++] = 0xc6000000; + decrypt_last_ref_3[idx++] = 0xd2000000; + decrypt_last_ref_3[idx++] = 0x79000000; + decrypt_last_ref_3[idx++] = 0x20000000; + decrypt_last_ref_3[idx++] = 0x9a000000; + decrypt_last_ref_3[idx++] = 0xdb000000; + decrypt_last_ref_3[idx++] = 0xc0000000; + decrypt_last_ref_3[idx++] = 0xfe000000; + decrypt_last_ref_3[idx++] = 0x78000000; + decrypt_last_ref_3[idx++] = 0xcd000000; + decrypt_last_ref_3[idx++] = 0x5a000000; + decrypt_last_ref_3[idx++] = 0xf4000000; + decrypt_last_ref_3[idx++] = 0x1f000000; + decrypt_last_ref_3[idx++] = 0xdd000000; + decrypt_last_ref_3[idx++] = 0xa8000000; + decrypt_last_ref_3[idx++] = 0x33000000; + decrypt_last_ref_3[idx++] = 0x88000000; + decrypt_last_ref_3[idx++] = 0x07000000; + decrypt_last_ref_3[idx++] = 0xc7000000; + decrypt_last_ref_3[idx++] = 0x31000000; + decrypt_last_ref_3[idx++] = 0xb1000000; + decrypt_last_ref_3[idx++] = 0x12000000; + decrypt_last_ref_3[idx++] = 0x10000000; + decrypt_last_ref_3[idx++] = 0x59000000; + decrypt_last_ref_3[idx++] = 0x27000000; + decrypt_last_ref_3[idx++] = 0x80000000; + decrypt_last_ref_3[idx++] = 0xec000000; + decrypt_last_ref_3[idx++] = 0x5f000000; + decrypt_last_ref_3[idx++] = 0x60000000; + decrypt_last_ref_3[idx++] = 0x51000000; + decrypt_last_ref_3[idx++] = 0x7f000000; + decrypt_last_ref_3[idx++] = 0xa9000000; + decrypt_last_ref_3[idx++] = 0x19000000; + decrypt_last_ref_3[idx++] = 0xb5000000; + decrypt_last_ref_3[idx++] = 0x4a000000; + decrypt_last_ref_3[idx++] = 0x0d000000; + decrypt_last_ref_3[idx++] = 0x2d000000; + decrypt_last_ref_3[idx++] = 0xe5000000; + decrypt_last_ref_3[idx++] = 0x7a000000; + decrypt_last_ref_3[idx++] = 0x9f000000; + decrypt_last_ref_3[idx++] = 0x93000000; + decrypt_last_ref_3[idx++] = 0xc9000000; + decrypt_last_ref_3[idx++] = 0x9c000000; + decrypt_last_ref_3[idx++] = 0xef000000; + decrypt_last_ref_3[idx++] = 0xa0000000; + decrypt_last_ref_3[idx++] = 0xe0000000; + decrypt_last_ref_3[idx++] = 0x3b000000; + decrypt_last_ref_3[idx++] = 0x4d000000; + decrypt_last_ref_3[idx++] = 0xae000000; + decrypt_last_ref_3[idx++] = 0x2a000000; + decrypt_last_ref_3[idx++] = 0xf5000000; + decrypt_last_ref_3[idx++] = 0xb0000000; + decrypt_last_ref_3[idx++] = 0xc8000000; + decrypt_last_ref_3[idx++] = 0xeb000000; + decrypt_last_ref_3[idx++] = 0xbb000000; + decrypt_last_ref_3[idx++] = 0x3c000000; + decrypt_last_ref_3[idx++] = 0x83000000; + decrypt_last_ref_3[idx++] = 0x53000000; + decrypt_last_ref_3[idx++] = 0x99000000; + decrypt_last_ref_3[idx++] = 0x61000000; + decrypt_last_ref_3[idx++] = 0x17000000; + decrypt_last_ref_3[idx++] = 0x2b000000; + decrypt_last_ref_3[idx++] = 0x04000000; + decrypt_last_ref_3[idx++] = 0x7e000000; + decrypt_last_ref_3[idx++] = 0xba000000; + decrypt_last_ref_3[idx++] = 0x77000000; + decrypt_last_ref_3[idx++] = 0xd6000000; + decrypt_last_ref_3[idx++] = 0x26000000; + decrypt_last_ref_3[idx++] = 0xe1000000; + decrypt_last_ref_3[idx++] = 0x69000000; + decrypt_last_ref_3[idx++] = 0x14000000; + decrypt_last_ref_3[idx++] = 0x63000000; + decrypt_last_ref_3[idx++] = 0x55000000; + decrypt_last_ref_3[idx++] = 0x21000000; + decrypt_last_ref_3[idx++] = 0x0c000000; + decrypt_last_ref_3[idx++] = 0x7d000000; + + encrypt_ref[0] = encrypt_ref_0; + encrypt_ref[1] = encrypt_ref_1; + encrypt_ref[2] = encrypt_ref_2; + encrypt_ref[3] = encrypt_ref_3; + + encrypt_last_ref[0] = encrypt_last_ref_0; + encrypt_last_ref[1] = encrypt_last_ref_1; + encrypt_last_ref[2] = encrypt_last_ref_2; + encrypt_last_ref[3] = encrypt_last_ref_3; + + decrypt_ref[0] = decrypt_ref_0; + decrypt_ref[1] = decrypt_ref_1; + decrypt_ref[2] = decrypt_ref_2; + decrypt_ref[3] = decrypt_ref_3; + + decrypt_last_ref[0] = decrypt_last_ref_0; + decrypt_last_ref[1] = decrypt_last_ref_1; + decrypt_last_ref[2] = decrypt_last_ref_2; + decrypt_last_ref[3] = decrypt_last_ref_3; + } + + static private UInt32[][] encrypt_ref = new UInt32[4][]; + static private UInt32[][] encrypt_last_ref = new UInt32[4][]; + static private UInt32[][] decrypt_ref = new UInt32[4][]; + static private UInt32[][] decrypt_last_ref = new UInt32[4][]; + + + } +} diff --git a/emulation/soc/betrusted-soc.repl b/emulation/soc/betrusted-soc.repl index 5234162bf..b199aaa62 100644 --- a/emulation/soc/betrusted-soc.repl +++ b/emulation/soc/betrusted-soc.repl @@ -1,6 +1,6 @@ // Renode Platform file generated by svd2repl // This file is automatically generated -cpu: CPU.VexRiscv @ sysbus +cpu: CPU.AesVexRiscv @ sysbus cpuType: "rv32imac" privilegeArchitecture: PrivilegeArchitecture.Priv1_10 PerformanceInMips: 120 @@ -54,7 +54,8 @@ ticktimer: Timers.TickTimer @ sysbus 0xf0012000 spinor_soft_int: Miscellaneous.SpinorSoftInt @ sysbus 0xf0015000 IRQ -> cpu @ 1011 -// Unrecognized peripheral: spinor @ 0xf0016000 +spinor: SPI.BetrustedSpinor @ sysbus 0xf0016000 + IRQ -> cpu @ 1012 keyboard: Input.BetrustedKbd @ sysbus 0xf0017000 IRQ -> cpu @ 1013 @@ -116,6 +117,9 @@ audio: Memory.MappedMemory @ sysbus 0xe0000000 abracom_rtc: Sensors.ABRTCMC @ i2c 0x68 +flash: SPI.MXIC_MX66UM1G45G @ spinor + underlyingMemory: spiflash + sysbus: init: ApplySVD @soc/renode.svd diff --git a/emulation/xous-release.resc b/emulation/xous-release.resc index d367686ac..05f318a74 100644 --- a/emulation/xous-release.resc +++ b/emulation/xous-release.resc @@ -11,6 +11,7 @@ using sysbus i @peripherals/ABRTCMC.cs i @peripherals/BetrustedEcI2C.cs i @peripherals/BetrustedSocI2C.cs +i @peripherals/BetrustedSpinor.cs i @peripherals/BetrustedWatchdog.cs i @peripherals/BQ24157.cs i @peripherals/BQ27421.cs @@ -23,6 +24,7 @@ i @peripherals/LiteX_Timer_32.cs i @peripherals/LM3509.cs i @peripherals/LSM6DS3.cs i @peripherals/memlcd.cs +i @peripherals/MXIC_MX66UM1G45G.cs i @peripherals/sha512.cs i @peripherals/spinor_soft_int.cs i @peripherals/ticktimer.cs @@ -31,6 +33,9 @@ i @peripherals/trng_server.cs i @peripherals/TUSB320LAI.cs i @peripherals/wfi.cs +EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.VexRiscv" +i @peripherals/vexriscv-aes.cs + # Create the COM SPI bus emulation CreateComConnector "com" @@ -57,11 +62,13 @@ sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer" # logLevel -1 i2c # logLevel -1 i2c.abracom_rtc # logLevel -1 sha512 +# logLevel -1 sysbus.spinor.flash +# sysbus LogPeripheralAccess spinor true # Silence GPIO sysbus SilenceRange <0xf0003000, 0xF0003FFF> -# sysbus SilenceRange <0xF0021000, 0xF0021FFF> -# sysbus SilenceRange <0xF0023000, 0xF0023FFF> +# Silence POWER +sysbus SilenceRange <0xF0014000 100> # Load the SPI flash into RAM sysbus LoadBinary @precursors/soc_csr.bin 0x20000000 @@ -84,7 +91,6 @@ emulation CreateServerSocketTerminal 9999 "kernel" False connector Connect sysbus.uart kernel runMacro $reset -sysbus.cpu InstallCustomInstructionHandlerFromFile "00ss0fdbbbbbaaaaa000ddddd0001011" @vexriscv-aes.py mach clear diff --git a/svd2repl/src/generate.rs b/svd2repl/src/generate.rs index dcb79b46a..372d241ad 100644 --- a/svd2repl/src/generate.rs +++ b/svd2repl/src/generate.rs @@ -479,7 +479,7 @@ fn parse_vendor_extensions( fn print_header(out: &mut U) -> std::io::Result<()> { let s = r####"// Renode Platform file generated by svd2repl // This file is automatically generated -cpu: CPU.VexRiscv @ sysbus +cpu: CPU.AesVexRiscv @ sysbus cpuType: "rv32imac" privilegeArchitecture: PrivilegeArchitecture.Priv1_10 PerformanceInMips: 120 @@ -491,6 +491,9 @@ fn print_footer(out: &mut U) -> std::io::Result<()> { let s = r####" abracom_rtc: Sensors.ABRTCMC @ i2c 0x68 +flash: SPI.MXIC_MX66UM1G45G @ spinor + underlyingMemory: spiflash + sysbus: init: ApplySVD @soc/renode.svd @@ -640,6 +643,7 @@ pub fn generate(src: T, dest: &mut U) -> Result<(), ParseErro cs_peripherals.insert("memlcd", "Video.BetrustedLCD"); cs_peripherals.insert("sha512", "Miscellaneous.Sha512"); cs_peripherals.insert("spinor_soft_int", "Miscellaneous.SpinorSoftInt"); + cs_peripherals.insert("spinor", "SPI.BetrustedSpinor"); cs_peripherals.insert("timer0", "Timers.LiteX_Timer_32"); cs_peripherals.insert("trng_kernel", "Miscellaneous.BetrustedRNGKernel"); cs_peripherals.insert("trng_server", "Miscellaneous.BetrustedRNGServer"); From 9c1255bdd7896b857da70726657cbd6a051ff8b0 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 18 Feb 2022 09:07:13 +0800 Subject: [PATCH 2/2] emulation: split Com emulation into three files The COM bus is fundamentally three things: The SoC, the EC, and the glue that binds the two together. Now that we have the `EnsureTypeIsLoaded` trick, split the file into three different groups. Signed-off-by: Sean Cross --- emulation/peripherals/Com.cs | 519 -------------------------- emulation/peripherals/ComConnector.cs | 210 +++++++++++ emulation/peripherals/ComEc.cs | 196 ++++++++++ emulation/peripherals/ComSoC.cs | 151 ++++++++ emulation/xous-release.resc | 7 +- 5 files changed, 563 insertions(+), 520 deletions(-) delete mode 100644 emulation/peripherals/Com.cs create mode 100644 emulation/peripherals/ComConnector.cs create mode 100644 emulation/peripherals/ComEc.cs create mode 100644 emulation/peripherals/ComSoC.cs diff --git a/emulation/peripherals/Com.cs b/emulation/peripherals/Com.cs deleted file mode 100644 index 81187a400..000000000 --- a/emulation/peripherals/Com.cs +++ /dev/null @@ -1,519 +0,0 @@ -// -// Copyright (c) 2010-2021 Antmicro -// -// This file is licensed under the MIT License. -// Full license text is available in 'licenses/MIT.txt'. -// -using System.Collections.Generic; -using Antmicro.Renode.Core; -using Antmicro.Renode.Core.Structure; -using Antmicro.Renode.Exceptions; -using Antmicro.Renode.Logging; -using Antmicro.Renode.Time; -using Antmicro.Renode.Utilities; -using Antmicro.Renode.Peripherals.Bus; -using Antmicro.Renode.Core.Structure.Registers; -using System.Collections.Concurrent; - -namespace Antmicro.Renode.Peripherals.SPI -{ - public interface IComPeripheral : IPeripheral, IInterestingType - { - ushort Transmit(ushort data); - bool HasData(); - void FinishTransmission(); - } - public interface IComController : IPeripheral, IInterestingType, IGPIOReceiver - { - ushort Transmit(ushort data); - void FinishTransmission(); - } - public static class ComConnectorExtensions - { - public static void CreateComConnector(this Emulation emulation, string name) - { - emulation.ExternalsManager.AddExternal(new BetrustedComConnector(), name); - } - } - - // This class is responsible for synchronizing communication between the EC and SoC. - // Note that the "Controller" is the SoC side and the "Peripheral" is the EC side. - public class BetrustedComConnector : IExternal, IComController, IConnectable, IConnectable>, IGPIOReceiver - { - public BetrustedComConnector() - { - } - - public void Reset() - { - } - - public void AttachTo(NullRegistrationPointPeripheralContainer controller) - { - lock (locker) - { - if (controller == this.controller) - { - throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); - } - else if (this.controller != null) - { - this.Log(LogLevel.Warning, "Overwriting controller connection."); - } - - this.controller?.Unregister(this); - this.controller = controller; - this.controller.Register(this, NullRegistrationPoint.Instance); - foreach (var gpio in controller.GetGPIOs()) - { - if (gpio.Item1 == "HOLD") - { - this.holdGpio = gpio.Item2; - } - if (gpio.Item1 == "INTERRUPT") - { - this.interruptGpio = gpio.Item2; - } - } - } - } - - public void AttachTo(IComPeripheral peripheral) - { - lock (locker) - { - if (peripheral == this.peripheral) - { - throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); - } - else if (this.peripheral != null) - { - this.Log(LogLevel.Warning, "Overwriting peripheral connection."); - } - this.peripheral = peripheral; - foreach (var gpio in peripheral.GetGPIOs()) - { - if (gpio.Item1 == "Hold") - { - gpio.Item2.Connect(this, 0); - } - else if (gpio.Item1 == "Interrupt") - { - gpio.Item2.Connect(this, 1); - } - } - } - } - - public void DetachFrom(NullRegistrationPointPeripheralContainer controller) - { - lock (locker) - { - if (controller == this.controller) - { - this.controller.Unregister(this); - this.controller = null; - } - else - { - throw new RecoverableException("Cannot detach from the provided controller as it is not registered in this connector."); - } - } - } - - public void DetachFrom(IComPeripheral peripheral) - { - lock (locker) - { - if (peripheral == this.peripheral) - { - foreach (var gpio in peripheral.GetGPIOs()) - { - if (gpio.Item1 == "Hold") - { - gpio.Item2.Disconnect(); - } - else if (gpio.Item1 == "Interrupt") - { - gpio.Item2.Disconnect(); - } - } - peripheral = null; - } - else - { - throw new RecoverableException("Cannot detach from the provided peripheral as it is not registered in this connector."); - } - } - } - - public void OnGPIO(int number, bool value) - { - if (number == 0) - { - // "Hold" pin - if (holdGpio != null) - { - // controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld)); - controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false); - } - } - else if (number == 1) - { - // "Interrupt" pin - if (interruptGpio != null) - { - // controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld)); - controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false); - } - } - } - - public ushort Transmit(ushort data) - { - lock (locker) - { - if (peripheral == null) - { - this.Log(LogLevel.Warning, "Controller sent data (0x{0:X}), but peripheral is not connected.", data); - return 0xDDDD; - } - // We don't use a separate time domain here because the peripheral's output is buffered and we - // want it to operate at the same speed as the host. If we used a separate time domain then there would - // be gaps in the buffer, whereas the real hardware will have no gaps. - ushort result = peripheral.Transmit(data); - - // Update the hold GPIO in this same domain. It may get updated slightly in the future - // by the `OnGPIO` call above, but update it in this cycle to avoid latency issues. - if (holdGpio != null) - { - holdGpio.Set(!peripheral.HasData()); - } - return result; - } - } - - public void FinishTransmission() - { - lock (locker) - { - peripheral.GetMachine().HandleTimeDomainEvent(_ => peripheral.FinishTransmission(), null, TimeDomainsManager.Instance.VirtualTimeStamp); - } - } - - private NullRegistrationPointPeripheralContainer controller; - private IComPeripheral peripheral; - private IGPIO holdGpio; - private IGPIO interruptGpio; - private readonly object locker = new object(); - } - - public class BetrustedEcRam : IDoubleWordPeripheral, IKnownSize - { - public BetrustedEcRam(Machine machine, BetrustedEcCom spi, long size) - { - this.machine = machine; - this.spi = spi; - this.size = size; - // Hardware defaults to 1280 entries - readFifo = new ConcurrentQueue(); - writeFifo = new ConcurrentQueue(); - } - - private Machine machine; - private BetrustedEcCom spi; - private long size; - private ConcurrentQueue readFifo; - private ConcurrentQueue writeFifo; - public long Size { get { return size; } } - - public bool WriteNextWord(uint value) - { - readFifo.Enqueue(value); - return true; - } - - public bool ReadFifoHasData() - { - return !readFifo.IsEmpty; - } - - public int ReadFifoCount() - { - return readFifo.Count; - } - - public bool GetNextWord(out uint value) - { - bool have_data = writeFifo.TryDequeue(out value); - return have_data; - } - - public int WriteFifoCount() - { - return writeFifo.Count; - } - - public bool WriteFifoHasData() - { - return !writeFifo.IsEmpty; - } - - public void WriteDoubleWord(long address, uint value) - { - if (address == 0) - { - // machine.Log(LogLevel.Error, "EC queueing word: {0:X4}", value); - writeFifo.Enqueue(value); - spi.Hold.Set(false); - return; - } - machine.Log(LogLevel.Error, "Write to unsupported address: {}", address); - } - - public uint ReadDoubleWord(long address) - { - uint ret = 0; - if ((address == 0) && readFifo.TryDequeue(out ret)) - { - // machine.Log(LogLevel.Error, "EC received word: {0:X4}", ret); - } - else - { - // machine.Log(LogLevel.Error, "Read double word, but have no data"); - } - return ret; - } - - public void Reset() - { - readFifo = new ConcurrentQueue(); - writeFifo = new ConcurrentQueue(); - } - } - - public class BetrustedEcCom : IComPeripheral, IDoubleWordPeripheral, IKnownSize, IProvidesRegisterCollection, IGPIOSender - { - - public BetrustedEcCom(Machine machine, uint memAddr, uint memSize) - { - Hold = new GPIO(); - Interrupt = new GPIO(); - EcRam = new BetrustedEcRam(machine, this, memSize); - machine.SystemBus.Register(EcRam, new BusRangeRegistration(memAddr, memSize)); - - RegistersCollection = new DoubleWordRegisterCollection(this); - Registers.ComControl.Define32(this) - .WithFlag(0, FieldMode.Write, name: "CLRERR") - .WithFlag(1, FieldMode.Write, writeCallback: (_, val) => Interrupt.Set(val), name: "HOST_INT") - .WithFlag(2, FieldMode.Write, writeCallback: (_, val) => - { - if (!val) - return; - machine.Log(LogLevel.Debug, "Resetting FIFO due to RESET bit being set"); - Reset(); - }, name: "RESET") - ; - - Registers.ComStatus.Define32(this) - .WithFlag(0, FieldMode.Read, valueProviderCallback: (_) => false, name: "TIP") - .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoHasData(), name: "RX_AVAIL") - .WithFlag(2, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoCount() >= 1280, name: "RX_OVER") - .WithFlag(3, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoCount() == 0, name: "RX_UNDER") - .WithValueField(4, 12, FieldMode.Read, valueProviderCallback: (_) => (uint)EcRam.ReadFifoCount(), name: "RX_LEVEL") - .WithFlag(16, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoHasData(), name: "TX_AVAIL") - .WithFlag(17, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoCount() == 0, name: "TX_EMPTY") - .WithValueField(18, 12, FieldMode.Read, valueProviderCallback: (_) => (uint)EcRam.WriteFifoCount(), name: "TX_LEVEL") - .WithFlag(30, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoCount() >= 1280, name: "TX_OVER") - .WithFlag(31, FieldMode.Read, valueProviderCallback: (_) => false, name: "TX_UNDER") - ; - Reset(); - } - - public void WriteDoubleWord(long address, uint value) - { - RegistersCollection.Write(address, value); - } - - public uint ReadDoubleWord(long offset) - { - return RegistersCollection.Read(offset); - } - - public ushort Transmit(ushort value) - { - uint TxValue; - if (!EcRam.GetNextWord(out TxValue)) - { - TxValue = 0xDDDD; - } - this.Log(LogLevel.Noisy, "EC received:{0:X4} sent:{1:X4}", value, TxValue); - Hold.Set(!EcRam.WriteFifoHasData()); - EcRam.WriteNextWord((ushort)value); - // this.Log(LogLevel.Info, "EcRam.ReadFifo now contains {0} items, EcRam.WriteFifo contains {1} items", EcRam.ReadFifoCount(), EcRam.WriteFifoCount()); - return (ushort)(TxValue & 0xffff); - } - - public void FinishTransmission() - { - // this.Log(LogLevel.Info, "EC finished transmission"); - } - - public bool HasData() - { - return EcRam.WriteFifoHasData(); - } - - public void Reset() - { - EcRam.Reset(); - Hold.Set(true); - } - - public long Size { get { return 0x100; } } - private uint TxValue; - private BetrustedEcRam EcRam; - public GPIO Hold { get; } - public GPIO Interrupt { get; } - public DoubleWordRegisterCollection RegistersCollection { get; private set; } - - private enum Registers - { - ComControl = 0x00, - - ComStatus = 0x04, - } - } - - public class BetrustedSocCom : NullRegistrationPointPeripheralContainer, IDoubleWordPeripheral, IProvidesRegisterCollection, IKnownSize - { - public BetrustedSocCom(Machine machine) : base(machine) - { - IRQ = new GPIO(); - HOLD = new GPIO(); - RegistersCollection = new DoubleWordRegisterCollection(this); - - Registers.ComTx.Define32(this) - .WithValueField(0, 16, FieldMode.Write, writeCallback: (_, val) => - { - // Skip transaction if HOLD is set - // if (AutoHold.Value && (HOLD && HOLD.IsSet) - // { - // return; - // } - Rx.Value = (uint)RegisteredPeripheral.Transmit((ushort)val); - RegisteredPeripheral.FinishTransmission(); - machine.Log(LogLevel.Noisy, "SoC sent {0:X4} received {1:X4}", val, Rx.Value); - if (IntEna.Value) - { - SpiIntStatus.Value = true; - UpdateInterrupts(); - SpiIntStatus.Value = false; - } - }, name: "TX") - ; - - Registers.ComRx.Define32(this) - .WithValueField(0, 16, out Rx, FieldMode.Read, name: "RX") - ; - - Registers.ComControl.Define32(this) - .WithFlag(0, out IntEna, FieldMode.Read | FieldMode.Write, name: "IntEna") - .WithFlag(1, out AutoHold, FieldMode.Read | FieldMode.Write, name: "AutoHold") - ; - Registers.ComStatus.Define32(this) - .WithFlag(0, out Tip, FieldMode.Read, name: "Tip") - .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "Hold") - ; - - Registers.ComEvStatus.Define32(this) - .WithFlag(0, out SpiIntStatus, FieldMode.Read, name: "SpiInt") - .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "SpiHold") - ; - - Registers.ComEvPending.Define32(this) - .WithFlag(0, out SpiIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts()) - .WithFlag(1, out SpiHoldPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts()) - ; - - Registers.ComEvEnable.Define32(this) - .WithFlag(0, out SpiIntEnable, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts()) - .WithFlag(1, out SpiHoldEnable, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts()) - ; - - Reset(); - } - - private void UpdateInterrupts() - { - // if (RegisteredPeripheral.Interrupt()) - // { - // SpiIntPending.Value = true; - // } - if (HOLD.IsSet) - { - SpiHoldPending.Value = true; - } - IRQ.Set((SpiIntPending.Value && SpiIntEnable.Value) - || (SpiHoldPending.Value && SpiHoldEnable.Value)); - } - - public void WriteDoubleWord(long address, uint value) - { - RegistersCollection.Write(address, value); - } - - public uint ReadDoubleWord(long offset) - { - return RegistersCollection.Read(offset); - } - - public override void Reset() - { - // IntEna.Value = false; - // AutoHold.Value = false; - // Tip.Value = false; - // Rx.Value = 0; - - SpiIntStatus.Value = false; - SpiIntPending.Value = false; - SpiHoldPending.Value = false; - SpiIntEnable.Value = false; - SpiHoldEnable.Value = false; - - Tip.Value = false; - } - - - public long Size { get { return 0x100; } } - - public GPIO IRQ { get; private set; } - public GPIO HOLD { get; private set; } - - private IFlagRegisterField IntEna; - private IFlagRegisterField AutoHold; - private IFlagRegisterField Tip; - private IValueRegisterField Rx; - - // Interrupts - private IFlagRegisterField SpiIntStatus; - private IFlagRegisterField SpiIntPending; - private IFlagRegisterField SpiHoldPending; - private IFlagRegisterField SpiIntEnable; - private IFlagRegisterField SpiHoldEnable; - - public DoubleWordRegisterCollection RegistersCollection { get; private set; } - - private enum Registers - { - ComTx = 0x00, - - ComRx = 0x04, - ComControl = 0x08, - ComStatus = 0x0c, - ComEvStatus = 0x10, - ComEvPending = 0x14, - ComEvEnable = 0x18, - } - } -} diff --git a/emulation/peripherals/ComConnector.cs b/emulation/peripherals/ComConnector.cs new file mode 100644 index 000000000..d8651d640 --- /dev/null +++ b/emulation/peripherals/ComConnector.cs @@ -0,0 +1,210 @@ +// +// Copyright (c) 2010-2021 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// +using System.Collections.Generic; +using Antmicro.Renode.Core; +using Antmicro.Renode.Core.Structure; +using Antmicro.Renode.Exceptions; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Time; +using Antmicro.Renode.Utilities; +using Antmicro.Renode.Peripherals.Bus; +using Antmicro.Renode.Core.Structure.Registers; +using System.Collections.Concurrent; + +namespace Antmicro.Renode.Peripherals.SPI +{ + public interface IComPeripheral : IPeripheral, IInterestingType + { + ushort Transmit(ushort data); + bool HasData(); + void FinishTransmission(); + } + public interface IComController : IPeripheral, IInterestingType, IGPIOReceiver + { + ushort Transmit(ushort data); + void FinishTransmission(); + } + public static class ComConnectorExtensions + { + public static void CreateComConnector(this Emulation emulation, string name) + { + emulation.ExternalsManager.AddExternal(new BetrustedComConnector(), name); + } + } + + // This class is responsible for synchronizing communication between the EC and SoC. + // Note that the "Controller" is the SoC side and the "Peripheral" is the EC side. + public class BetrustedComConnector : IExternal, IComController, IConnectable, IConnectable>, IGPIOReceiver + { + public BetrustedComConnector() + { + } + + public void Reset() + { + } + + public void AttachTo(NullRegistrationPointPeripheralContainer controller) + { + lock (locker) + { + if (controller == this.controller) + { + throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); + } + else if (this.controller != null) + { + this.Log(LogLevel.Warning, "Overwriting controller connection."); + } + + this.controller?.Unregister(this); + this.controller = controller; + this.controller.Register(this, NullRegistrationPoint.Instance); + foreach (var gpio in controller.GetGPIOs()) + { + if (gpio.Item1 == "HOLD") + { + this.holdGpio = gpio.Item2; + } + if (gpio.Item1 == "INTERRUPT") + { + this.interruptGpio = gpio.Item2; + } + } + } + } + + public void AttachTo(IComPeripheral peripheral) + { + lock (locker) + { + if (peripheral == this.peripheral) + { + throw new RecoverableException("Cannot attach to the provided peripheral as it is already registered in this connector."); + } + else if (this.peripheral != null) + { + this.Log(LogLevel.Warning, "Overwriting peripheral connection."); + } + this.peripheral = peripheral; + foreach (var gpio in peripheral.GetGPIOs()) + { + if (gpio.Item1 == "Hold") + { + gpio.Item2.Connect(this, 0); + } + else if (gpio.Item1 == "Interrupt") + { + gpio.Item2.Connect(this, 1); + } + } + } + } + + public void DetachFrom(NullRegistrationPointPeripheralContainer controller) + { + lock (locker) + { + if (controller == this.controller) + { + this.controller.Unregister(this); + this.controller = null; + } + else + { + throw new RecoverableException("Cannot detach from the provided controller as it is not registered in this connector."); + } + } + } + + public void DetachFrom(IComPeripheral peripheral) + { + lock (locker) + { + if (peripheral == this.peripheral) + { + foreach (var gpio in peripheral.GetGPIOs()) + { + if (gpio.Item1 == "Hold") + { + gpio.Item2.Disconnect(); + } + else if (gpio.Item1 == "Interrupt") + { + gpio.Item2.Disconnect(); + } + } + peripheral = null; + } + else + { + throw new RecoverableException("Cannot detach from the provided peripheral as it is not registered in this connector."); + } + } + } + + public void OnGPIO(int number, bool value) + { + if (number == 0) + { + // "Hold" pin + if (holdGpio != null) + { + // controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld)); + controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false); + } + } + else if (number == 1) + { + // "Interrupt" pin + if (interruptGpio != null) + { + // controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld)); + controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false); + } + } + } + + public ushort Transmit(ushort data) + { + lock (locker) + { + if (peripheral == null) + { + this.Log(LogLevel.Warning, "Controller sent data (0x{0:X}), but peripheral is not connected.", data); + return 0xDDDD; + } + // We don't use a separate time domain here because the peripheral's output is buffered and we + // want it to operate at the same speed as the host. If we used a separate time domain then there would + // be gaps in the buffer, whereas the real hardware will have no gaps. + ushort result = peripheral.Transmit(data); + + // Update the hold GPIO in this same domain. It may get updated slightly in the future + // by the `OnGPIO` call above, but update it in this cycle to avoid latency issues. + if (holdGpio != null) + { + holdGpio.Set(!peripheral.HasData()); + } + return result; + } + } + + public void FinishTransmission() + { + lock (locker) + { + peripheral.GetMachine().HandleTimeDomainEvent(_ => peripheral.FinishTransmission(), null, TimeDomainsManager.Instance.VirtualTimeStamp); + } + } + + private NullRegistrationPointPeripheralContainer controller; + private IComPeripheral peripheral; + private IGPIO holdGpio; + private IGPIO interruptGpio; + private readonly object locker = new object(); + } +} diff --git a/emulation/peripherals/ComEc.cs b/emulation/peripherals/ComEc.cs new file mode 100644 index 000000000..5f324b807 --- /dev/null +++ b/emulation/peripherals/ComEc.cs @@ -0,0 +1,196 @@ +// +// Copyright (c) 2010-2021 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// +using System.Collections.Generic; +using Antmicro.Renode.Core; +using Antmicro.Renode.Core.Structure; +using Antmicro.Renode.Exceptions; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Time; +using Antmicro.Renode.Utilities; +using Antmicro.Renode.Peripherals.Bus; +using Antmicro.Renode.Core.Structure.Registers; +using System.Collections.Concurrent; + +namespace Antmicro.Renode.Peripherals.SPI +{ + public class BetrustedEcRam : IDoubleWordPeripheral, IKnownSize + { + public BetrustedEcRam(Machine machine, BetrustedEcCom spi, long size) + { + this.machine = machine; + this.spi = spi; + this.size = size; + // Hardware defaults to 1280 entries + readFifo = new ConcurrentQueue(); + writeFifo = new ConcurrentQueue(); + } + + private Machine machine; + private BetrustedEcCom spi; + private long size; + private ConcurrentQueue readFifo; + private ConcurrentQueue writeFifo; + public long Size { get { return size; } } + + public bool WriteNextWord(uint value) + { + readFifo.Enqueue(value); + return true; + } + + public bool ReadFifoHasData() + { + return !readFifo.IsEmpty; + } + + public int ReadFifoCount() + { + return readFifo.Count; + } + + public bool GetNextWord(out uint value) + { + bool have_data = writeFifo.TryDequeue(out value); + return have_data; + } + + public int WriteFifoCount() + { + return writeFifo.Count; + } + + public bool WriteFifoHasData() + { + return !writeFifo.IsEmpty; + } + + public void WriteDoubleWord(long address, uint value) + { + if (address == 0) + { + // machine.Log(LogLevel.Error, "EC queueing word: {0:X4}", value); + writeFifo.Enqueue(value); + spi.Hold.Set(false); + return; + } + machine.Log(LogLevel.Error, "Write to unsupported address: {}", address); + } + + public uint ReadDoubleWord(long address) + { + uint ret = 0; + if ((address == 0) && readFifo.TryDequeue(out ret)) + { + // machine.Log(LogLevel.Error, "EC received word: {0:X4}", ret); + } + else + { + // machine.Log(LogLevel.Error, "Read double word, but have no data"); + } + return ret; + } + + public void Reset() + { + readFifo = new ConcurrentQueue(); + writeFifo = new ConcurrentQueue(); + } + } + + public class BetrustedEcCom : IComPeripheral, IDoubleWordPeripheral, IKnownSize, IProvidesRegisterCollection, IGPIOSender + { + + public BetrustedEcCom(Machine machine, uint memAddr, uint memSize) + { + Hold = new GPIO(); + Interrupt = new GPIO(); + EcRam = new BetrustedEcRam(machine, this, memSize); + machine.SystemBus.Register(EcRam, new BusRangeRegistration(memAddr, memSize)); + + RegistersCollection = new DoubleWordRegisterCollection(this); + Registers.ComControl.Define32(this) + .WithFlag(0, FieldMode.Write, name: "CLRERR") + .WithFlag(1, FieldMode.Write, writeCallback: (_, val) => Interrupt.Set(val), name: "HOST_INT") + .WithFlag(2, FieldMode.Write, writeCallback: (_, val) => + { + if (!val) + return; + machine.Log(LogLevel.Debug, "Resetting FIFO due to RESET bit being set"); + Reset(); + }, name: "RESET") + ; + + Registers.ComStatus.Define32(this) + .WithFlag(0, FieldMode.Read, valueProviderCallback: (_) => false, name: "TIP") + .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoHasData(), name: "RX_AVAIL") + .WithFlag(2, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoCount() >= 1280, name: "RX_OVER") + .WithFlag(3, FieldMode.Read, valueProviderCallback: (_) => EcRam.ReadFifoCount() == 0, name: "RX_UNDER") + .WithValueField(4, 12, FieldMode.Read, valueProviderCallback: (_) => (uint)EcRam.ReadFifoCount(), name: "RX_LEVEL") + .WithFlag(16, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoHasData(), name: "TX_AVAIL") + .WithFlag(17, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoCount() == 0, name: "TX_EMPTY") + .WithValueField(18, 12, FieldMode.Read, valueProviderCallback: (_) => (uint)EcRam.WriteFifoCount(), name: "TX_LEVEL") + .WithFlag(30, FieldMode.Read, valueProviderCallback: (_) => EcRam.WriteFifoCount() >= 1280, name: "TX_OVER") + .WithFlag(31, FieldMode.Read, valueProviderCallback: (_) => false, name: "TX_UNDER") + ; + Reset(); + } + + public void WriteDoubleWord(long address, uint value) + { + RegistersCollection.Write(address, value); + } + + public uint ReadDoubleWord(long offset) + { + return RegistersCollection.Read(offset); + } + + public ushort Transmit(ushort value) + { + uint TxValue; + if (!EcRam.GetNextWord(out TxValue)) + { + TxValue = 0xDDDD; + } + this.Log(LogLevel.Noisy, "EC received:{0:X4} sent:{1:X4}", value, TxValue); + Hold.Set(!EcRam.WriteFifoHasData()); + EcRam.WriteNextWord((ushort)value); + // this.Log(LogLevel.Info, "EcRam.ReadFifo now contains {0} items, EcRam.WriteFifo contains {1} items", EcRam.ReadFifoCount(), EcRam.WriteFifoCount()); + return (ushort)(TxValue & 0xffff); + } + + public void FinishTransmission() + { + // this.Log(LogLevel.Info, "EC finished transmission"); + } + + public bool HasData() + { + return EcRam.WriteFifoHasData(); + } + + public void Reset() + { + EcRam.Reset(); + Hold.Set(true); + } + + public long Size { get { return 0x100; } } + private uint TxValue; + private BetrustedEcRam EcRam; + public GPIO Hold { get; } + public GPIO Interrupt { get; } + public DoubleWordRegisterCollection RegistersCollection { get; private set; } + + private enum Registers + { + ComControl = 0x00, + + ComStatus = 0x04, + } + } +} diff --git a/emulation/peripherals/ComSoC.cs b/emulation/peripherals/ComSoC.cs new file mode 100644 index 000000000..b3dff5501 --- /dev/null +++ b/emulation/peripherals/ComSoC.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) 2010-2021 Antmicro +// +// This file is licensed under the MIT License. +// Full license text is available in 'licenses/MIT.txt'. +// +using System.Collections.Generic; +using Antmicro.Renode.Core; +using Antmicro.Renode.Core.Structure; +using Antmicro.Renode.Exceptions; +using Antmicro.Renode.Logging; +using Antmicro.Renode.Time; +using Antmicro.Renode.Utilities; +using Antmicro.Renode.Peripherals.Bus; +using Antmicro.Renode.Core.Structure.Registers; +using System.Collections.Concurrent; + +namespace Antmicro.Renode.Peripherals.SPI +{ + public class BetrustedSocCom : NullRegistrationPointPeripheralContainer, IDoubleWordPeripheral, IProvidesRegisterCollection, IKnownSize + { + public BetrustedSocCom(Machine machine) : base(machine) + { + IRQ = new GPIO(); + HOLD = new GPIO(); + RegistersCollection = new DoubleWordRegisterCollection(this); + + Registers.ComTx.Define32(this) + .WithValueField(0, 16, FieldMode.Write, writeCallback: (_, val) => + { + // Skip transaction if HOLD is set + // if (AutoHold.Value && (HOLD && HOLD.IsSet) + // { + // return; + // } + Rx.Value = (uint)RegisteredPeripheral.Transmit((ushort)val); + RegisteredPeripheral.FinishTransmission(); + machine.Log(LogLevel.Noisy, "SoC sent {0:X4} received {1:X4}", val, Rx.Value); + if (IntEna.Value) + { + SpiIntStatus.Value = true; + UpdateInterrupts(); + SpiIntStatus.Value = false; + } + }, name: "TX") + ; + + Registers.ComRx.Define32(this) + .WithValueField(0, 16, out Rx, FieldMode.Read, name: "RX") + ; + + Registers.ComControl.Define32(this) + .WithFlag(0, out IntEna, FieldMode.Read | FieldMode.Write, name: "IntEna") + .WithFlag(1, out AutoHold, FieldMode.Read | FieldMode.Write, name: "AutoHold") + ; + Registers.ComStatus.Define32(this) + .WithFlag(0, out Tip, FieldMode.Read, name: "Tip") + .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "Hold") + ; + + Registers.ComEvStatus.Define32(this) + .WithFlag(0, out SpiIntStatus, FieldMode.Read, name: "SpiInt") + .WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "SpiHold") + ; + + Registers.ComEvPending.Define32(this) + .WithFlag(0, out SpiIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts()) + .WithFlag(1, out SpiHoldPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts()) + ; + + Registers.ComEvEnable.Define32(this) + .WithFlag(0, out SpiIntEnable, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts()) + .WithFlag(1, out SpiHoldEnable, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts()) + ; + + Reset(); + } + + private void UpdateInterrupts() + { + // if (RegisteredPeripheral.Interrupt()) + // { + // SpiIntPending.Value = true; + // } + if (HOLD.IsSet) + { + SpiHoldPending.Value = true; + } + IRQ.Set((SpiIntPending.Value && SpiIntEnable.Value) + || (SpiHoldPending.Value && SpiHoldEnable.Value)); + } + + public void WriteDoubleWord(long address, uint value) + { + RegistersCollection.Write(address, value); + } + + public uint ReadDoubleWord(long offset) + { + return RegistersCollection.Read(offset); + } + + public override void Reset() + { + // IntEna.Value = false; + // AutoHold.Value = false; + // Tip.Value = false; + // Rx.Value = 0; + + SpiIntStatus.Value = false; + SpiIntPending.Value = false; + SpiHoldPending.Value = false; + SpiIntEnable.Value = false; + SpiHoldEnable.Value = false; + + Tip.Value = false; + } + + + public long Size { get { return 0x100; } } + + public GPIO IRQ { get; private set; } + public GPIO HOLD { get; private set; } + + private IFlagRegisterField IntEna; + private IFlagRegisterField AutoHold; + private IFlagRegisterField Tip; + private IValueRegisterField Rx; + + // Interrupts + private IFlagRegisterField SpiIntStatus; + private IFlagRegisterField SpiIntPending; + private IFlagRegisterField SpiHoldPending; + private IFlagRegisterField SpiIntEnable; + private IFlagRegisterField SpiHoldEnable; + + public DoubleWordRegisterCollection RegistersCollection { get; private set; } + + private enum Registers + { + ComTx = 0x00, + + ComRx = 0x04, + ComControl = 0x08, + ComStatus = 0x0c, + ComEvStatus = 0x10, + ComEvPending = 0x14, + ComEvEnable = 0x18, + } + } +} diff --git a/emulation/xous-release.resc b/emulation/xous-release.resc index 05f318a74..c86d51678 100644 --- a/emulation/xous-release.resc +++ b/emulation/xous-release.resc @@ -15,7 +15,12 @@ i @peripherals/BetrustedSpinor.cs i @peripherals/BetrustedWatchdog.cs i @peripherals/BQ24157.cs i @peripherals/BQ27421.cs -i @peripherals/Com.cs +i @peripherals/ComConnector.cs +EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComPeripheral" +EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComController" +i @peripherals/ComSoC.cs +i @peripherals/ComEc.cs +i @peripherals/ComSoC.cs i @peripherals/ec_power.cs i @peripherals/engine.cs i @peripherals/keyboard.cs