struct Crybus::Connector::Segment

Overview

An address chunk assigned to this connector.
Each segment takes up a portion of address space
and has an individual output and input proc (function pointer).

Segments can act as either one connection to the bus or a chain of connections which would function similarly to IO registers, with each segment having a seperate output and input proc based of what that register should do when being read/written.

Defined in:

cry-bus/connector.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(start_adr : UInt32, length : UInt32, seg_out : Proc(UInt32, UInt8), seg_in : Proc(UInt32, UInt8, Nil)) #

Creates a new segment given its start address, size, and IO procs.


[View source]
def self.new(start_adr : UInt32, seg_out : Proc(UInt32, UInt8), seg_in : Proc(UInt32, UInt8, Nil)) #

Creates a new segment given its start address and IO procs.
end_adr is set to start_adr + 1


[View source]

Instance Method Detail

def end_adr : UInt32 #

The address in which the bus will no longer see this segment


[View source]
def seg_in : Proc(UInt32, UInt8, Nil) #

The function for when the segment is called to input.
Takes an address and the 8 bit data


[View source]
def seg_out : Proc(UInt32, UInt8) #

The function for when the segment is called to output.
Takes an address. Returns the 8 bit data


[View source]
def start_adr : UInt32 #

The address in which the bus will begin to see this segment


[View source]
def would_hit?(address : UInt32) : Bool #

Returns whether or not an address is within this segments address space


[View source]