AN 806: Hierarchical Partial Reconfiguration Tutorial: for Intel® Arria® 10 GX FPGA Development Board

ID 683278
Date 2/04/2021
Public

Step 2: Creating a Child Level Sub-module

To convert this flat design into a hierarchical PR design, you must create a child sub-module (blinking_led_child.sv) that is nested within the parent sub-module (blinking_led.sv).
  1. Create a new blinking_led_child.sv design file. Add the following lines of code to this file:
    `timescale 1 ps / 1 ps
    `default_nettype none
    
    module blinking_led_child (
    
       // clock
       input wire clock,
       input wire [31:0] counter,
    
    
       // Control signals for the LEDs
       output wire led_three_on
    
    );
       localparam COUNTER_TAP = 23;
       reg led_three_on_r;
    
    
       assign led_three_on   = led_three_on_r;
       
       always_ff @(posedge clock) begin
          led_three_on_r   <= counter[COUNTER_TAP];
       end
    
    endmodule
  2. Modify the blinking_led.sv file to connect the led_two_on to bit 23 of the counter from the static region, and instantiate the blinking_led_child module. After modifications, your blinking_led.sv file must appear as follows:
    `timescale 1 ps / 1 ps
    `default_nettype none
    
    module blinking_led(
       // clock
       input wire clock,
       input wire [31:0] counter,
       // Control signals for the LEDs
       output wire led_two_on,
       output wire led_three_on
    );
    
    
       localparam COUNTER_TAP = 23;
    
       reg led_two_on_r;
       assign  led_two_on    = led_two_on_r;
       
       // The counter:
       always_ff @(posedge clock) begin
             led_two_on_r <= counter[COUNTER_TAP];
       end
    
    
       blinking_led_child u_blinking_led_child (
             .led_three_on           (led_three_on),
             .counter                (counter),
             .clock                  (clock)
       );
    
    endmodule
  3. On modifying all the design files, recompile the project by clicking Processing > Start Compilation