From eabe6f9823ebd296a982a5972ae67e609aee3ca9 Mon Sep 17 00:00:00 2001 From: Yunhao Deng Date: Mon, 2 Dec 2024 16:19:16 +0100 Subject: [PATCH] Simplify Obs Pin (#93) * Simplify Obs Pin * Merge the modifications from PR88 --- hw/occamy/occamy_chip.sv.tpl | 2 +- hw/occamy/occamy_xilinx.sv.tpl | 3 ++- util/occamygen/occamy.py | 37 ++++------------------------------ 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/hw/occamy/occamy_chip.sv.tpl b/hw/occamy/occamy_chip.sv.tpl index 80d47f7d..b3e4aa8a 100644 --- a/hw/occamy/occamy_chip.sv.tpl +++ b/hw/occamy/occamy_chip.sv.tpl @@ -14,7 +14,7 @@ import ${name}_pkg::*; input logic clk_i, input logic rst_ni, // Obs pins - output obs_t obs_o, + output logic [${obs_pin_width-1}:0] obs_o [${nr_clusters_s1_quadrant}], /// Peripheral clock input logic clk_periph_i, input logic rst_periph_ni, diff --git a/hw/occamy/occamy_xilinx.sv.tpl b/hw/occamy/occamy_xilinx.sv.tpl index 714c168a..21e24f35 100644 --- a/hw/occamy/occamy_xilinx.sv.tpl +++ b/hw/occamy/occamy_xilinx.sv.tpl @@ -123,7 +123,8 @@ import ${name}_pkg::*; .bootrom_rsp_i (bootrom_axi_lite_rsp), .ext_irq_i(ext_irq_i), // Tie-off unused ports - .chip_ctrl_req_o(), + .obs_o(), + .chip_ctrl_req_o(), .chip_ctrl_rsp_i ('0), .sram_cfgs_i ('0), .* diff --git a/util/occamygen/occamy.py b/util/occamygen/occamy.py index 4856faf5..34b975e9 100644 --- a/util/occamygen/occamy.py +++ b/util/occamygen/occamy.py @@ -569,39 +569,6 @@ def get_cheader_kwargs(occamy_cfg, cluster_generators, name): "Not all cluster base offset in the cluster cfg are equal.") cluster_offset = cluster_offset_list[0] cluster_addr_width = int(math.log2(cluster_offset)) - # # The lut here is to provide an easy way to determine the cluster idx based on core idx - # # e.g core_per_cluster_list = [2,3] - # # core_idx lut cluster_idx - # # 0 lut[0] 0 - # # 1 lut[1] 0 - # # 2 lut[2] 1 - # # 3 lut[3] 1 - # # 4 lut[4] 1 - # lut = [] - # for cluster_num, num_cores in enumerate(core_per_cluster_list): - # lut.extend([cluster_num] * num_cores) - # running_sum = [] - # current_sum = 0 - # for core in core_per_cluster_list: - # current_sum += core - # running_sum.append(current_sum) - # cluster_baseidx = [0] + running_sum[:-1] - # # we need to define an array in c header file for each cluster like - # # #define N_CORES_PER_CLUSTER {2,3} - # # so here we need to take out the value of the core_per_cluster_list - # # and join them with commas and then finally concat with {} - # nr_cores_per_cluster = "{" + ",".join(map(str, core_per_cluster_list)) + "}" - # lut_coreidx_clusteridx = "{" + ",".join(map(str, lut)) + "}" - # cluster_baseidx = "{" + ",".join(map(str, cluster_baseidx)) + "}" - # cheader_kwargs={ - # "name": name, - # "nr_quads": nr_quads, - # "nr_clusters": nr_clusters, - # "nr_cores_per_cluster": nr_cores_per_cluster, - # "lut_coreidx_clusteridx": lut_coreidx_clusteridx, - # "cluster_baseidx": cluster_baseidx, - # "nr_cores": nr_cores - # } cheader_kwargs = { "name": name, "nr_quads": nr_quads, @@ -658,10 +625,14 @@ def get_chip_kwargs(soc_wide_xbar, soc_axi_lite_narrow_periph_xbar, occamy_cfg, for cluster_generator in cluster_generators] nr_cores_quadrant = sum(core_per_cluster_list) nr_s1_quadrants = occamy_cfg["nr_s1_quadrant"] + cluster_cfg = cluster_generators[0].cfg chip_kwargs = { "name": name, "util": util, "occamy_cfg": occamy_cfg, + "nr_clusters_s1_quadrant": len(occamy_cfg["clusters"]), + "obs_pin_width": cluster_cfg["observable_pin_width"], + "soc_wide_xbar": soc_wide_xbar, "soc_axi_lite_narrow_periph_xbar": soc_axi_lite_narrow_periph_xbar, "cores": nr_s1_quadrants * nr_cores_quadrant + 1