80 lines
2.3 KiB
C#
80 lines
2.3 KiB
C#
using System;
|
|
using hwo.bitworks.io;
|
|
|
|
namespace hwo.bitworks
|
|
{
|
|
class MainClass
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("Give me a little time...");
|
|
|
|
test8bit();
|
|
|
|
BitBuffer bb1,bb2;
|
|
|
|
bb1 = new BitBuffer(32);
|
|
bb2 = new BitBuffer(32);
|
|
|
|
bb1.set(0x00aa00aa);
|
|
bb2.set(0x55005500);
|
|
|
|
Console.WriteLine("bb1: {0}",BitFormat.toString(bb1.getLogicalBases()));
|
|
Console.WriteLine("bb2: {0}",BitFormat.toString(bb2.getLogicalBases()));
|
|
|
|
ADDX addx = new ADDX(bb1.getLogicalBases(),bb2.getLogicalBases());
|
|
|
|
Console.WriteLine("addx: {0}",BitFormat.toString(addx.getLogicalBases()));
|
|
|
|
}
|
|
|
|
public static void test8bit(){
|
|
Console.WriteLine("Test: 32bit patterns");
|
|
|
|
BitBuffer bb1,bb2;
|
|
|
|
bb1 = new BitBuffer(32,"A");
|
|
bb2 = new BitBuffer(32,"B");
|
|
|
|
bb1.set(0x0505);
|
|
bb2.set(0x14);
|
|
|
|
Console.WriteLine("bb1: {0}",BitFormat.toString(bb1.getLogicalBases()));
|
|
Console.WriteLine("bb2: {0}",BitFormat.toString(bb2.getLogicalBases()));
|
|
|
|
ADDX addx = new ADDX(bb1.getLogicalBases(),bb2.getLogicalBases());
|
|
|
|
Console.WriteLine("addx: {0}",BitFormat.toString(addx.getLogicalBases()));
|
|
|
|
ShiftLeft shl = new ShiftLeft(addx.getLogicalBases(0,addx.getBits()-1),4);
|
|
Console.WriteLine("shl: {0}",BitFormat.toString(shl.getLogicalBases()));
|
|
|
|
ShiftArithmeticRight shar = new ShiftArithmeticRight(shl.getLogicalBases(),2);
|
|
Console.WriteLine("shar: {0}",BitFormat.toString(shar.getLogicalBases()));
|
|
|
|
ShiftRight shr = new ShiftRight(shar.getLogicalBases(),2);
|
|
Console.WriteLine("shr: {0}",BitFormat.toString(shr.getLogicalBases()));
|
|
|
|
Invert inv = new Invert(shr.getLogicalBases());
|
|
Console.WriteLine("inv: {0}",BitFormat.toString(inv.getLogicalBases()));
|
|
|
|
BComplement bc = new BComplement(inv.getLogicalBases());
|
|
Console.WriteLine("bcomp: {0}",BitFormat.toString(bc.getLogicalBases()));
|
|
|
|
RotateLeft rol = new RotateLeft(bc.getLogicalBases(),8);
|
|
Console.WriteLine("rol: {0}",BitFormat.toString(rol.getLogicalBases()));
|
|
|
|
RotateRight ror = new RotateRight(rol.getLogicalBases(),19);
|
|
Console.WriteLine("ror: {0}",BitFormat.toString(ror.getLogicalBases()));
|
|
|
|
|
|
BitFormat.dumpBitIdentity(ror.getLogicalBase(0).identity());
|
|
|
|
Console.WriteLine("test ended. ---------------------");
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|