signal_bundles: add missing file
This commit is contained in:
		
							
								
								
									
										27
									
								
								src/main/scala/devices/pwm/PWMPins.scala
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/main/scala/devices/pwm/PWMPins.scala
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| // See LICENSE for license details. | ||||
| package sifive.blocks.devices.pwm | ||||
|  | ||||
| import Chisel._ | ||||
| import freechips.rocketchip.config.Field | ||||
| import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus} | ||||
| import freechips.rocketchip.diplomacy.{LazyModule, LazyMultiIOModuleImp} | ||||
| import freechips.rocketchip.util.HeterogeneousBag | ||||
| import sifive.blocks.devices.pinctrl.{Pin} | ||||
|  | ||||
| class PWMSignals[T <: Data] (pingen: ()=> T, val c: PWMParams) extends Bundle { | ||||
|  | ||||
|   val pwm: Vec[T] = Vec(c.ncmp, pingen()) | ||||
|  | ||||
|   override def cloneType: this.type = | ||||
|     this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type] | ||||
| } | ||||
|  | ||||
| class PWMPins[T <: Pin] (pingen: ()=> T, c: PWMParams) extends PWMSignals[T](pingen, c) | ||||
|  | ||||
| object PWMPinsFromPort { | ||||
|   def apply[T <: Pin] (pins: PWMSignals[T], port: PWMPortIO): Unit = { | ||||
|     (pins.pwm zip port.port)  foreach {case (pin, port) => | ||||
|       pin.outputPin(port) | ||||
|     } | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user