#NEWLINE# def generate_pipeline_depths( parameters = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# EXTRA_STAGES = parameters . get ( 'EXTRA_STAGES' , 0 ) #NEWLINE# assert ( ( EXTRA_STAGES % 2 ) == 0 ) , 'Asked for {d} EXTRA_STAGES. Must be a multiple of 2.' . format ( EXTRA_STAGES ) #NEWLINE# pipeline_depths = { #NEWLINE# #INDENT# 'EXTRA_STAGES' : EXTRA_STAGES , #NEWLINE# 'PC_PIPELINE_DEPTH' : ( 0 + EXTRA_STAGES ) , #NEWLINE# 'I_TAP_PIPELINE_DEPTH' : 1 , #NEWLINE# 'TAP_AB_PIPELINE_DEPTH' : 2 , #NEWLINE# 'CONTROL_INPUT_PIPELINE_DEPTH' : 0 , #NEWLINE# 'AB_READ_PIPELINE_DEPTH' : 2 , #NEWLINE# 'AB_ALU_PIPELINE_DEPTH' : ( ( 2 + ( 4 + EXTRA_STAGES ) ) + 2 ) , #NEWLINE# #UNINDENT# } #NEWLINE# parameters_misc . override ( pipeline_depths , parameters ) #NEWLINE# control_pipeline_depth = sum ( [ pipeline_depths [ 'PC_PIPELINE_DEPTH' ] , pipeline_depths [ 'I_TAP_PIPELINE_DEPTH' ] , pipeline_depths [ 'TAP_AB_PIPELINE_DEPTH' ] , pipeline_depths [ 'AB_READ_PIPELINE_DEPTH' ] , 1 , 2 ] ) #NEWLINE# assert ( control_pipeline_depth == pipeline_depths [ 'AB_ALU_PIPELINE_DEPTH' ] ) , 'Control pipeline depth {0} does not match AB_ALU pipeline depth {1}' . format ( control_pipeline_depth , pipeline_depths [ 'AB_ALU_PIPELINE_DEPTH' ] ) #NEWLINE# return pipeline_depths