From b553e636a019d3806625eedc09b1d543c9a15848 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 4 Oct 2025 08:25:17 -0700 Subject: [PATCH] CodingGuildlines Signed-off-by: James Cherry --- doc/CodingGuidelines.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/CodingGuidelines.txt b/doc/CodingGuidelines.txt index 5e2d1e48..4e2e096e 100644 --- a/doc/CodingGuidelines.txt +++ b/doc/CodingGuidelines.txt @@ -105,6 +105,9 @@ private order. friend class Frobulator; } +Class member functions should not be defined inside the class unless they +are simple accessors that return a member variable. + Avoid using [] to lookup a map value because it creates a key/null value pair if the lookup fails. Use map::find or sta::Map::findKey instead. @@ -114,6 +117,11 @@ Avoid all use of global variables as "caches", even if they are thread local. OpenSTA goes to great lengths to minimize global state variable that prevent multiple instances of the Sta class from coexisting. +Do not use thread_local variables. They are essentially global +variables so they prevent multiple instances of an Sta object from +existing concurrently, so they sbould also be avoided. Use stack state +in each thread instead. + Regression Tests ................ @@ -129,11 +137,17 @@ Tests log files and results are in test/results. The result/test.log is compared to test.ok to determine if a test passes. Test scripts are written in tcl and live in the /test directory. -Compress large liberty, verilog, and spef, files and use existing -libraries to prevent repository bloat. +Compress large liberty, verilog, and spef, files., Use small or +existing verilog and liberty files to prevent repository bloat. The test script should use a one line comment at the beginning of the file so head -1 can show what it is for. Use file names to roughly group regressions and use numeric suffixes to distinguish them. The script test/save_ok saves a test/results/.log to test/.okfile. + +To add a new regression: + add .tcl to /tcl + add name to test/regression_vars.tcl + run with test/regression + use save_ok to save the log file to >test>.log