예제 #1
0
        internal static void VerifyInferTypes(string moduleName, string extension, bool isVerilogVCD, string modulePath)
        {
            CircuitGraph graph = VerifyMakeGraph(moduleName, extension, modulePath);

            using VCD vcd = LoadVCD(moduleName, modulePath);

            foreach (var variables in vcd.Variables)
            {
                foreach (var variable in variables)
                {
                    ScalarIO varCon = graph.GetConnection(variable, isVerilogVCD);
                    if (varCon == null)
                    {
                        continue;
                    }

                    ref BinaryVarValue actual = ref varCon.GetValue();
                    if (!varCon.Value.IsInitialized())
                    {
                        continue;
                    }
                    if (variable.Size != actual.Bits.Length)
                    {
                        Console.WriteLine($"Ref: {variable.Reference}, Expected: {variable.Size}, Actual: {actual.Bits.Length}");
                    }
                    Assert.AreEqual(variable.Size, actual.Bits.Length);
                }
            }
예제 #2
0
        public void AddAnonymousInternalIO(ScalarIO io)
        {
            string uniqueName = $"~${UniqueNameGen++}";

            io.SetName(uniqueName);

            AddInternalIO(io);
        }
예제 #3
0
        private static bool MakeNoScopeIO(List <ScopedDirIO> inputIO, List <ScopedDirIO> outputIO, ScalarIO io, int fixedX, ref int inputYOffset, ref int outputYOffset, int scopeDepth, bool ignoreDisconnectedIO)
        {
            if (ignoreDisconnectedIO && !io.IsConnectedToAnything())
            {
                return(false);
            }

            scopeDepth = Math.Max(0, scopeDepth);
            if (io is Input)
            {
                int        scopeOffset = (scopeDepth + 1) * ScopeWidth;
                Point      inputPos    = new Point(0, inputYOffset);
                DirectedIO dirIO       = new DirectedIO(io, inputPos, MoveDirs.Right);
                inputIO.Add(new ScopedDirIO(dirIO, scopeOffset));

                inputYOffset += MinSpaceBetweenIO;
                return(true);
            }
            else if (io is Output)
            {
                int        scopeOffset = -(scopeDepth + 1) * ScopeWidth;
                Point      outputPos   = new Point(fixedX, outputYOffset);
                DirectedIO dirIO       = new DirectedIO(io, outputPos, MoveDirs.Right);
                outputIO.Add(new ScopedDirIO(dirIO, scopeOffset));

                outputYOffset += MinSpaceBetweenIO;
                return(true);
            }
            else
            {
                throw new Exception($"Unknown scalar io type. Type: {io}");
            }
        }