Typically, a processor increments its Program Counter (PC) sequentially to fetch and execute instructions one after another. A branching instruction breaks this flow by loading a new destination target address directly into the PC register.
centre
Branching adds more flexibility and efficiency to a CPU, by allowing re-use of code, and dynamically switching execution paths based on inputs.

Types of Branching

There are several types of branching that can depend on decision logic, addressing method or target determination:

  • The CPU can jump to a target address with no further conditions or can check for a specific flag or condition register first.
  • The instruction can provide an exact memory address to load or an offset value that gets added to the current PC value.
  • The target address or offset can be hardcoded or the instruction could point to a register that holds the target address.

const current = dv.current();
 
if (current && current.file.tags.some(t => t.toLowerCase() === "#topic")) {
    const inlinks = current.file.inlinks;
 
    // Split backlinks: general notes vs. lecture notes
    const lectureLinks = inlinks.where(l => l.path.includes("/Lecture Notes/"));
    const otherLinks = inlinks.where(l => !l.path.includes("/Lecture Notes/"));
 
    if (otherLinks.length > 0) {
        dv.header(4, "Links To This Page");
        dv.list(otherLinks);
    }
 
    if (lectureLinks.length > 0) {
        dv.header(4, "Referenced In Lecture Notes");
        dv.list(lectureLinks);
    }
}