diff --git a/src/target/riscv/scr5.c b/src/target/riscv/scr5.c index 15946053a7..7ae165585a 100644 --- a/src/target/riscv/scr5.c +++ b/src/target/riscv/scr5.c @@ -155,7 +155,7 @@ static int scr5_jim_configure(struct target *target, if (!goi->is_configure) { if (goi->argc != 0) goto cget_extra_args; - Jim_SetResultFormatted(goi->interp, "%u", pc->tlb_n_entries); + Jim_SetResultFormatted(goi->interp, "%u", pc->tlb_csr_base); return JIM_OK; } e = jim_getopt_wide(goi, &w); @@ -230,7 +230,9 @@ static int scr5_search_tlb(struct target *target, target_addr_t virt_addr, for (unsigned int tlb_sel = 0; tlb_sel <= 1; ++tlb_sel) { for (unsigned int pte_idx = 0; pte_idx < pc->tlb_n_entries; ++pte_idx) { res = riscv_reg_set(target, tlb_scan_csr, - tlb_sel << tlb_sel_offset | pte_idx); + ((riscv_reg_t)tlb_sel << tlb_sel_offset) | pte_idx); + if (res != ERROR_OK) + goto cleanup; riscv_reg_t tlb_attr, tlb_va; res = riscv_reg_get(target, &tlb_attr, tlb_attr_csr); if (res != ERROR_OK) diff --git a/tcl/syntacore/sc_fpga_lib.tcl b/tcl/syntacore/sc_fpga_lib.tcl index bfcc8d8959..3c1927eaf8 100644 --- a/tcl/syntacore/sc_fpga_lib.tcl +++ b/tcl/syntacore/sc_fpga_lib.tcl @@ -140,7 +140,7 @@ namespace eval _SC_INTERNALS { en_ir pmu_ctrs } { set pmu_ctrs [lsort -unique $pmu_ctrs] - if {[llength pmu_ctrs] > $pmu_ctrs_max} { + if {[llength $pmu_ctrs] > $pmu_ctrs_max} { error "too many PMU counters requested was requested" } set inhibit_value 0xffffffff