From 6d5f93410b289a2b4fc66d1fcb98726ca399943d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Denkinger?= <42833463+benoitdenkinger@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:43:44 +0100 Subject: [PATCH] Peakrdl params (#108) Co-authored-by: Benoit Denkinger --- cmake/fpga/uart_programmer/uart_programmer.py | 3 +++ cmake/peakrdl/peakrdl_regblock.cmake | 12 ++++++++++-- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 13 +++++++++++-- cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake | 3 +-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/cmake/fpga/uart_programmer/uart_programmer.py b/cmake/fpga/uart_programmer/uart_programmer.py index 637c64a..191afcb 100644 --- a/cmake/fpga/uart_programmer/uart_programmer.py +++ b/cmake/fpga/uart_programmer/uart_programmer.py @@ -79,9 +79,12 @@ def program( if not sync_f: # Wait for the first similar byte while not sync_f: + print(f"INFO: Waiting for synchronization... ", end="") rbyte = ser.read(1) + print(f"Received byte: {rbyte} ?= {wbyte}") if rbyte == wbyte: sync_f = True + print(f"INFO: Synchronization success!", end="") else: rbyte = ser.read(1) if rbyte != wbyte: diff --git a/cmake/peakrdl/peakrdl_regblock.cmake b/cmake/peakrdl/peakrdl_regblock.cmake index 5e308d5..0800561 100644 --- a/cmake/peakrdl/peakrdl_regblock.cmake +++ b/cmake/peakrdl/peakrdl_regblock.cmake @@ -35,7 +35,7 @@ #]] function(peakrdl_regblock IP_LIB) # Parse keyword arguments - cmake_parse_arguments(ARG "" "OUTDIR;RENAME;INTF;RESET" "" ${ARGN}) + cmake_parse_arguments(ARG "" "OUTDIR;RENAME;INTF;RESET" "PARAMETERS" ${ARGN}) # Check for any unknown argument if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " @@ -77,11 +77,19 @@ function(peakrdl_regblock IP_LIB) set(RESET_ARG --default-reset ${ARG_RESET}) endif() + # Used to overwrite the top level parameters + set(OVERWRITTEN_PARAMETERS "") + if(ARG_PARAMETERS) + foreach(PARAM ${ARG_PARAMETERS}) + set(OVERWRITTEN_PARAMETERS "${OVERWRITTEN_PARAMETERS}" "-P${PARAM}") + endforeach() + endif() + # Get the SystemRDL sources to generate the register block # This function gets the IP sources and the deps get_ip_sources(RDL_SOURCES ${IP_LIB} SYSTEMRDL) - # Get SystemRDL include directories + # Get SystemRDL include directories get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) if(INC_DIRS) set(INCDIR_ARG -I ${INC_DIRS}) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 159bccb..2b2147e 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -1,6 +1,6 @@ function(peakrdl_regblock_wrap IP_LIB) # Parse keyword arguments - cmake_parse_arguments(ARG "TMR" "OUTDIR;RENAME;INTF;RESET;OUT_LIST" "" ${ARGN}) + cmake_parse_arguments(ARG "TMR" "OUTDIR;RENAME;INTF;RESET;OUT_LIST" "PARAMETERS" ${ARGN}) # Check for any unknown argument if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " @@ -58,11 +58,19 @@ function(peakrdl_regblock_wrap IP_LIB) set(REGBLOCK_NAME ${ARG_RENAME}) endif() + # Used to overwrite the top level parameters + set(OVERWRITTEN_PARAMETERS "") + if(ARG_PARAMETERS) + foreach(PARAM ${ARG_PARAMETERS}) + set(OVERWRITTEN_PARAMETERS "${OVERWRITTEN_PARAMETERS}" "-P${PARAM}") + endforeach() + endif() + # Get the SystemRDL sources to generate the register block # This function gets the IP sources and the deps get_ip_sources(RDL_SOURCES ${IP_LIB} SYSTEMRDL) - # Get SystemRDL include directories + # Get SystemRDL include directories get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) if(INC_DIRS) set(INCDIR_ARG -I ${INC_DIRS}) @@ -83,6 +91,7 @@ function(peakrdl_regblock_wrap IP_LIB) ${RESET_ARG} ${TMR_OPT} ${INCDIR_ARG} + ${OVERWRITTEN_PARAMETERS} -o ${OUTDIR} ${RDL_SOURCES} ) diff --git a/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake b/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake index bafdc22..d1214a0 100644 --- a/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake +++ b/cmake/peakrdl/peakrdl_socgen/peakrdl_socgen.cmake @@ -102,7 +102,6 @@ function(peakrdl_socgen IP_LIB) endif() # Used to overwrite the top level parameters - set(OVERWRITTEN_PARAMETERS_TARGET "") set(OVERWRITTEN_PARAMETERS "") if(ARG_PARAMETERS) foreach(PARAM ${ARG_PARAMETERS}) @@ -113,7 +112,7 @@ function(peakrdl_socgen IP_LIB) get_ip_sources(RDL_SOCGEN_GLUE ${IP_LIB} SYSTEMRDL_SOCGEN) get_ip_sources(SYSTEMRDL_SOURCES ${IP_LIB} SYSTEMRDL) - # Get SystemRDL include directories + # Get SystemRDL include directories get_ip_include_directories(INC_DIRS ${IP_LIB} SYSTEMRDL) if(INC_DIRS) set(INCDIR_ARG -I ${INC_DIRS})