Issie logo Issie

ArrayExpand Module

Types

Type Description

ArrayProblem

Something wrong with an array component's sheet: what to say, and what to point at. The message says WHAT IS NOT ALLOWED and stops. Why it is not allowed belongs in the documentation - a user reading an error is trying to fix a sheet, not to learn the design of the feature, and a sentence of reasoning after the fault buries it. Components are what the simulator highlights in red, so a problem names the ones a user has to look at. Empty only where the fault is the sheet's own settings and no component is at fault.

JoinEnd

One end of a channel: a join component, in one copy, on the channel that copy puts it on.

JoinWiring

What the joins of an array design sheet come to.

OutlinePort

One port of an array component's outline: what it is called, how wide it is, which drawn component it comes from, and what the array does with it.

PortRole

What the array does with one of its own ports - which is also how the wrapper must wire it. The reason this is a type rather than two functions: the sheet's SIGNATURE and the wrapper that realises it are the same seven rules read two ways, and stating them twice is how a sheet's declared ports and its wrapper's actual ports come to disagree. They are stated once, here, and arrayOutlineOf takes the names and widths off them while ArrayElaborate builds the components.

Functions and values

Function or value Description

arrayOutlineOf info paramDefs (arg3, arg4)

Full Usage: arrayOutlineOf info paramDefs (arg3, arg4)

Parameters:
Returns: ((string * int) list * (string * int) list) * ArrayProblem list

The array component's ports as names and widths - what every sheet signature is - and what is wrong with the sheet if anything.

info : ArrayInfo
paramDefs : ParameterDefs option
arg2 : Component list
arg3 : Connection list
Returns: ((string * int) list * (string * int) list) * ArrayProblem list

arraySelectWidth copies

Full Usage: arraySelectWidth copies

Parameters:
    copies : int

Returns: int

How many bits the select input of an array multiplexer has: enough to index the copies, and never zero, since a width of zero is not a width. ceil(log2 copies), counted by shifting an int rather than through ParameterTypes.clog2, which takes a bigint. A copy count is small by construction - ArrayElaborate.Constants.maxArrayCopies bounds it, as a bus width is bounded - so converting one to a bigint to count its bits would be work for nothing. The same answer as clog2 for every value this is asked about.

copies : int
Returns: int

joinInPortName label num

Full Usage: joinInPortName label num

Parameters:
    label : string
    num : int

Returns: string

The name of the sheet port an unmatched JoinIn becomes. The direction is in the name as well as in the port list so that the two ends of one channel read apart, and so that the generated names sit further from anything a user would write.

label : string
num : int
Returns: string

joinOutPortName label num

Full Usage: joinOutPortName label num

Parameters:
    label : string
    num : int

Returns: string

The name of the sheet port an unmatched JoinOut becomes.

label : string
num : int
Returns: string

joinsOf info paramDefs (arg3, arg4)

Full Usage: joinsOf info paramDefs (arg3, arg4)

Parameters:
Returns: JoinWiring

Which JoinOut in which copy drives which JoinIn in which copy, and which ends are left over. The one place join semantics live. parseDiagramSignature asks it what ports the sheet has, and the expansion asks it what wires to draw between the copies, so the two cannot disagree about which end of a chain is loose. A JoinOut end and a JoinIn end MATCH when they carry the same label and the same channel number; a match is a wire from one copy to another. Everything left over becomes a port on the sheet's outline - an unmatched JoinOut an output, an unmatched JoinIn an input - which is what makes the ends of a chain the array's own connections without anything having to say which copies they are.

info : ArrayInfo
paramDefs : ParameterDefs option
arg2 : Component list
arg3 : Connection list
Returns: JoinWiring

looseEndsOf ends comp

Full Usage: looseEndsOf ends comp

Parameters:
Returns: (int * JoinEnd list) list

The unmatched ends of one join component, grouped by the channel they are on and in channel order, so that a sheet with several loose ends lists them predictably. One PORT per channel, and EVERY end on that channel with it. A port is named after the channel, so a channel several copies are loose on can only be one port - but it is a port of all of them, and each has to be wired to it. A number that does not vary with the loop variable is the extreme case (every copy on one channel); `i/2` is the ordinary one, giving the array one input per pair of copies. Keeping one end per channel and dropping the rest wired the first copy and left the others' body ports dangling, which came out as an unconnected port on a sheet the user cannot open.

ends : JoinEnd list
comp : Component
Returns: (int * JoinEnd list) list

muxSelectPortName label

Full Usage: muxSelectPortName label

Parameters:
    label : string

Returns: string

The name of the select input a MuxOut adds to the sheet, beside the output of its own name.

label : string
Returns: string

outlinePortsOf info paramDefs (arg3, arg4)

Full Usage: outlinePortsOf info paramDefs (arg3, arg4)

Parameters:
Returns: (OutlinePort list * OutlinePort list) * JoinWiring

The ports an array design sheet has, and what is wrong with the sheet if anything. DERIVED from the sheet's contents and its copy count, rather than being its Input1 and Output components - which is the whole of what makes an array sheet different from every other sheet as far as anything outside this module is concerned. The copy count is a plain integer on the sheet, so this is a fact about the SHEET, exactly as an ordinary sheet's ports are. Ports come in the (Y, X) order of the components that generate them - the order getOrderedCompLabels already uses. A MuxOut contributes BOTH an input and an output, so the two lists are over the same components in the same order and a mux select lands in the middle of the inputs, which is exactly where the outline puts it. The canvas passed in must already be resolved at whatever bindings are wanted, as signatureOfInstance resolves it: the widths here are read off the components.

info : ArrayInfo
paramDefs : ParameterDefs option
arg2 : Component list
arg3 : Connection list
Returns: (OutlinePort list * OutlinePort list) * JoinWiring

Type something to start searching.