text
stringlengths
183
150k
path
stringlengths
15
112
bucket
stringclasses
4 values
source
stringclasses
14 values
group
stringclasses
121 values
spdx
stringclasses
11 values
repo_license
stringclasses
11 values
commit
stringclasses
13 values
lang
stringclasses
4 values
def_heavy
bool
1 class
comment_ratio
float64
0
1
restricted
bool
2 classes
fresh
bool
1 class
n_bytes
int64
183
150k
n_tokens
int64
-1
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ class SingleInstructionLimiterPlugin() extends Plugin[VexRiscv] { override def build(pipeline: VexRiscv): Unit = { import pipeline._ import pipeline.config._ val fetcher = pipeline.service(classOf[IBusFetcher]) when(...
vexriscv/src/main/scala/vexriscv/plugin/SingleInstructionLimiterPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
449
-1
package vexriscv.demo import spinal.core._ import spinal.lib._ import spinal.lib.bus.avalon.AvalonMM import spinal.lib.eda.altera.{InterruptReceiverTag, QSysify, ResetEmitterTag} import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /*...
vexriscv/src/main/scala/vexriscv/demo/VexRiscvCachedWishboneForSim.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.206
false
false
4,794
-1
package vexriscv.plugin import spinal.core._ import vexriscv.VexRiscv class ExternalInterruptArrayPlugin(arrayWidth : Int = 32, machineMaskCsrId : Int = 0xBC0, machinePendingsCsrId : Int = 0xFC0, supervisorMaskCsr...
vexriscv/src/main/scala/vexriscv/plugin/ExternalInterruptArrayPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
1,306
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.core.internals.Literal import spinal.lib._ import vexriscv.demo.GenFull import scala.collection.mutable import scala.collection.mutable.ArrayBuffer case class Masked(value : BigInt,care : BigInt){ assert((value & ~care) == 0) var isPri...
vexriscv/src/main/scala/vexriscv/plugin/DecoderSimplePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.078
false
false
15,993
-1
package vexriscv.demo import spinal.core._ import spinal.lib.bus.misc.SizeMapping import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * this example integrate the tightly coupled memory directly inside VexRiscv * by using the I...
vexriscv/src/main/scala/vexriscv/demo/GenFullWithTcmIntegrated.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.043
false
false
2,765
-1
package vexriscv.demo.smp import spinal.core._ import spinal.core.fiber._ import spinal.lib.bus.bmb._ import spinal.lib.bus.wishbone.{Wishbone, WishboneConfig, WishboneSlaveFactory} import spinal.lib.com.jtag.Jtag import spinal.lib._ import spinal.lib.bus.bmb.sim.{BmbMemoryMultiPort, BmbMemoryTester} import spinal.li...
vexriscv/src/main/scala/vexriscv/demo/smp/Misc.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.06
false
false
9,918
-1
package vexriscv.demo import spinal.core._ import spinal.lib._ import spinal.lib.bus.avalon.AvalonMM import spinal.lib.com.jtag.{Jtag, JtagTapInstructionCtrl} import spinal.lib.eda.altera.{InterruptReceiverTag, QSysify, ResetEmitterTag} import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.plug...
vexriscv/src/main/scala/vexriscv/demo/VexRiscvAhbLite3.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.371
false
false
6,553
-1
package vexriscv.plugin import spinal.core._ import spinal.lib._ import vexriscv.VexRiscv case class RvfiPortRsRead() extends Bundle{ val addr = UInt(5 bits) val rdata = Bits(32 bits) } case class RvfiPortRsWrite() extends Bundle{ val addr = UInt(5 bits) val wdata = Bits(32 bits) } case class RvfiPortPc() e...
vexriscv/src/main/scala/vexriscv/plugin/FormalPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.155
false
false
3,980
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ trait HazardService{ def hazardOnExecuteRS : Bool } class HazardSimplePlugin(bypassExecute : Boolean = false, bypassMemory: Boolean = false, bypassWriteBack: Boolean = false, ...
vexriscv/src/main/scala/vexriscv/plugin/HazardSimplePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
4,643
-1
package vexriscv.plugin import spinal.core._ import spinal.lib._ import vexriscv._ class NoPipeliningPlugin() extends Plugin[VexRiscv] { override def setup(pipeline: VexRiscv): Unit = { import pipeline.config._ val decoderService = pipeline.service(classOf[DecoderService]) decoderService.addDefault(HA...
vexriscv/src/main/scala/vexriscv/plugin/NoPipeliningPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
757
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ import scala.collection.mutable.ArrayBuffer class PcManagerSimplePlugin(resetVector : BigInt, relaxedPcCalculation : Boolean = false, keepPcPlus4 : Boolean = true) exten...
vexriscv/src/main/scala/vexriscv/plugin/PcManagerSimplePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.927
false
false
4,874
-1
package vexriscv.demo import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba4.axi.{Axi4ReadOnly, Axi4SpecRenamer} import spinal.lib.bus.amba4.axilite.AxiLite4SpecRenamer import spinal.lib.com.jtag.Jtag import spinal.lib.eda.altera.{InterruptReceiverTag, ResetEmitterTag} import spinal.lib.misc.AxiLite4Clin...
vexriscv/src/main/scala/vexriscv/demo/VexRiscvAxi4LinuxPlicClint.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.026
false
false
6,080
-1
package vexriscv.plugin import spinal.core._ import spinal.lib._ import vexriscv._ import vexriscv.Riscv._ import vexriscv.plugin.IntAluPlugin.{ALU_BITWISE_CTRL, ALU_CTRL, AluBitwiseCtrlEnum, AluCtrlEnum} import scala.collection.mutable.ArrayBuffer import scala.collection.mutable import spinal.core.sim._ import spina...
vexriscv/src/main/scala/vexriscv/plugin/CsrPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.03
false
false
71,169
-1
/* * SpinalHDL * Copyright (c) Dolu, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later versi...
vexriscv/src/main/scala/vexriscv/demo/Linux.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.328
false
false
20,675
-1
package vexriscv.ip.fpu import spinal.core._ import spinal.lib._ import spinal.lib.sim.{StreamDriver, StreamMonitor, StreamReadyRandomizer} import scala.collection.mutable import scala.util.Random case class FpuSqrtCmd(mantissaWidth : Int) extends Bundle{ val a = UInt(mantissaWidth+2 bits) } case class FpuSqrtRsp...
vexriscv/src/main/scala/vexriscv/ip/fpu/FpuSqrt.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.106
false
false
3,216
-1
package vexriscv.demo import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba3.apb._ import spinal.lib.bus.misc.SizeMapping import spinal.lib.bus.simple.PipelinedMemoryBus import spinal.lib.com.jtag.Jtag import spinal.lib.com.spi.ddr.SpiXdrMaster import spinal.lib.com.uart._ import spinal.lib.io.{InOutWrap...
vexriscv/src/main/scala/vexriscv/demo/Murax.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.062
false
false
18,025
-1
package vexriscv.plugin import java.util import vexriscv.{ReportService, VexRiscv} import org.yaml.snakeyaml.{DumperOptions, Yaml} /** * Created by spinalvm on 09.06.17. */ class YamlPlugin(path : String) extends Plugin[VexRiscv] with ReportService{ val content = new util.HashMap[String, Object]() def add(t...
vexriscv/src/main/scala/vexriscv/plugin/YamlPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.136
false
false
759
-1
package vexriscv.demo import spinal.core._ import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * Created by spinalvm on 15.06.17. */ object GenFullNoMmuMaxPerf extends App{ def cpu() = new VexRiscv( config = VexRiscvConfi...
vexriscv/src/main/scala/vexriscv/demo/GenFullNoMmuMaxPerf.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.035
false
false
2,611
-1
/* * Copyright (c) 2021 Samuel Lindemer <samuel.lindemer@ri.se> * * SPDX-License-Identifier: MIT */ package vexriscv.plugin import vexriscv.{VexRiscv, _} import vexriscv.plugin.MemoryTranslatorPort.{_} import spinal.core._ import spinal.lib._ import spinal.lib.fsm._ /* Each 32-bit pmpcfg# register contains four ...
vexriscv/src/main/scala/vexriscv/plugin/PmpPluginNapot.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.222
false
false
10,566
-1
package vexriscv.demo import java.nio.{ByteBuffer, ByteOrder} import spinal.core._ import spinal.lib.bus.amba3.apb.{Apb3, Apb3Config, Apb3SlaveFactory} import spinal.lib.bus.misc.SizeMapping import spinal.lib.misc.{HexTools, InterruptCtrl, Prescaler, Timer} import spinal.lib._ import spinal.lib.bus.simple._ import ve...
vexriscv/src/main/scala/vexriscv/demo/MuraxUtiles.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.014
false
false
6,101
-1
package vexriscv.demo import vexriscv.plugin._ import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.{plugin, VexRiscv, VexRiscvConfig} import spinal.core._ /** * Created by spinalvm on 15.06.17. */ object GenFullNoMmu extends App{ def cpu() = new VexRiscv( config = VexRiscvConfig( ...
vexriscv/src/main/scala/vexriscv/demo/GenFullNoMmu.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.036
false
false
2,534
-1
package vexriscv import vexriscv.plugin._ import spinal.core._ import scala.collection.mutable.ArrayBuffer import scala.collection.Seq object VexRiscvConfig{ def apply(withMemoryStage : Boolean, withWriteBackStage : Boolean, plugins : Seq[Plugin[VexRiscv]]): VexRiscvConfig = { val config = VexRiscvConfig() ...
vexriscv/src/main/scala/vexriscv/VexRiscv.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.039
false
false
5,467
-1
package vexriscv.plugin import spinal.core._ import vexriscv.{VexRiscv, Riscv} /** * MstatushPlugin * * Implements the mstatush CSR (0x310) as defined in RISC-V Privileged Specification. * * For RV32 systems, mstatush represents the upper 32 bits (bits 63:32) of the * conceptual 64-bit mstatus register. Since V...
vexriscv/src/main/scala/vexriscv/plugin/MstatushPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.653
false
false
1,916
-1
package vexriscv.demo.smp import spinal.core._ import spinal.lib.bus.bmb._ import spinal.lib.bus.misc.{AddressMapping, DefaultMapping, SizeMapping} import spinal.lib.bus.wishbone.{WishboneConfig, WishboneToBmbGenerator} import spinal.lib.sim.SparseMemory import vexriscv.demo.smp.VexRiscvSmpClusterGen.vexRiscvConfig c...
vexriscv/src/main/scala/vexriscv/demo/smp/VexRiscvSmpLitexMpCluster.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.98
false
false
15,698
-1
package vexriscv.ip.fpu import spinal.core._ import spinal.lib.math.{UnsignedDividerCmd, UnsignedDividerRsp} import spinal.lib._ import spinal.lib.sim.{StreamDriver, StreamMonitor, StreamReadyRandomizer} import scala.collection.mutable import scala.util.Random case class FpuDivCmd(mantissaWidth : Int) extends Bundl...
vexriscv/src/main/scala/vexriscv/ip/fpu/FpuDiv.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
3,886
-1
package vexriscv.plugin import vexriscv._ import vexriscv.VexRiscv import spinal.core._ import spinal.lib.KeepAttribute //Input buffer generaly avoid the FPGA synthesis to duplicate reg inside the DSP cell, which could stress timings quite much. class MulPlugin(var inputBuffer : Boolean = false, var ou...
vexriscv/src/main/scala/vexriscv/plugin/MulPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.069
false
false
4,862
-1
package vexriscv.demo import spinal.core._ import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * Created by spinalvm on 15.06.17. */ object GenSmallAndProductiveCfu extends App{ def cpu() = new VexRiscv( config = VexRiscvConfig( plugins = List( new IBusSimplePlugin( ...
vexriscv/src/main/scala/vexriscv/demo/GenSmallAndProductiveCfu.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.036
false
false
2,517
-1
package vexriscv.demo import spinal.core._ import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * Created by spinalvm on 15.06.17. */ object GenDeterministicVex extends App{ def cpu() = new VexRiscv( config = VexRiscvConfig( plugins = List( new IBusSimplePlugin( ...
vexriscv/src/main/scala/vexriscv/demo/GenDeterministicVex.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.048
false
false
1,879
-1
package vexriscv.plugin import vexriscv.{VexRiscv, _} import spinal.core._ import spinal.lib._ import scala.collection.mutable.ArrayBuffer trait DBusAccessService{ def newDBusAccess() : DBusAccess } case class DBusAccessCmd() extends Bundle { val address = UInt(32 bits) val size = UInt(2 bits) val write = B...
vexriscv/src/main/scala/vexriscv/plugin/MmuPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.05
false
false
12,658
-1
package vexriscv.plugin import vexriscv.{DecoderService, ExceptionCause, ExceptionService, Stage, Stageable, VexRiscv} import spinal.core._ import spinal.lib._ import spinal.lib.bus.bmb.WeakConnector import spinal.lib.bus.misc.{AddressMapping, DefaultMapping} import vexriscv.Riscv.IMM object VfuPlugin{ val ROUND_M...
vexriscv/src/main/scala/vexriscv/plugin/VfuPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
3,989
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba3.ahblite.{AhbLite3Config, AhbLite3Master} import spinal.lib.bus.amba4.axi._ import spinal.lib.bus.avalon.{AvalonMM, AvalonMMConfig} import spinal.lib.bus.bmb.{Bmb, BmbParameter} import spinal.lib.bus.wishbone....
vexriscv/src/main/scala/vexriscv/plugin/DBusSimplePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.017
false
false
20,793
-1
package vexriscv.plugin import vexriscv.{VexRiscv, _} import spinal.core._ import spinal.lib._ import scala.collection.mutable.ArrayBuffer object MemoryTranslatorPort{ val PRIORITY_DATA = 1 val PRIORITY_INSTRUCTION = 0 } case class MemoryTranslatorPort(bus : MemoryTranslatorBus, priority : Int, args : MemoryTran...
vexriscv/src/main/scala/vexriscv/plugin/MemoryTranslatorPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.051
false
false
5,985
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib.Reverse class FullBarrelShifterPlugin(earlyInjection : Boolean = false) extends Plugin[VexRiscv]{ object ShiftCtrlEnum extends SpinalEnum(binarySequential){ val DISABLE, SLL, SRL, SRA = newElement() } object SHIFT_CTRL exten...
vexriscv/src/main/scala/vexriscv/plugin/ShiftPlugins.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.013
false
false
6,414
-1
package vexriscv.demo import spinal.core._ import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * Created by spinalvm on 15.06.17. */ object GenSmallAndProductiveVfu extends App{ def cpu() = new VexRiscv( config = VexRiscvConfig( plugins = List( new IBusSimplePlugin( ...
vexriscv/src/main/scala/vexriscv/demo/GenSmallAndProductiveVfu.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.049
false
false
1,724
-1
package vexriscv.demo import vexriscv.plugin._ import vexriscv._ import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba3.apb._ import spinal.lib.bus.amba4.axi._ import spinal.lib.com.jtag.Jtag import spinal.lib.com.jtag.sim.JtagTcp import spina...
vexriscv/src/main/scala/vexriscv/demo/Briey.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.061
false
false
15,292
-1
package vexriscv.plugin import vexriscv.ip._ import vexriscv._ import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba4.axi.Axi4 import spinal.lib.bus.misc.SizeMapping import spinal.lib.misc.HexTools import scala.collection.mutable.ArrayBuffer class DAxiCachedPlugin(config : DataCacheConfig, memoryTrans...
vexriscv/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.024
false
false
28,134
-1
package vexriscv.plugin import spinal.lib.com.jtag.{Jtag, JtagTapInstructionCtrl} import spinal.lib.system.debugger.{JtagBridge, JtagBridgeNoTap, VJtagBridge, SystemDebugger, SystemDebuggerConfig, SystemDebuggerMemBus} import vexriscv.plugin.IntAluPlugin.{ALU_CTRL, AluCtrlEnum} import vexriscv._ import vexriscv.ip._ i...
vexriscv/src/main/scala/vexriscv/plugin/DebugPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.003
false
false
11,417
-1
package vexriscv.demo import vexriscv.plugin._ import vexriscv.{plugin, VexRiscv, VexRiscvConfig} import spinal.core._ /** * Created by spinalvm on 15.06.17. */ object FormalSimple extends App{ def cpu() = new VexRiscv( config = VexRiscvConfig( plugins = List( new FormalPlugin, new Hal...
vexriscv/src/main/scala/vexriscv/demo/FormalSimple.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.048
false
false
1,817
-1
/* * SpinalHDL * Copyright (c) Dolu, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later versi...
vexriscv/src/main/scala/vexriscv/TestsWorkspace.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.551
false
false
10,241
-1
package vexriscv.plugin import spinal.core._ import spinal.lib._ import vexriscv._ import vexriscv.Riscv._ import scala.collection.mutable.ArrayBuffer import scala.collection.mutable class HaltOnExceptionPlugin() extends Plugin[VexRiscv] with ExceptionService { def xlen = 32 //Mannage ExceptionService calls ...
vexriscv/src/main/scala/vexriscv/plugin/HaltOnExceptionPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.028
false
false
1,284
-1
package spinal.lib.eda.icestorm import spinal.lib.eda._ import spinal.lib.eda.bench.{Report, Rtl, Target} import scala.collection.mutable.ArrayBuffer import java.io.File import java.nio.file.Paths import org.apache.commons.io.FileUtils import spinal.core._ import spinal.lib.StreamFifo import spinal.lib.eda.bench.Repo...
vexriscv/src/main/scala/spinal/lib/eda/icestorm/IcestormFlow.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.465
false
false
6,879
-1
package vexriscv.plugin import vexriscv._ import vexriscv.plugin._ import spinal.core._ /** * A multiplication plugin using only 16-bit multiplications */ class Mul16Plugin extends Plugin[VexRiscv]{ object MUL_LL extends Stageable(UInt(32 bits)) object MUL_LH extends Stageable(UInt(32 bits)) object MUL_HL ...
vexriscv/src/main/scala/vexriscv/plugin/Mul16Plugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.052
false
false
3,147
-1
package vexriscv.demo import spinal.core._ import vexriscv.plugin.Plugin import vexriscv.{DecoderService, Stageable, VexRiscv} class WhiteboxPlugin extends Plugin[VexRiscv]{ override def build(pipeline: VexRiscv): Unit = { Component.current.afterElaboration { def export(name : String): Unit = out(Componen...
vexriscv/src/main/scala/vexriscv/demo/WhiteboxPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
409
-1
package vexriscv.demo import spinal.core._ import vexriscv.plugin._ import vexriscv.{VexRiscv, VexRiscvConfig, plugin} /** * Created by spinalvm on 15.06.17. */ //make clean run DBUS=SIMPLE IBUS=SIMPLE CSR=no MMU=no DEBUG_PLUGIN=no MUL=no DIV=no CUSTOM_CSR=yes object GenCustomCsr extends App{ def cpu() = new Vex...
vexriscv/src/main/scala/vexriscv/demo/GenCustomCsr.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.068
false
false
1,752
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba3.ahblite.{AhbLite3, AhbLite3Config, AhbLite3Master} import spinal.lib.bus.amba4.axi._ import spinal.lib.bus.avalon.{AvalonMM, AvalonMMConfig} import spinal.lib.bus.bmb.{Bmb, BmbParameter} import spinal.lib.bus...
vexriscv/src/main/scala/vexriscv/plugin/IBusSimplePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.031
false
false
14,169
-1
package vexriscv.demo import spinal.core._ import spinal.lib.io.TriStateArray import spinal.lib.{Flow, master} import vexriscv.plugin.{CsrInterface, Plugin} import vexriscv.{DecoderService, Stageable, VexRiscv} class CustomCsrDemoPlugin extends Plugin[VexRiscv]{ override def build(pipeline: VexRiscv): Unit = { ...
vexriscv/src/main/scala/vexriscv/demo/CustomCsrDemoPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0
false
false
1,614
-1
package vexriscv import spinal.core._ import spinal.lib.bus.bmb.{Bmb, BmbAccessCapabilities, BmbAccessParameter, BmbImplicitDebugDecoder, BmbInterconnectGenerator, BmbInvalidationParameter, BmbParameter} import spinal.lib.bus.misc.AddressMapping import spinal.lib.com.jtag.{Jtag, JtagTapInstructionCtrl} import spinal.l...
vexriscv/src/main/scala/vexriscv/VexRiscvBmbGenerator.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.033
false
false
8,629
-1
package vexriscv.plugin import vexriscv._ import spinal.core._ import spinal.lib._ import scala.collection.mutable trait RegFileReadKind object ASYNC extends RegFileReadKind object SYNC extends RegFileReadKind class RegFilePlugin(regFileReadyKind : RegFileReadKind, zeroBoot : Boolean = false, ...
vexriscv/src/main/scala/vexriscv/plugin/RegFilePlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.062
false
false
4,575
-1
package vexriscv.plugin import vexriscv.Riscv._ import vexriscv._ import spinal.core._ import spinal.lib._ trait BranchPrediction object NONE extends BranchPrediction object STATIC extends BranchPrediction object DYNAMIC extends BranchPrediction object DYNAMIC_TARGET extends BranchPrediction object BranchCtrlEnum e...
vexriscv/src/main/scala/vexriscv/plugin/BranchPlugin.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.029
false
false
13,876
-1
package vexriscv.demo import vexriscv.plugin._ import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import vexriscv.{plugin, VexRiscv, VexRiscvConfig} import spinal.core._ /** * Created by spinalvm on 15.06.17. */ object GenFullNoMmuNoCache extends App{ def cpu() = new VexRiscv( config = VexRiscvConfi...
vexriscv/src/main/scala/vexriscv/demo/GenFullNoMmuNoCache.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.05
false
false
1,785
-1
package vexriscv.demo import vexriscv.plugin._ import vexriscv.{VexRiscv, plugin, VexRiscvConfig} import vexriscv.ip.{DataCacheConfig, InstructionCacheConfig} import spinal.core._ import spinal.lib._ import spinal.lib.bus.amba3.apb.Apb3 import spinal.lib.bus.amba4.axi.{Axi4Shared, Axi4ReadOnly} import spinal.lib.bus.a...
vexriscv/src/main/scala/vexriscv/demo/VexRiscvAvalonForSim.scala
arch_code
vexriscv
vexriscv/src/main
MIT
MIT
baf7dc82f855eddaf5b0a20a6802c526f127e38a
other
false
0.107
false
false
7,067
-1
--- tags: - Original --- # Introduction to Dynamic Programming The essence of dynamic programming is to avoid repeated calculation. Often, dynamic programming problems are naturally solvable by recursion. In such cases, it's easiest to write the recursive solution, then save repeated states in a lookup table. This...
cp-algorithms/src/dynamic_programming/intro-to-dp.md
algorithms
cp-algorithms
cp-algorithms/src/dynamic_programming
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.183
false
false
10,249
-1
--- tags: - Translated e_maxx_link: binomial_coeff --- # Binomial Coefficients Binomial coefficients $\binom n k$ are the number of ways to select a set of $k$ elements from $n$ different elements without taking into account the order of arrangement of these elements (i.e., the number of unordered sets). Binomial ...
cp-algorithms/src/combinatorics/binomial-coefficients.md
algorithms
cp-algorithms
cp-algorithms/src/combinatorics
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.321
false
false
13,048
-1
--- title: K-th order statistic in O(N) tags: - Translated e_maxx_link: kth_order_statistics --- # $K$th order statistic in $O(N)$ Given an array $A$ of size $N$ and a number $K$. The problem is to find $K$-th largest number in the array, i.e., $K$-th order statistic. The basic idea - to use the idea of quick sort ...
cp-algorithms/src/sequences/k-th.md
algorithms
cp-algorithms
cp-algorithms/src/sequences
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.227
false
false
2,734
-1
# Garner's algorithm A consequence of the [Chinese Remainder Theorem](chinese-remainder-theorem.md) is, that we can represent big numbers using an array of small integers. For example, let $p$ be the product of the first $1000$ primes. $p$ has around $3000$ digits. Any number $a$ less than $p$ can be represented as a...
cp-algorithms/src/algebra/garners-algorithm.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.034
false
false
5,983
-1
--- tags: - Original --- # Divide and Conquer DP Divide and Conquer is a dynamic programming optimization. ### Preconditions Some dynamic programming problems have a recurrence of this form: $$ dp(i, j) = \min_{0 \leq k \leq j} \\{ dp(i - 1, k - 1) + C(k, j) \\} $$ where $C(k, j)$ is a cost function and $dp(i, ...
cp-algorithms/src/dynamic_programming/divide-and-conquer-dp.md
algorithms
cp-algorithms
cp-algorithms/src/dynamic_programming
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.086
false
false
5,857
-1
--- tags: - Translated e_maxx_link: longest_increasing_subseq_log --- # Longest increasing subsequence We are given an array with $n$ numbers: $a[0 \dots n-1]$. The task is to find the longest, strictly increasing, subsequence in $a$. Formally we look for the longest sequence of indices $i_1, \dots i_k$ such that ...
cp-algorithms/src/dynamic_programming/longest_increasing_subsequence.md
algorithms
cp-algorithms
cp-algorithms/src/dynamic_programming
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.079
false
false
18,515
-1
--- tags: - Translated e_maxx_link: rmq_linear --- # Solve RMQ (Range Minimum Query) by finding LCA (Lowest Common Ancestor) Given an array `A[0..N-1]`. For each query of the form `[L, R]` we want to find the minimum in the array `A` starting from position `L` and ending with position `R`. We will assume that the a...
cp-algorithms/src/graph/rmq_linear.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.093
false
false
3,972
-1
--- tags: - Translated e_maxx_link: duval_algorithm --- # Lyndon factorization ## Lyndon factorization First let us define the notion of the Lyndon factorization. A string is called **simple** (or a Lyndon word), if it is strictly **smaller than** any of its own nontrivial **suffixes**. Examples of simple strings...
cp-algorithms/src/string/lyndon_factorization.md
algorithms
cp-algorithms
cp-algorithms/src/string
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.089
false
false
5,808
-1
--- tags: - Translated e_maxx_link: mst_kruskal --- # Minimum spanning tree - Kruskal's algorithm Given a weighted undirected graph. We want to find a subtree of this graph which connects all vertices (i.e. it is a spanning tree) and has the least weight (i.e. the sum of weights of all the edges is minimum) of all ...
cp-algorithms/src/graph/mst_kruskal.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.373
false
false
9,440
-1
--- title: Deleting from a data structure in O(T(n) log n) tags: - Original --- # Deleting from a data structure in $O(T(n)\log n)$ Suppose you have a data structure which allows adding elements in **true** $O(T(n))$. This article will describe a technique that allows deletion in $O(T(n)\log n)$ offline. ## Algorit...
cp-algorithms/src/data_structures/deleting_in_log_n.md
algorithms
cp-algorithms
cp-algorithms/src/data_structures
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.053
false
false
4,287
-1
--- tags: - Original --- # Binary Exponentiation by Factoring Consider a problem of computing $ax^y \pmod{2^d}$, given integers $a$, $x$, $y$ and $d \geq 3$, where $x$ is odd. The algorithm below allows to solve this problem with $O(d)$ additions and binary operations and a single multiplication by $y$. Due to th...
cp-algorithms/src/algebra/factoring-exp.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.092
false
false
7,265
-1
--- tags: - Translated e_maxx_link: circle_tangents --- # Finding common tangents to two circles Given two circles. It is required to find all their common tangents, i.e. all such lines that touch both circles simultaneously. The described algorithm will also work in the case when one (or both) circles degenerate ...
cp-algorithms/src/geometry/tangents-to-two-circles.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.074
false
false
6,364
-1
--- tags: - Translated e_maxx_link: preflow_push --- # Maximum flow - Push-relabel algorithm The push-relabel algorithm (or also known as preflow-push algorithm) is an algorithm for computing the maximum flow of a flow network. The exact definition of the problem that we want to solve can be found in the article [M...
cp-algorithms/src/graph/push-relabel.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.053
false
false
8,163
-1
--- tags: - Original --- # Bit manipulation ## Binary number A **binary number** is a number expressed in the base-2 numeral system or binary numeral system, it is a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1" (one). We say that a certain bit is **set**, if it is one...
cp-algorithms/src/algebra/bit-manipulation.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.138
false
false
10,761
-1
--- tags: - Translated e_maxx_link: levit_algorithm --- # D´Esopo-Pape algorithm Given a graph with $n$ vertices and $m$ edges with weights $w_i$ and a starting vertex $v_0$. The task is to find the shortest path from the vertex $v_0$ to every other vertex. The algorithm from D´Esopo-Pape will work faster than [Di...
cp-algorithms/src/graph/desopo_pape.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.083
false
false
3,693
-1
--- title: Finding the Eulerian path in O(M) tags: - Translated e_maxx_link: euler_path --- # Finding the Eulerian path in $O(M)$ An Eulerian path is a path in a graph that passes through all of its edges exactly once. An Eulerian cycle is an Eulerian path that is a cycle. The problem is to find the Eulerian path i...
cp-algorithms/src/graph/euler_path.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.072
false
false
6,567
-1
--- title: Check if point belongs to the convex polygon in O(log N) tags: - Translated e_maxx_link: pt_in_polygon --- # Check if point belongs to the convex polygon in $O(\log N)$ Consider the following problem: you are given a convex polygon with integer vertices and a lot of queries. Each query is a point, for whi...
cp-algorithms/src/geometry/point-in-convex-polygon.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.085
false
false
6,558
-1
--- tags: - Translated e_maxx_link: circle_line_intersection --- # Circle-Line Intersection Given the coordinates of the center of a circle and its radius, and the equation of a line, you're required to find the points of intersection. ## Solution Instead of solving the system of two equations, we will approach t...
cp-algorithms/src/geometry/circle-line-intersection.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.111
false
false
3,577
-1
--- tags: - Translated e_maxx_link: bishops_arrangement --- # Placing Bishops on a Chessboard Find the number of ways to place $K$ bishops on an $N \times N$ chessboard so that no two bishops attack each other. ## Algorithm This problem can be solved using dynamic programming. Let's enumerate the diagonals of th...
cp-algorithms/src/combinatorics/bishops-on-chessboard.md
algorithms
cp-algorithms
cp-algorithms/src/combinatorics
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.086
false
false
2,724
-1
--- tags: - Translated e_maxx_link: treap --- # Treap (Cartesian tree) A treap is a data structure which combines binary tree and binary heap (hence the name: tree + heap $\Rightarrow$ Treap). More specifically, treap is a data structure that stores pairs $(X, Y)$ in a binary tree in such a way that it is a binary...
cp-algorithms/src/data_structures/treap.md
algorithms
cp-algorithms
cp-algorithms/src/data_structures
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.114
false
false
23,036
-1
--- tags: - Translated e_maxx_link: maximum_average_segment --- # Search the subarray with the maximum/minimum sum Here, we consider the problem of finding a subarray with maximum sum, as well as some of its variations (including the algorithm for solving this problem online). ## Problem statement Given an array ...
cp-algorithms/src/others/maximum_average_segment.md
algorithms
cp-algorithms
cp-algorithms/src/others
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.156
false
false
9,600
-1
--- search: exclude: true --- - Home - [Main Page](index.md) - [Navigation](navigation.md) - [Tag index](tags.md) - [How to Contribute](contrib.md) - [Code of conduct](code_of_conduct.md) - [Preview](preview.md) - Algebra - Fundamentals - [Binary Exponentiation](algebra/binary-exp...
cp-algorithms/src/navigation.md
algorithms
cp-algorithms
cp-algorithms
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.009
false
false
12,917
-1
--- tags: - Translated e_maxx_link: nearest_points --- # Finding the nearest pair of points ## Problem statement Given $n$ points on the plane. Each point $p_i$ is defined by its coordinates $(x_i,y_i)$. It is required to find among them two such points, such that the distance between them is minimal: $$ \min_{\s...
cp-algorithms/src/geometry/nearest_points.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.093
false
false
22,630
-1
--- tags: - Original --- # 0-1 BFS It is well-known, that you can find the shortest paths between a single source and all other vertices in $O(|E|)$ using [Breadth First Search](breadth-first-search.md) in an **unweighted graph**, i.e. the distance is the minimal number of edges that you need to traverse from the s...
cp-algorithms/src/graph/01_bfs.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.068
false
false
6,091
-1
--- tags: - Translated e_maxx_link: strong_connected_components --- # Strongly connected components and the condensation graph ## Definitions Let $G=(V,E)$ be a directed graph with vertices $V$ and edges $E \subseteq V \times V$. We denote with $n=|V|$ the number of vertices and with $m=|E|$ the number of edges in ...
cp-algorithms/src/graph/strongly-connected-components.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.175
false
false
28,182
-1
--- tags: - Translated e_maxx_link: preflow_push_faster --- # Maximum flow - Push-relabel method improved We will modify the [push-relabel method](push-relabel.md) to achieve a better runtime. ## Description The modification is extremely simple: In the previous article we chosen a vertex with excess without any p...
cp-algorithms/src/graph/push-relabel-faster.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.062
false
false
2,898
-1
--- tags: - Translated e_maxx_link: schedule_with_completion_duration --- # Optimal schedule of jobs given their deadlines and durations Suppose, we have a set of jobs, and we are aware of every job’s deadline and its duration. The execution of a job cannot be interrupted prior to its ending. It is required to crea...
cp-algorithms/src/schedules/schedule-with-completion-duration.md
algorithms
cp-algorithms
cp-algorithms/src/schedules
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.116
false
false
2,654
-1
--- tags: - Translated e_maxx_link: all_submasks --- # Submask Enumeration ## Enumerating all submasks of a given mask Given a bitmask $m$, you want to efficiently iterate through all of its submasks, that is, masks $s$ in which only bits that were included in mask $m$ are set. Consider the implementation of this...
cp-algorithms/src/algebra/all-submasks.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.241
false
false
3,682
-1
--- tags: - Translated e_maxx_link: big_integer --- # Arbitrary-Precision Arithmetic Arbitrary-Precision arithmetic, also known as "bignum" or simply "long arithmetic" is a set of data structures and algorithms which allows to process much greater numbers than can be fit in standard data types. Here are several typ...
cp-algorithms/src/algebra/big-integer.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.216
false
false
10,063
-1
--- tags: - Translated e_maxx_link: lca_simpler --- # Lowest Common Ancestor - Binary Lifting Let $G$ be a tree. For every query of the form `(u, v)` we want to find the lowest common ancestor of the nodes `u` and `v`, i.e. we want to find a node `w` that lies on the path from `u` to the root node, that lies on the...
cp-algorithms/src/graph/lca_binary_lifting.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.051
false
false
15,082
-1
--- tags: - Translated e_maxx_link: topological_sort --- # Topological Sorting You are given a directed graph with $n$ vertices and $m$ edges. You have to find an **order of the vertices**, so that every edge leads from the vertex with a smaller index to a vertex with a larger one. In other words, you want to find...
cp-algorithms/src/graph/topological-sort.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.079
false
false
6,094
-1
--- tags: - Translated e_maxx_link: prefix_function --- # Prefix function. Knuth–Morris–Pratt algorithm ## Motivation Suppose we want to find all occurrences of a non-empty string $s$ in a text $t$. Starting at position $0$, we compare $s[0]$ with $t[0]$, $s[1]$ with $t[1]$, and so on, until we find a mismatch or ...
cp-algorithms/src/string/prefix-function.md
algorithms
cp-algorithms
cp-algorithms/src/string
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.098
false
false
23,144
-1
--- tags: - Translated e_maxx_link: floyd_warshall_algorithm --- # Floyd-Warshall Algorithm Given a directed or an undirected weighted graph $G$ with $n$ vertices. The task is to find the length of the shortest path $d_{ij}$ between each pair of vertices $i$ and $j$. The graph may have negative weight edges, but n...
cp-algorithms/src/graph/all-pair-shortest-path-floyd-warshall.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.272
false
false
11,795
-1
--- tags: - Original --- # Maximum flow - MPM algorithm MPM (Malhotra, Pramodh-Kumar and Maheshwari) algorithm solves the maximum flow problem in $O(V^3)$. This algorithm is similar to [Dinic's algorithm](dinic.md). ## Algorithm Like Dinic's algorithm, MPM runs in phases, during each phase we find the blocking fl...
cp-algorithms/src/graph/mpm.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.025
false
false
7,387
-1
--- tags: - Translated e_maxx_link: counting_connected_graphs --- # Counting labeled graphs ## Labeled graphs Let the number of vertices in a graph be $n$. We have to compute the number $G_n$ of labeled graphs with $n$ vertices (labeled means that the vertices are marked with the numbers from $1$ to $n$). The edge...
cp-algorithms/src/combinatorics/counting_labeled_graphs.md
algorithms
cp-algorithms
cp-algorithms/src/combinatorics
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.158
false
false
3,270
-1
--- tags: - Original --- # Operations on polynomials and series Problems in competitive programming, especially the ones involving enumeration some kind, are often solved by reducing the problem to computing something on polynomials and formal power series. This includes concepts such as polynomial multiplication,...
cp-algorithms/src/algebra/polynomial.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.109
false
false
25,943
-1
--- tags: - Original --- # Second Best Minimum Spanning Tree A Minimum Spanning Tree $T$ is a tree for the given graph $G$ which spans over all vertices of the given graph and has the minimum weight sum of all the edges, from all the possible spanning trees. A second best MST $T'$ is a spanning tree, that has the s...
cp-algorithms/src/graph/second_best_mst.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.065
false
false
7,812
-1
--- tags: - Translated e_maxx_link: johnson_problem_1 --- # Scheduling jobs on one machine This task is about finding an optimal schedule for $n$ jobs on a single machine, if the job $i$ can be processed in $t_i$ time, but for the $t$ seconds waiting before processing the job a penalty of $f_i(t)$ has to be paid. ...
cp-algorithms/src/schedules/schedule_one_machine.md
algorithms
cp-algorithms
cp-algorithms/src/schedules
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.163
false
false
4,150
-1
--- tags: - Translated e_maxx_link: burnside_polya --- # Burnside's lemma / Pólya enumeration theorem ## Burnside's lemma **Burnside's lemma** was formulated and proven by **Burnside** in 1897, but historically it was already discovered in 1887 by **Frobenius**, and even earlier in 1845 by **Cauchy**. Therefore it...
cp-algorithms/src/combinatorics/burnside.md
algorithms
cp-algorithms
cp-algorithms/src/combinatorics
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.137
false
false
15,790
-1
--- tags: - Original --- # Minkowski sum of convex polygons ## Definition Consider two sets $A$ and $B$ of points on a plane. Minkowski sum $A + B$ is defined as $\{a + b| a \in A, b \in B\}$. Here we will consider the case when $A$ and $B$ consist of convex polygons $P$ and $Q$ with their interiors. Throughout thi...
cp-algorithms/src/geometry/minkowski.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.16
false
false
5,341
-1
--- tags: - Original --- # Primality tests This article describes multiple algorithms to determine if a number is prime or not. ## Trial division By definition a prime number doesn't have any divisors other than $1$ and itself. A composite number has at least one additional divisor, let's call it $d$. Naturally...
cp-algorithms/src/algebra/primality_tests.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.046
false
false
8,728
-1
--- tags: - Translated e_maxx_link: segments_intersection --- # Finding intersection of two segments You are given two segments AB and CD, described as pairs of their endpoints. Each segment can be a single point if its endpoints are the same. You have to find the intersection of these segments, which can be empty...
cp-algorithms/src/geometry/segments-intersection.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.053
false
false
4,009
-1
--- title: Point location in O(log n) tags: - Original --- # Point location in $O(log n)$ Consider the following problem: you are given a [planar subdivision](https://en.wikipedia.org/wiki/Planar_straight-line_graph) without any vertices of degree one and zero, and a lot of queries. Each query is a point, for which ...
cp-algorithms/src/geometry/point-location.md
algorithms
cp-algorithms
cp-algorithms/src/geometry
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.053
false
false
11,854
-1
--- tags: - Translated e_maxx_link: z_function --- # Z-function and its calculation Suppose we are given a string $s$ of length $n$. The **Z-function** for this string is an array of length $n$ where the $i$-th element is equal to the greatest number of characters starting from the position $i$ that coincide with t...
cp-algorithms/src/string/z-function.md
algorithms
cp-algorithms
cp-algorithms/src/string
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.267
false
false
13,224
-1
--- tags: - Translated e_maxx_link: segment_tree --- # Segment Tree A Segment Tree is a data structure that stores information about array intervals as a tree. This allows answering range queries over an array efficiently, while still being flexible enough to allow quick modification of the array. This includes fin...
cp-algorithms/src/data_structures/segment_tree.md
algorithms
cp-algorithms
cp-algorithms/src/data_structures
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.069
false
false
66,717
-1
--- tags: - Original --- # Montgomery Multiplication Many algorithms in number theory, like [prime testing](primality_tests.md) or [integer factorization](factorization.md), and in cryptography, like RSA, require lots of operations modulo a large number. A multiplications like $x y \bmod{n}$ is quite slow to comput...
cp-algorithms/src/algebra/montgomery_multiplication.md
algorithms
cp-algorithms
cp-algorithms/src/algebra
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.062
false
false
8,392
-1
--- tags: - Translated e_maxx_link: edmonds_karp --- # Maximum flow - Ford-Fulkerson and Edmonds-Karp The Edmonds-Karp algorithm is an implementation of the Ford-Fulkerson method for computing a maximum flow in a flow network. ## Flow network First let's define what a **flow network**, a **flow**, and a **maximum...
cp-algorithms/src/graph/edmonds_karp.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.054
false
false
11,780
-1
--- tags: - Translated e_maxx_link: connected_components --- # Search for connected components in a graph Given an undirected graph $G$ with $n$ nodes and $m$ edges. We are required to find in it all the connected components, i.e, several groups of vertices such that within a group each vertex can be reached from a...
cp-algorithms/src/graph/search-for-connected-components.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.151
false
false
3,468
-1
--- tags: - Translated e_maxx_link: lca_linear --- # Lowest Common Ancestor - Farach-Colton and Bender Algorithm Let $G$ be a tree. For every query of the form $(u, v)$ we want to find the lowest common ancestor of the nodes $u$ and $v$, i.e. we want to find a node $w$ that lies on the path from $u$ to the root nod...
cp-algorithms/src/graph/lca_farachcoltonbender.md
algorithms
cp-algorithms
cp-algorithms/src/graph
CC-BY-SA-4.0
CC-BY-SA-4.0
bbbbb6f04e5c9a665c8477ec68ee4f28b1367dd7
doc
false
0.057
false
false
9,856
-1