OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [tools/] [z80_pla_checker/] [source/] [ClassPLA.cs] - Diff between revs 3 and 8

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 8
´╗┐using System;
´╗┐using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Linq;
namespace z80_pla_checker
namespace z80_pla_checker
{
{
    /// 
    /// 
    /// This class defines a complete PLA table and operations on it
    /// This class defines a complete PLA table and operations on it
    /// 
    /// 
    class ClassPla
    class ClassPla
    {
    {
        /// 
        /// 
        /// List of all PLA entries that we read from the input file
        /// List of all PLA entries that we read from the input file
        /// 
        /// 
        private readonly List pla = new List();
        private readonly List pla = new List();
        /// 
        /// 
        /// List of PLA entries which we want to ignore for various reasons
        /// List of PLA entries which we want to ignore for various reasons
        /// 
        /// 
        public List IgnoredPla = new List();
        public List IgnoredPla = new List();
        /// 
        /// 
 
        /// List of PLA entries not used by our Timings matrix
 
        /// 
 
        public List NotUsedPla = new List();
 
 
 
        /// 
        /// Returns the total number of PLA table entries
        /// Returns the total number of PLA table entries
        /// 
        /// 
        public int Count()
        public int Count()
        {
        {
            return pla.Count();
            return pla.Count();
        }
        }
        /// 
        /// 
        /// Read the master PLA table from a text file
        /// Read the master PLA table from a text file
        /// 
        /// 
        public bool Load(string filename)
        public bool Load(string filename)
        {
        {
            // Read each line of the file into a string array. Each element
            // Read each line of the file into a string array. Each element
            // of the array is one line of the file.
            // of the array is one line of the file.
            ClassLog.Log("Loading PLA: " + filename);
            ClassLog.Log("Loading PLA: " + filename);
            try
            try
            {
            {
                string[] lines = File.ReadAllLines(filename);
                string[] lines = File.ReadAllLines(filename);
                pla.Clear();
                pla.Clear();
                foreach (string line in lines)
                foreach (string line in lines)
                {
                {
                    if (line[0] == '#')
                    if (line[0] == '#')
                        continue;
                        continue;
                    var p = new ClassPlaEntry();
                    var p = new ClassPlaEntry();
                    if (p.Init(line))
                    if (p.Init(line))
                        pla.Add(p);
                        pla.Add(p);
                }
                }
            }
            }
            catch (Exception ex)
            catch (Exception ex)
            {
            {
                ClassLog.Log(ex.Message);
                ClassLog.Log(ex.Message);
                return false;
                return false;
            }
            }
            ClassLog.Log(string.Format("Total {0} PLA lines", pla.Count()));
            ClassLog.Log(string.Format("Total {0} PLA lines", pla.Count()));
            ////============================================================
            ////============================================================
            //// Ignore duplicate PLA entries
            //// Ignore duplicate PLA entries
 
            //IgnoredPla.Add(98);     // Duplicate of 37
 
            //IgnoredPla.Add(94);     // Duplicate of 12 and 18
 
            //IgnoredPla.Add(93);     // Duplicate of 11 and 19
            //IgnoredPla.Add(90);     // Duplicate of 26
            //IgnoredPla.Add(90);     // Duplicate of 26
            //IgnoredPla.Add(36);     // Duplicate of 8
            //IgnoredPla.Add(87);     // Duplicate of 83
            //IgnoredPla.Add(71);     // Duplicate of 25
            //IgnoredPla.Add(71);     // Duplicate of 25
            //IgnoredPla.Add(63);     // Duplicate of 17
            //IgnoredPla.Add(63);     // Duplicate of 17
            //IgnoredPla.Add(87);     // Duplicate of 83
 
            //IgnoredPla.Add(60);     // Duplicate of 15
            //IgnoredPla.Add(60);     // Duplicate of 15
            //IgnoredPla.Add(94);     // Duplicate of 12 and 18
 
            //IgnoredPla.Add(18);     // Duplicate of 12 and 94
 
            //IgnoredPla.Add(93);     // Duplicate of 11 and 19
 
            //IgnoredPla.Add(19);     // Duplicate of 11 and 93
 
            //IgnoredPla.Add(98);     // Duplicate of 37
 
            //IgnoredPla.Add(41);     // Duplicate of 3
            //IgnoredPla.Add(41);     // Duplicate of 3
 
            //IgnoredPla.Add(36);     // Duplicate of 8
            //IgnoredPla.Add(32);     // Duplicate of 4
            //IgnoredPla.Add(32);     // Duplicate of 4
 
            //IgnoredPla.Add(19);     // Duplicate of 11 and 93
 
            //IgnoredPla.Add(18);     // Duplicate of 12 and 94
 
 
            ////============================================================
            ////============================================================
            //// Special signals (not instructions)
            //// Special signals (not instructions)
            //IgnoredPla.Add(91);     // This signal goes along block IN/OUT instructions.
            //IgnoredPla.Add(91);     // This signal goes along block IN/OUT instructions.
            //IgnoredPla.Add(75);     // This signal specifies a decrement operation for PLA 53, 66 and 105. Otherwise, it is an increment.
            //IgnoredPla.Add(75);     // This signal specifies a decrement operation for PLA 53, 66 and 105. Otherwise, it is an increment.
            //IgnoredPla.Add(55);     // This signal specifies (HL) addressing for all CB-table instructions, PLA entries 70, 72, 73, 74.
            //IgnoredPla.Add(55);     // This signal specifies (HL) addressing for all CB-table instructions, PLA entries 70, 72, 73, 74.
            //IgnoredPla.Add(44);     // This signal specifies a regular CB opcode (ignoring IX/IY).
            //IgnoredPla.Add(44);     // This signal specifies a regular CB opcode (ignoring IX/IY).
            //IgnoredPla.Add(33);     // This signal specifies whether the register is being loaded or stored to memory for PLA entry 31.
            //IgnoredPla.Add(33);     // This signal specifies whether the register is being loaded or stored to memory for PLA entry 31.
            //IgnoredPla.Add(28);     // This signal specifies the OUT operation for PLA 37. Otherwise, it is operation.
            //IgnoredPla.Add(28);     // This signal specifies the OUT operation for PLA 37. Otherwise, it is operation.
            //IgnoredPla.Add(27);     // This signal goes along individual IN/OUT instructions in the ED table.
            //IgnoredPla.Add(27);     // This signal goes along individual IN/OUT instructions in the ED table.
            //IgnoredPla.Add(16);     // This signal specifies a PUSH operation for PLA23. Otherwise, it is a POP operation.
            //IgnoredPla.Add(16);     // This signal specifies a PUSH operation for PLA23. Otherwise, it is a POP operation.
            //IgnoredPla.Add(14);     // This signal specifies a decrement operation for PLA 9. Otherwise, it is an increment.
 
            //IgnoredPla.Add(13);     // This signal specifies whether the value is being loaded or stored for PLA entries 8, 30 and 38.
            //IgnoredPla.Add(13);     // This signal specifies whether the value is being loaded or stored for PLA entries 8, 30 and 38.
            //IgnoredPla.Add(4);      // This signal goes along instructions that access I and R register (PLA 57 and 83).
 
            //IgnoredPla.Add(0);      // This signal specifies *not* to repeat block instructions.
            //IgnoredPla.Add(0);      // This signal specifies *not* to repeat block instructions.
            ////============================================================
            ////============================================================
            //// Ignore our own reserved entries
            //// Ignore our own reserved entries
            //IgnoredPla.Add(106);
 
            //IgnoredPla.Add(107);
            //IgnoredPla.Add(107);
 
            //IgnoredPla.Add(106);
 
 
            //============================================================
            //============================================================
            // Remove op-bits so we the output is more readable
            // Remove op-bits so we the output is more readable
            IgnoredPla.Add(99);
            IgnoredPla.Add(99);
            IgnoredPla.Add(100);
            IgnoredPla.Add(100);
            IgnoredPla.Add(101);
            IgnoredPla.Add(101);
            IgnoredPla.Add(102);
            IgnoredPla.Add(102);
            IgnoredPla.Add(103);
            IgnoredPla.Add(103);
            IgnoredPla.Add(104);
            IgnoredPla.Add(104);
            // Remove ALU operation entries so the output is more readable
            // Remove ALU operation entries so the output is more readable
            IgnoredPla.Add(88);
            IgnoredPla.Add(88);
            IgnoredPla.Add(86);
            IgnoredPla.Add(86);
            IgnoredPla.Add(85);
            IgnoredPla.Add(85);
            IgnoredPla.Add(84);
            IgnoredPla.Add(84);
            IgnoredPla.Add(80);
            IgnoredPla.Add(80);
            IgnoredPla.Add(79);
            IgnoredPla.Add(79);
            IgnoredPla.Add(78);
            IgnoredPla.Add(78);
            IgnoredPla.Add(76);
            IgnoredPla.Add(76);
            //============================================================
            //============================================================
 
            // Signals not used in the Timings spreadsheet. For those, PLA table entries are not generated.
 
            // This list is used only when generating the PLA table.
 
            NotUsedPla.Add(67);       // This signal defines a specific in(), but we use in/out pla[27] + pla[34]
 
            NotUsedPla.Add(62);       // This signal is issued for all CB opcodes
 
            NotUsedPla.Add(54);       // This signal specifies every CB with IX/IY
 
            NotUsedPla.Add(22);       // This signal specifies CB prefix w/o IX/IY
 
            NotUsedPla.Add(14);       // This signal specifies a decrement operation for PLA 9. Otherwise, it is an increment.
 
            NotUsedPla.Add(4);        // This signal goes along instructions that access I and R register (PLA 57 and 83).
 
 
 
            //============================================================
            // Mark all PLA entries we decided to ignore
            // Mark all PLA entries we decided to ignore
            foreach (var p in pla)
            foreach (var p in pla)
            {
            {
                if (IgnoredPla.Contains(p.N))
                if (IgnoredPla.Contains(p.N))
                    p.Ignored = true;
                    p.Ignored = true;
            }
            }
            return true;
            return true;
        }
        }
        /// 
        /// 
        /// Dumps the content of the entire PLA table
        /// Dumps the content of the entire PLA table
        /// 
        /// 
        public void Dump()
        public void Dump()
        {
        {
            ClassLog.Log("Content of the PLA table:");
            ClassLog.Log("Content of the PLA table:");
            foreach (var p in pla.Where(p => !p.IsDuplicate()))
            foreach (var p in pla.Where(p => !p.IsDuplicate()))
                ClassLog.Log(p.Raw);
                ClassLog.Log(p.Raw);
        }
        }
        /// 
        /// 
        /// Find and return all PLA table entries that trigger on a given condition.
        /// Find and return all PLA table entries that trigger on a given condition.
        /// 
        /// 
        public List TableMatch(ClassPlaEntry.Modifier modifier, byte instr)
        public List TableMatch(ClassPlaEntry.Modifier modifier, byte instr)
        {
        {
            var t = new bool[pla.Count];
            var t = new bool[pla.Count];
            // First do a simple search to find the list of *all* PLA entries that match
            // First do a simple search to find the list of *all* PLA entries that match
            foreach (var p in pla)
            foreach (var p in pla)
            {
            {
                if (p.Ignored) continue;
                if (p.Ignored) continue;
                String match = p.Match(modifier, instr);
                String match = p.Match(modifier, instr);
                t[p.N] = !string.IsNullOrEmpty(match);
                t[p.N] = !string.IsNullOrEmpty(match);
            }
            }
            ////============================================================
            ////============================================================
            //// Apply any intra-PLA conditions. These are hard-coded into the
            //// Apply any intra-PLA conditions. These are hard-coded into the
            //// timing spreadsheet and we are duplicating them here:
            //// timing spreadsheet and we are duplicating them here:
            //// INC/DEC variations with register, (hl) or (ix+d)
            //// INC/DEC variations with register, (hl) or (ix+d)
            //if (t[66] && !(t[53] || t[105])) ; else t[66] = false;
            //if (t[66] && !(t[53] || t[105])) ; else t[66] = false;
            //// Generic LD r,r' + (hl), IX variations and on top of that NHALT
            //// Generic LD r,r' + (hl), IX variations and on top of that NHALT
            //if (t[61] && !(t[59] || t[103] || t[58] || t[102] || t[95])) ; else t[61] = false;
            //if (t[61] && !(t[59] || t[103] || t[58] || t[102] || t[95])) ; else t[61] = false;
            //if (t[58] && !t[95]) ; else t[58] = false;
            //if (t[58] && !t[95]) ; else t[58] = false;
            //if (t[102] && !t[95]) ; else t[102] = false;
            //if (t[102] && !t[95]) ; else t[102] = false;
            //if (t[59] && !t[95]) ; else t[59] = false;
            //if (t[59] && !t[95]) ; else t[59] = false;
            //if (t[103] && !t[95]) ; else t[103] = false;
            //if (t[103] && !t[95]) ; else t[103] = false;
            //// A single LD (hl),n and LD (ix+d),n has precedence over a set of LD r,n
            //// A single LD (hl),n and LD (ix+d),n has precedence over a set of LD r,n
            //if (t[17] && !(t[40] || t[50])) ; else t[17] = false;
            //if (t[17] && !(t[40] || t[50])) ; else t[17] = false;
            //// ALU A,r' and variations on (hl) and (ix+d)
            //// ALU A,r' and variations on (hl) and (ix+d)
            //if (t[65] && !(t[52] || t[104])) ; else t[65] = false;
            //if (t[65] && !(t[52] || t[104])) ; else t[65] = false;
            //// ALU
            //// ALU
            //if (t[88] && (t[65] || t[64] || t[52] || t[104])) ; else t[88] = false;
            //if (t[88] && (t[65] || t[64] || t[52] || t[104])) ; else t[88] = false;
            //if (t[86] && (t[65] || t[64] || t[52] || t[104])) ; else t[86] = false;
            //if (t[86] && (t[65] || t[64] || t[52] || t[104])) ; else t[86] = false;
            //if (t[85] && (t[65] || t[64] || t[52] || t[104])) ; else t[85] = false;
            //if (t[85] && (t[65] || t[64] || t[52] || t[104])) ; else t[85] = false;
            //if (t[84] && (t[65] || t[64] || t[52] || t[104])) ; else t[84] = false;
            //if (t[84] && (t[65] || t[64] || t[52] || t[104])) ; else t[84] = false;
            //if (t[80] && (t[65] || t[64] || t[52] || t[104])) ; else t[80] = false;
            //if (t[80] && (t[65] || t[64] || t[52] || t[104])) ; else t[80] = false;
            //if (t[79] && (t[65] || t[64] || t[52] || t[104])) ; else t[79] = false;
            //if (t[79] && (t[65] || t[64] || t[52] || t[104])) ; else t[79] = false;
            //if (t[78] && (t[65] || t[64] || t[52] || t[104])) ; else t[78] = false;
            //if (t[78] && (t[65] || t[64] || t[52] || t[104])) ; else t[78] = false;
            //if (t[76] && (t[65] || t[64] || t[52] || t[104])) ; else t[76] = false;
            //if (t[76] && (t[65] || t[64] || t[52] || t[104])) ; else t[76] = false;
            //============================================================
            //============================================================
            // Finally, collect and return all PLA entries that are left asserted
            // Finally, collect and return all PLA entries that are left asserted
            return (from p in pla
            return (from p in pla
                    where t[p.N]
                    where t[p.N]
                    select p.Match(modifier, instr)).ToList();
                    select p.Match(modifier, instr)).ToList();
        }
        }
        /// 
        /// 
        /// Given the PLA ID, return a list of all opcodes that trigger it
        /// Given the PLA ID, return a list of all opcodes that trigger it
        /// 
        /// 
        public List MatchPLA(ClassPlaEntry.Modifier modifier, int id)
        public List MatchPLA(ClassPlaEntry.Modifier modifier, int id)
        {
        {
            var m = new List();
            var m = new List();
            // Find the pla with a given index
            // Find the pla with a given index
            foreach (ClassPlaEntry p in pla)
            foreach (ClassPlaEntry p in pla)
            {
            {
                if (p.N == id)
                if (p.N == id)
                {
                {
                    // For each possible opcode...
                    // For each possible opcode...
                    for (int i = 0; i < 256; i++)
                    for (int i = 0; i < 256; i++)
                    {
                    {
                        String match = p.Match(modifier, Convert.ToByte(i));
                        String match = p.Match(modifier, Convert.ToByte(i));
                        if (!string.IsNullOrEmpty(match))
                        if (!string.IsNullOrEmpty(match))
                            m.Add(string.Format("{0:X02} => {1}", i, match));
                            m.Add(string.Format("{0:X02} => {1}", i, match));
                    }
                    }
                    return m;
                    return m;
                }
                }
            }
            }
            ClassLog.Log("Non-existent PLA index");
            ClassLog.Log("Non-existent PLA index");
            return m;
            return m;
        }
        }
        /// 
        /// 
        /// Dump opcode table in various ways.
        /// Dump opcode table in various ways.
        /// Returns a "selected" list of opcode numbers, that is, opcodes which were tagged by
        /// Returns a "selected" list of opcode numbers, that is, opcodes which were tagged by
        /// the optional input PLA table number given in arg parameter.
        /// the optional input PLA table number given in arg parameter.
        /// 
        /// 
        public List Table(ClassPlaEntry.Modifier modifier, int testNum, int arg)
        public List Table(ClassPlaEntry.Modifier modifier, int testNum, int arg)
        {
        {
            ClassLog.Log(new string('-', 242));
            ClassLog.Log(new string('-', 242));
            List tagged = new List();
            List tagged = new List();
            for (int y = 0; y < 16; y++)
            for (int y = 0; y < 16; y++)
            {
            {
                string line = string.Format("{0:X} ", y);
                string line = string.Format("{0:X} ", y);
                for (int x = 0; x < 16; x++)
                for (int x = 0; x < 16; x++)
                {
                {
                    char prefix = ' ';
                    char prefix = ' ';
                    byte opcode = Convert.ToByte(y * 16 + x);
                    byte opcode = Convert.ToByte(y * 16 + x);
                    List match = TableMatch(modifier, opcode);
                    List match = TableMatch(modifier, opcode);
                    foreach (string oneMatch in match.Where(oneMatch => Convert.ToInt32(oneMatch.Substring(1, oneMatch.LastIndexOf(']') - 1)) == arg))
                    foreach (string oneMatch in match.Where(oneMatch => Convert.ToInt32(oneMatch.Substring(1, oneMatch.LastIndexOf(']') - 1)) == arg))
                    {
                    {
                        tagged.Add(y * 16 + x);
                        tagged.Add(y * 16 + x);
                        prefix = '*';
                        prefix = '*';
                    }
                    }
                    string entry = "";
                    string entry = "";
                    //===============================================================================
                    //===============================================================================
                    // Table 0 - Show the number of PLA entries that match each opcode
                    // Table 0 - Show the number of PLA entries that match each opcode
                    //===============================================================================
                    //===============================================================================
                    if (testNum == 0)
                    if (testNum == 0)
                    {
                    {
                        entry = string.Join(",", match);
                        entry = string.Join(",", match);
                        if (match.Count == 0)
                        if (match.Count == 0)
                            entry = ".";
                            entry = ".";
                        if (match.Count > 1)
                        if (match.Count > 1)
                            entry = "[" + match.Count + "]";
                            entry = "[" + match.Count + "]";
                    }
                    }
                    //===============================================================================
                    //===============================================================================
                    // Table 1 - For each opcode, show all PLA entries that trigger
                    // Table 1 - For each opcode, show all PLA entries that trigger
                    //===============================================================================
                    //===============================================================================
                    if (testNum == 1)
                    if (testNum == 1)
                    {
                    {
                        foreach (string oneMatch in match)
                        foreach (string oneMatch in match)
                        {
                        {
                            string n = oneMatch.Substring(1, oneMatch.LastIndexOf(']') - 1);
                            string n = oneMatch.Substring(1, oneMatch.LastIndexOf(']') - 1);
                            entry += n + ",";
                            entry += n + ",";
                        }
                        }
                        entry = entry.TrimEnd(',');
                        entry = entry.TrimEnd(',');
                    }
                    }
                    // -------------------------------------------
                    // -------------------------------------------
                    if (entry.Length > 12)
                    if (entry.Length > 12)
                        entry = entry.Substring(0, 12);
                        entry = entry.Substring(0, 12);
                    line += string.Format(" |{0}{1,-12}", prefix, entry);
                    line += string.Format(" |{0}{1,-12}", prefix, entry);
                }
                }
                ClassLog.Log(line);
                ClassLog.Log(line);
            }
            }
            return tagged;
            return tagged;
        }
        }
        /// 
        /// 
        /// Query PLA table string given as a vector of 0's and 1's
        /// Query PLA table string given as a vector of 0's and 1's
        /// This vector is coped from a ModelSim simulation run. The function will decode PLA string
        /// This vector is coped from a ModelSim simulation run. The function will decode PLA string
        /// into a set of PLA entries that are being triggered ("1")
        /// into a set of PLA entries that are being triggered ("1")
        /// 
        /// 
        public void QueryPla(String bits)
        public void QueryPla(String bits)
        {
        {
            int max = pla.Count();
            int max = pla.Count();
            if (bits.Count() != max)
            if (bits.Count() != max)
            {
            {
                ClassLog.Log("Invalid PLA length - the bit array should be " + max + " and it is " + bits.Count());
                ClassLog.Log("Invalid PLA length - the bit array should be " + max + " and it is " + bits.Count());
                return;
                return;
            }
            }
            for (int i = 0; i < max; i++)
            for (int i = 0; i < max; i++)
                if (bits[max - i - 1] == '1')
                if (bits[max - i - 1] == '1')
                    ClassLog.Log(string.Format(@"pla[{0,3}] = 1;   // {1}", pla[i].N, pla[i].Comment));
                    ClassLog.Log(string.Format(@"pla[{0,3}] = 1;   // {1}", pla[i].N, pla[i].Comment));
        }
        }
        /// 
        /// 
        /// Generates a Verilog module with the PLA logic
        /// Generates a Verilog module with the PLA logic
        /// 
        /// 
        public void GenVerilogPla()
        public void GenVerilogPla()
        {
        {
            string max = (pla.Count() - 1).ToString();
            string max = (pla.Count() - 1).ToString();
            string module = "";
            string module = "";
            module += @"//=====================================================================================" + Environment.NewLine;
            module += @"//=====================================================================================" + Environment.NewLine;
            module += @"// This file is automatically generated by the z80_pla_checker tool. Do not edit!      " + Environment.NewLine;
            module += @"// This file is automatically generated by the z80_pla_checker tool. Do not edit!      " + Environment.NewLine;
            module += @"//=====================================================================================" + Environment.NewLine;
            module += @"//=====================================================================================" + Environment.NewLine;
            module += @"module pla_decode (opcode, prefix, pla);" + Environment.NewLine;
            module += @"module pla_decode" + Environment.NewLine;
 
            module += @"(" + Environment.NewLine;
 
            module += @"    input wire [6:0] prefix," + Environment.NewLine;
 
            module += @"    input wire [7:0] opcode," + Environment.NewLine;
 
            module += @"    output wire [" + max + ":0] pla" + Environment.NewLine;
 
            module += @");" + Environment.NewLine;
            module += @"" + Environment.NewLine;
            module += @"" + Environment.NewLine;
            module += @"input wire [6:0] prefix;" + Environment.NewLine;
 
            module += @"input wire [7:0] opcode;" + Environment.NewLine;
 
            module += @"output reg [" + max + ":0] pla;" + Environment.NewLine;
 
            module += @"" + Environment.NewLine;
 
            module += @"always_comb" + Environment.NewLine;
 
            module += @"begin" + Environment.NewLine;
 
 
 
            foreach (var p in pla)
            foreach (var p in pla)
            {
            {
                if (p.IsDuplicate())
                if (p.IsDuplicate() || NotUsedPla.Contains(p.N))
                    continue;
                    continue;
 
 
                String bitstream = p.GetBitstream();
                String bitstream = p.GetBitstream();
                module += string.Format(@"    if ({{prefix[6:0], opcode[7:0]}} ==? 15'b{0})  pla[{1,3}]=1'b1; else pla[{1,3}]=1'b0;   // {2}",
                module += string.Format(@"assign pla[{0,3}] = (({{prefix[6:0], opcode[7:0]}} & 15'b{1}) == 15'b{2}) ? 1'b1 : 1'b0;   // {3}",
                    bitstream, p.N, p.Comment) + Environment.NewLine;
                    p.N,
 
                    bitstream.Replace('0', '1').Replace('X', '0'),  // Create "AND" mask
 
                    bitstream.Replace('X', '0'),                    // Create a value to compare to
 
                    p.Comment) + Environment.NewLine;
 
            }
 
 
 
            // List all PLA entries that are not used
 
            module += @"" + Environment.NewLine;
 
            module += @"// Entries not used by our timing matrix" + Environment.NewLine;
 
            foreach (var n in NotUsedPla)
 
            {
 
                module += string.Format(@"assign pla[{0,3}] = 1'b0;   // {1}", n, pla[n].Comment) + Environment.NewLine;
            }
            }
 
 
            // Dump all PLA entries that are ignored
            // List all PLA entries that are ignored
            module += @"" + Environment.NewLine;
            module += @"" + Environment.NewLine;
            module += @"    // Duplicate or ignored entries" + Environment.NewLine;
            module += @"// Duplicate entries" + Environment.NewLine;
            foreach (var p in pla)
            foreach (var p in pla)
            {
            {
                if (p.IsDuplicate())
                if (p.IsDuplicate())
                    module += string.Format(@"    pla[{0,3}]=1'b0;   // {1}", p.N, p.Comment) + Environment.NewLine;
                    module += string.Format(@"assign pla[{0,3}] = 1'b0;   // {1}", p.N, p.Comment) + Environment.NewLine;
            }
            }
 
 
            module += @"end" + Environment.NewLine;
 
            module += @"" + Environment.NewLine;
            module += @"" + Environment.NewLine;
            module += @"endmodule" + Environment.NewLine;
            module += @"endmodule" + Environment.NewLine;
            ClassLog.Log(module);
            ClassLog.Log(module);
        }
        }
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.