Use bazel-built systemc header

The project no longer requires system libsystemc-dev package

Change-Id: I4e060a49f2595c4beb1eb71930a8ad30db6532c4
diff --git a/external/0003-Add-systemc-lib-support.patch b/external/0003-Add-systemc-lib-support.patch
new file mode 100644
index 0000000..f029634
--- /dev/null
+++ b/external/0003-Add-systemc-lib-support.patch
@@ -0,0 +1,39 @@
+From 5e8abbacdc9d25cf5c7405ec9fdfb3b2645de829 Mon Sep 17 00:00:00 2001
+From: Cindy Liu <hcindyl@google.com>
+Date: Sun, 13 Aug 2023 10:26:17 -0700
+Subject: [PATCH] Add systemc lib support
+
+Set libverilator to build based on the OSS accellera_systemc not the
+system installed libsystemc-dev
+---
+ dependency_support/verilator/verilator.BUILD | 7 +++++++--
+ 1 file changed, 6 insertions(+), 1 deletions(-)
+
+diff --git dependency_support/verilator/verilator.BUILD dependency_support/verilator/verilator.BUILD
+index 371a1dd..0bc3c71 100644
+--- dependency_support/verilator/verilator.BUILD
++++ dependency_support/verilator/verilator.BUILD
+@@ -221,7 +221,11 @@ cc_library(
+     ],
+     # TODO: Remove these once upstream fixes these warnings
+     copts = ["-Wno-unused-const-variable"],
+-    includes = ["include"],
++    includes = [
++        "include",
++        # include systemc header
++        "systemc/include",
++    ],
+     strip_include_prefix = "include/",
+     textual_hdrs = [
+         "include/gtkwave/fastlz.c",
+@@ -230,6 +234,7 @@ cc_library(
+     ],
+     visibility = ["//visibility:public"],
+     deps = [
++        "@accellera_systemc//:systemc",
+         "@net_zlib//:zlib",
+     ],
+ )
+-- 
+2.41.0.640.ga95def55d0-goog
+
diff --git a/rules/repos.bzl b/rules/repos.bzl
index f7140b1..474450b 100644
--- a/rules/repos.bzl
+++ b/rules/repos.bzl
@@ -23,6 +23,7 @@
         patches = [
             "@kelvin_hw//external:0001-Update-version-of-Googletest-for-bazel-compatitibili.patch",
             "@kelvin_hw//external:0002-SystemC-support-for-verilator.patch",
+            "@kelvin_hw//external:0003-Add-systemc-lib-support.patch",
         ],
     )
 
diff --git a/tests/verilator_sim/BUILD b/tests/verilator_sim/BUILD
index 2739fc1..5820f32 100644
--- a/tests/verilator_sim/BUILD
+++ b/tests/verilator_sim/BUILD
@@ -7,6 +7,12 @@
         "sysc_module.h",
         "sysc_tb.h",
     ],
+    includes = [
+        "systemc/include",
+    ],
+    deps = [
+        "@accellera_systemc//:systemc",
+    ],
 )
 
 cc_library(
@@ -29,7 +35,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:core_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -41,7 +46,6 @@
     deps = [
         ":sim_libs",
         "//hdl/chisel:dbus2axi_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -54,7 +58,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:l1dcache_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -67,7 +70,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:l1icache_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -108,7 +110,6 @@
         ":sim_libs",
         ":vencodeop",
         "//hdl/chisel:vcmdq_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -121,7 +122,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:vconvalu_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -135,7 +135,6 @@
         ":sim_libs",
         ":vencodeop",
         "//hdl/chisel:vconvctrl_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -149,7 +148,6 @@
         ":sim_libs",
         ":vdecode",
         "//hdl/chisel:vdecodeinstruction_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -163,7 +161,6 @@
         ":sim_libs",
         ":vdecode",
         "//hdl/chisel:vdecode_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -177,7 +174,6 @@
         ":sim_libs",
         ":vencodeop",
         "//hdl/chisel:vldst_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -191,7 +187,6 @@
         ":sim_libs",
         ":vencodeop",
         "//hdl/chisel:vld_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -204,7 +199,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:vregfilesegment_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -217,7 +211,6 @@
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:vregfile_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
@@ -231,20 +224,18 @@
         ":sim_libs",
         ":vencodeop",
         "//hdl/chisel:vst_cc_library",
-        "@accellera_systemc//:systemc",
     ],
 )
 
 cc_binary(
     name = "kelvin_tb",
     srcs = [
-        "matcha/kelvin_tb.cc",
         "matcha/kelvin_if.h",
+        "matcha/kelvin_tb.cc",
     ],
     deps = [
         ":kelvin_if",
         ":sim_libs",
         "//hdl/chisel:kelvin_cc_library",
-        "@accellera_systemc//:systemc",
-    ]
+    ],
 )