Exemple #1
0
 static void Main(string[] args)
 {
     using (var c = new QuokkaContainer()
                    .WithContentDomain(eContentDomain.Private)
                    .WithProjectTransformation <CloudTransformation>()
                    .WithRuntimeConfiguration(RuntimeConfiguration.FromCommandLineArguments(args)))
     {
         c.Resolve <QuokkaMain>().Run(args);
     }
 }
        public void BoardTimerModuleTest()
        {
            var  container     = new QuokkaContainer();
            var  runtimeConfig = container.Resolve <RuntimeConfiguration>();
            uint testClock     = 10;

            runtimeConfig.Initialize(new QuokkaConfig()
            {
                Configurations = new List <BoardConfigAttribute>()
                {
                    new BoardConfigAttribute()
                    {
                        Name = "Test", ClockFrequency = testClock
                    }
                }
            });

            var moduleInstance = container.Resolve <BoardTimerModule>();
            var sim            = new RTLInstanceSimulator <BoardTimerModule, BoardTimerModuleInputs>(moduleInstance, true);

            sim.TraceToVCD(VCDOutputPath());

            var topLevel = sim.TopLevel;

            for (var i = 1; i <= testClock * 10; i++)
            {
                Assert.AreEqual(i % testClock == 0, topLevel.OutActive10);
                Assert.AreEqual(i % (testClock * 2) == 0, topLevel.OutActive20);

                sim.ClockCycle(new BoardTimerModuleInputs());
            }

            var tb = sim.TBAdapter(RTLVerilogConfig);

            tb.PostSynthTimingSimulation();
        }
        public void VGAStaticQRModuleTest()
        {
            var config    = RuntimeConfigurationLoader.FromConfigFile(RTLVerilogConfig);
            var container = new QuokkaContainer()
                            .WithRuntimeConfiguration(config);
            var module = container.Resolve <VGAStaticQRModule>();

            var sim = new RTLInstanceSimulator <VGAStaticQRModule, VGAStaticQRModuleInputs>(module, true);
            var tb  = sim.TBAdapter(RTLVerilogConfig);

            tb.TranslateInstance();


            var tl           = sim.TopLevel;
            int pixelCounter = 0;

            uint[] pixels = new uint[800 * 600];

            for (int row = 0; row < 628; row++)
            {
                for (int col = 0; col < 1056; col++)
                {
                    if (tl.OutVisible)
                    {
                        pixels[pixelCounter] = (uint)(((tl.R ? 255 : 0) << 16) | ((tl.G ? 255 : 0) << 8) | (tl.B ? 255 : 0));
                        pixelCounter++;
                    }

                    sim.ClockCycle(new VGAStaticQRModuleInputs());
                }
            }

            Assert.AreEqual(800 * 600, pixelCounter);

            var resized = new Bitmap(800, 600);

            for (var row = 0; row < 600; row++)
            {
                for (var col = 0; col < 800; col++)
                {
                    resized.SetPixel(col, row, Color.FromArgb((int)(0xFF000000 | pixels[row * 800 + col])));
                }
            }
            resized.Save(PNGOutputPath(), ImageFormat.Png);
        }