MTNLHQLQZKMX7PKQ3CDVBVFE3AGOTZHUY2WATLRBJWLFZBW6SXJQC // SPDX-License-Identifier: CERN-OHL-S-2.0// A basic SOC with the core, ram, and uart// Default 16KB ram`default_nettype none`timescale 1ps/1psmodule soc#(parameter integer MEM_WORDS = 4096)(input bit clk,input bit rst,input bit uart_rx,output bit uart_tx);// TODO: impl uartassign uart_tx = 0 & uart_rx & rst;// Memorystruct {bit [3:0] wen;bit [31:0] addr;bit [31:0] rdata;bit [31:0] wdata;} mem;logic [31:0] memory [0:MEM_WORDS-1];always_ff @(posedge clk) beginmem.rdata <= memory[mem.addr];if (mem.wen[0]) memory[mem.addr][ 7: 0] <= mem.wdata[ 7: 0];if (mem.wen[1]) memory[mem.addr][15: 8] <= mem.wdata[15: 8];if (mem.wen[2]) memory[mem.addr][23:16] <= mem.wdata[23:16];if (mem.wen[3]) memory[mem.addr][31:24] <= mem.wdata[31:24];end// End Memory// synthesis translate offlogic [1000:0] mem_file;initial beginif ($test$plusargs("trace") != 0) begin$display("[%0t] Tracing to logs/vlt_dump.vcd...\n", $time);$dumpfile("logs/vlt_dump.vcd");$dumpvars();endif ($value$plusargs("mem", mem_file)) begin$display("[%0t] Initializing memory\n", $time);$readmemh(mem_file, memory);endend// synthesis translate onendmodule
# Barrel - A (work in progress) parallel RISC-V application processorThe core targets RV32IAMS to fit on reasonably priced FPGAs while still being able to boot Linux.A toolchain will need to be compiled from source, as the default extensions for RISC-V toolchains are GC, and the `ilp32` ABI used is not compatible with the ABI they use.Future work may enable D & V extensions to use the DSP blocks found on most FPGAS.
# SPDX-License-Identifier: CERN-OHL-S-2.0VERILATOR ?= verilatorVERILATOR_COVERAGE ?= verilator_coverageYOSYS ?= yosysSMTBMC ?= yosys-smtbmc# Keep frame pointers for debuggingCXXFLAGS += -fno-omit-frame-pointer# Don't use exceptions or rtti to reduce code bloatCXXFLAGS += -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables# Tune for current CPU to improve simulation performanceCXXFLAGS += -march=native -mtune=native# Use the mold linker to massively improve linking speedLDFLAGS += -fuse-ld=mold# Enable multithreaded verilationVERILATOR_FLAGS += -j $(nproc)# Generate C++VERILATOR_FLAGS += --cc# Generate depsVERILATOR_FLAGS += -MMD# Split generated files into small translation units to improve iterative compile speedVERILATOR_FLAGS += --output-split 500# Split generated functions to improve compilation speedVERILATOR_FLAGS += --output-split-cfuncs 50 --output-split-ctrace 50# Warn about lint issuesVERILATOR_FLAGS += -Wall# Check assertionsVERILATOR_FLAGS += --assert# Generate coverage analysisVERILATOR_FLAGS += --coverage# Generate a multithreaded simulator# VERILATOR_FLAGS += --threads $(nproc)VERILATOR_DEPFILES = $(wildcard obj_dir/*.d)default: socsoc: soc-generate-cxx soc-compile-cxxsoc-generate-cxx:$(VERILATOR) $(VERILATOR_FLAGS) rtl/soc.svsoc-compile-cxx:$(MAKE) -j -C obj_dir -f Vsoc.mk-include $(VERILATOR_DEPFILES)
obj_dir/