using FxpConvert.Common;
using NIFPGA;
using System.Diagnostics.CodeAnalysis;
/*
*{4}
*/
namespace {0}
{{
    public class {1}
    {{
        [AllowNull]
        private static {1} myFpga;
        [AllowNull]
        private NIFPGA.FPGA fpga;
        private {1}(IFxpConvert convert)
        {{
            fpga = new FPGA(convert);
        }}
        static {1}()
        {{

        }}
        {2}
        {3}
        public Irq Irq => fpga.Irq;
        public void Open(string bitfile, string resource, NiFpga_OpenAttribute attribute) => fpga.Open(bitfile, resource, attribute);
        public void Close() => fpga.Close();
        public void Run() => fpga.Run();
        public void Download() => fpga.Download();
        public void Abort() => fpga.Abort();
        public void Reset() => fpga.Reset();
        public static {1} CreateFpga(IFxpConvert convert)
        {{
            
            if(myFpga ==null)
            {{
                myFpga = new {1}(convert);
            }}
            return myFpga;
        }}
        public static {1} Instance
        {{
            get
            {{
                if(myFpga ==null)
                {{
                    throw new Exception($"must call first {{CreateFpga}}");
                }}
                return myFpga;
            }}
        }}
    }}
}}
