Index: user/06_features/hierarchic/index.html =================================================================== --- user/06_features/hierarchic/index.html (revision 10193) +++ user/06_features/hierarchic/index.html (revision 10194) @@ -201,12 +201,76 @@ under the module's root sheet will see the object, but it will not merge with anything above the module's subtree.
-TODO: example +In example 32_subtree +an extension of the 24_led example: the whole led control section with the +microcontrolled and the two LEDs are packed into a subtree. The root of the +subtree is led_ctrl.rs and is almost the same circuit as main.rs in +24_led. The change is that the 2-channel MCU controlled LED subtree is now +commanded through SPI.
-TODO: - - describe the example once the net names are known - - explain how auto is searching +A new root sheet is added on top, called main.rs, which adds U5, the main +microcontroller, then creates two instances of the led control subtree and +hooks up U5's SPI to control both led_ctrl microcontrollers (using different +slave select signals). +
+Sheet instance tree will look like: +
+main.rs (SPI master) + | + +- S1: led_ctrl.rs (SPI slave 2 channel LED control) + | | + | +- S1/S1: led.rs (LED and FET) + | | + | +- S1/S2: led.rs (LED and FET) + | + +- S2: led_ctrl.rs (SPI slave 2 channel LED control) + | + +- S2/S1: led.rs (LED and FET) + | + +- S2/S2: led.rs (LED and FET) ++
+The expert feature, subtree net, can be observed on sheet led_ctrl.rs. It's +the v/blink_enable net. This used to be a global net in example 24_led, so +that it didn't need to have a dedicated terminal on the sheet ref syms. In +this example we need the same, except that blink_enable can not be fully global +because then the two led_ctrl sheets (S1 and S2) would share the same led_ctrl +net. What is needed instead is a subtree local network, which means that +on the level of S1 and S2 these are two separate networks, but in the subtree +under S1 and in the other subtree under S2 the network is accessible without +having to use sheet terminals. +
+The practical implementation is: +
+Note: on led_ctrl.rs it's possble to name the blink_enable net without any prefix +and the example will still work. This is because of the search preference of +the auto scope that is used when the name is not prefixed: it will +first search sheet local nets to bind to then starts ascending level by level +looking for a subtree local net, bumping into the same v/blink_enable on +led_ctrl.rs. However, if the search fails (e.g. led_ctrl.rs fails to offer +a subtree local net named blink_enable), the auto will silently create +a global net whereas the ^/ prefixed name will throw an error, which is a +safer choice. + + +
Not yet supported. (TODO)