Example #1
0
        private void WriteProcess()
        {
            if (Bus2IP_Clk.RisingEdge())
            {
                if (Bus2IP_Resetn.Cur == '0')
                {
                    for (int i = 0; i < NumWriteSignals; i++)
                    {
                        ProgramFlow.Unroll();
                        GetWriteSignal(i).NextObject = GetWriteSignal(i).InitialValueObject;
                    }
                }
                else
                {
                    for (int reg = 0; reg < NumRegs; reg++)
                    {
                        ProgramFlow.Unroll();

                        if (Bus2IP_WrCE.Cur[NumRegs - reg - 1] == '1')
                        {
                            for (int byteIdx = 0; byteIdx < SLVDWidth / 8; byteIdx++)
                            {
                                ProgramFlow.Unroll();

                                if (Bus2IP_BE.Cur[byteIdx] == '1')
                                {
                                    for (int bitIdx = 0; bitIdx < 8; bitIdx++)
                                    {
                                        ProgramFlow.Unroll();
                                        if (IsWriteBitPresent(reg, byteIdx, bitIdx))
                                        {
                                            GetWriteBit(reg, byteIdx, bitIdx).Next = Bus2IP_Data.Cur[8 * byteIdx + bitIdx];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        private void ReadProcess()
        {
            StdLogicVector result = StdLogicVector._0s(SLVDWidth);

            for (int reg = 0; reg < NumRegs; reg++)
            {
                ProgramFlow.Unroll();

                if (Bus2IP_RdCE.Cur[NumRegs - reg - 1] == '1')
                {
                    for (int bit = 0; bit < SLVDWidth; bit++)
                    {
                        ProgramFlow.Unroll();

                        if (IsReadBitPresent(reg, bit))
                        {
                            result[bit] |= GetReadBit(reg, bit).Cur;
                        }
                    }
                }
            }

            IP2Bus_Data.Next = result;
        }