Пример #1
0
func (m *OFDM) InitModules() {

	var totalModules int = 2

	/// AUTO CODE
	/// something try begins
	var minfo chipset.ModuleInfo
	m.Modules = make(map[string]chipset.ModuleInfo, totalModules)
	m.ModuleNames = make(map[int]string, totalModules)

	strlist := [2]string{"txmodule", "rxmodule"}
	for cnt := 0; cnt < len(strlist); cnt++ {
		m.ModuleNames[cnt] = strlist[cnt]
	}
	var temp, otemp []int

	minfo.Name = "txmodule"
	minfo.Id = 0
	minfo.Desc = ""

	temp = append(temp, m.PinByName("inputPin0").Id)

	otemp = append(otemp, m.PinByName("outputPin0").Id)

	minfo.InPins = temp
	minfo.OutPins = otemp
	method := reflect.ValueOf(m).MethodByName("Ifft")
	minfo.Function = method
	minfo.FunctionName = "Ifft"

	m.Modules["txmodule"] = minfo

	minfo.Name = "rxmodule"
	minfo.Id = 1
	minfo.Desc = ""

	temp = append(temp, m.PinByName("inputPin1").Id)

	otemp = append(otemp, m.PinByName("outputPin1").Id)

	minfo.InPins = temp
	minfo.OutPins = otemp
	method = reflect.ValueOf(m).MethodByName("Fft")
	minfo.Function = method
	minfo.FunctionName = "Fft"
	m.Modules["rxmodule"] = minfo

	/// AUTO CODE

	m.isInitialized = true
}
Пример #2
0
func (m *BitSource) InitModules() {
	var totalModules int = m.ModulesCount()
	m.Modules = make(map[string]chipset.ModuleInfo, totalModules)
	m.ModuleNames = make(map[int]string, totalModules)
	// b := [...]string{"Penn", "Teller"}
	strlist := [...]string{"genbit"}
	for i := 0; i < totalModules; i++ {
		m.ModuleNames[i] = strlist[i]
	}

	for i := 0; i < totalModules; i++ {
		var minfo chipset.ModuleInfo
		minfo.Name = m.ModuleNames[i]

		switch minfo.Name {
		case "genbit":
			minfo.Id = 0
			minfo.Desc = "Generates Uniformly distributed bits 0 and 1 at output pin 'bitOut' "
			minfo.InPins = []int{}
			minfo.OutPins = []int{m.PinByName("bitOut").Id}
			method := reflect.ValueOf(m).MethodByName("GenBit")
			minfo.Function = method
			// case "demodulate":
			// 	minfo.InPins = []int{1}
			// 	minfo.OutPins = []int{1}

		}
		m.Modules[minfo.Name] = minfo
	}

}
Пример #3
0
func (m *Modem) InitModules() {
	var totalModules int = m.ModulesCount()
	m.Modules = make(map[string]chipset.ModuleInfo, totalModules)
	m.ModuleNames = make(map[int]string, totalModules)
	// b := [...]string{"Penn", "Teller"}
	strlist := [...]string{"modulate", "demodulate"}
	for i := 0; i < totalModules; i++ {
		m.ModuleNames[i] = strlist[i]
	}

	for i := 0; i < totalModules; i++ {
		var minfo chipset.ModuleInfo
		minfo.Name = m.ModuleNames[i]

		switch minfo.Name {
		case "modulate":
			minfo.Desc = "This modulate modulates the input bits from Inpin 'bitIn' and writes to 'symbolOut' "
			minfo.Id = 0
			minfo.InPins = []int{m.PinByName("bitIn").Id}
			minfo.OutPins = []int{m.PinByName("symbolOut").Id}
			method := reflect.ValueOf(m).MethodByName("SayModulate")
			minfo.Function = method
			minfo.FunctionName = "SayModulate"

		case "demodulate":
			minfo.Desc = "This modulate DeModulates the input Symbols from Inpin 'symbolIn' and writes to 'bitOut' "
			minfo.Id = 1
			minfo.InPins = []int{m.PinByName("symbolIn").Id}
			minfo.OutPins = []int{m.PinByName("bitOut").Id}
			method := reflect.ValueOf(m).MethodByName("SayDemodulate")
			minfo.FunctionName = "SayDemodulate"
			minfo.Function = method

		}
		m.Modules[minfo.Name] = minfo
	}

}
Пример #4
0
func (m *ChannelEmulator) InitModules() {
	var totalModules int = m.ModulesCount()
	m.Modules = make(map[string]chipset.ModuleInfo, totalModules)
	m.ModuleNames = make(map[int]string, totalModules)
	// b := [...]string{"Penn", "Teller"}
	strlist := [...]string{"fadingChannel", "awgn"}
	for i := 0; i < totalModules; i++ {
		m.ModuleNames[i] = strlist[i]
	}

	for i := 0; i < totalModules; i++ {
		var minfo chipset.ModuleInfo
		minfo.Name = m.ModuleNames[i]

		switch minfo.Name {
		case "fadingChannel":
			minfo.Id = 0
			minfo.Desc = "This emulates a 1-tap fading (multiplicative) channel"
			minfo.InPins = []int{m.PinByName("symbolIn").Id}
			minfo.OutPins = []int{m.PinByName("symbolOut").Id}
			method := reflect.ValueOf(m).MethodByName("FadingChannel")
			minfo.Function = method

		case "awgn":
			minfo.Id = 1
			minfo.Desc = "This emulates additive white noise to the input signal "
			minfo.InPins = []int{m.PinByName("symbolIn").Id}
			minfo.OutPins = []int{m.PinByName("symbolOut").Id}
			method := reflect.ValueOf(m).MethodByName("AWGNChannel")
			minfo.Function = method

		}
		m.Modules[minfo.Name] = minfo
	}

}