Commit ed7185ff authored by Jens Korinth's avatar Jens Korinth
Browse files

Add default implementations for VirtualRegister

* read returns None by default
* write returns the write value by default, does nothing
parent 17e328ed
......@@ -73,8 +73,8 @@ class Register(name: Option[String] = None, bitfield: BitfieldMap = Map(), width
**/
class VirtualRegister(name: Option[String] = None,
bitfield: BitfieldMap = Map(),
onRead: () => Option[UInt],
onWrite: UInt => UInt) extends ControlRegister(name, bitfield) {
var onRead: () => Option[UInt] = () => None,
var onWrite: UInt => UInt = v => v) extends ControlRegister(name, bitfield) {
def read() = onRead()
override def write(v: UInt) = onWrite(v)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment