Verilog¶
Structure¶
The repo in VHDL is structured around different folders, each for a dedicated section.
Top level¶
The top level file on VHDL isn’t even finished, as this version did never pass the timing expectations of the project.
rv32¶
rv32.sv
rv32 module
MICROCHIP
Imports¶
Imports 1 element
core_config_pkg XLEN
Ports¶
Ports list 3 elements
Name |
Direction |
Description |
Type |
Size |
Kind |
Polarity |
Fanout |
|---|---|---|---|---|---|---|---|
clk |
Input |
Standard IOs |
|
- |
Combinatorial |
- |
Fanout : 0 |
rst_n |
Input |
|
|
- |
Combinatorial |
Negative |
Fanout : 0 |
interrupt_vect |
Input |
Add here your peripherals outputs if needed :) |
|
|
Combinatorial |
- |
Fanout : 0 |
Modules¶
Modules 3 elements
• core : riscv MICROCHIP
Instantiationt the main core
Connections :
• ram : RAM0
• rom : ROM0
Connections :
Signals¶
Signals list 13 elements
Name |
Description |
Type |
Size |
Kind |
Fanout |
|---|---|---|---|---|---|
int_rst_n |
Internal global signals |
|
- |
Register clk |
Fanout : 0 |
rom 5 elements
Name |
Description |
Type |
Size |
Kind |
Fanout |
|---|---|---|---|---|---|
rom_instr |
ROM signals |
|
|
Combinatorial |
Fanout : 0 |
rom_addr |
verilator lint_off UNUSEDSIGNAL |
|
|
Combinatorial |
Fanout : 0 |
rom_flush |
verilator lint_on UNUSEDSIGNAL |
|
- |
Combinatorial |
Fanout : 0 |
rom_enable |
|
|
- |
Combinatorial |
Fanout : 0 |
rom_rden |
|
|
- |
Combinatorial |
Fanout : 0 |
mem 7 elements
Name |
Description |
Type |
Size |
Kind |
Fanout |
|---|---|---|---|---|---|
mem_addr |
verilator lint_off UNUSEDSIGNAL |
|
|
Combinatorial |
Fanout : 0 |
mem_byteen |
verilator lint_on UNUSEDSIGNAL |
|
|
Combinatorial |
Fanout : 0 |
mem_we |
|
|
- |
Combinatorial |
Fanout : 0 |
mem_req |
|
|
- |
Combinatorial |
Fanout : 0 |
mem_wdata |
verilator lint_off MULTIDRIVEN |
|
|
Combinatorial |
Fanout : 0 |
mem_rdata |
Thesesignals are behind tri-state drivers, but verilator does not know that. |
|
|
Combinatorial |
Fanout : 0 |
mem_err |
verilator lint_on MULTIDRIVEN |
|
- |
Combinatorial |
Fanout : 0 |
Instantiation templates¶
Instantiation templates 2 elements
rv32 <name> (
.clk (i_clk),
.rst_n (i_rst_n),
.interrupt_vect (i_interrupt_vect)
);
<name>: entity work.rv32
port map (
clk => i_clk,
rst_n => i_rst_n,
interrupt_vect => i_interrupt_vect
);
Source¶
Raw source Full file
/*
* File : rtl/rv32.sv
*
* Author : l.heywang <leonard.heywang@proton.me>
* Date :
*
* Brief : This file is the top level of the whole core.
* Feel free to modify it to get the right core for your needs !
*/
`timescale 1ns / 1ps
import core_config_pkg::XLEN;
module rv32 (
// Standard IOs
input logic clk,
input logic rst_n,
// Add here your peripherals outputs if needed :)
input logic [(core_config_pkg::XLEN - 1) : 0] interrupt_vect
);
/*
* Internal global signals
*/
logic int_rst_n;
/*
* ROM signals
*/
logic [ (XLEN - 1) : 0] rom_instr;
/* verilator lint_off UNUSEDSIGNAL */
logic [ (XLEN - 1) : 0] rom_addr;
/* verilator lint_on UNUSEDSIGNAL */
logic rom_flush;
logic rom_enable;
logic rom_rden;
/*
* Memory / Peripherals signals
*/
/* verilator lint_off UNUSEDSIGNAL */
logic [ (XLEN - 1) : 0] mem_addr;
/* verilator lint_on UNUSEDSIGNAL */
logic [(XLEN / 8) - 1:0] mem_byteen;
logic mem_we;
logic mem_req;
logic [ (XLEN - 1) : 0] mem_wdata;
/* verilator lint_off MULTIDRIVEN */ // Thesesignals are behind tri-state drivers, but verilator does not know that.
logic [ (XLEN - 1) : 0] mem_rdata;
/* verilator lint_on MULTIDRIVEN */
logic mem_err;
/*
* Instantiationt the main core
*/
core riscv (
.clk(clk),
.i_rst_n(rst_n),
.o_rst_n(int_rst_n),
.instr(rom_instr),
.rom_addr(rom_addr),
.flush(rom_flush),
.enable(rom_enable),
.rden(rom_rden),
.mem_addr(mem_addr),
.mem_byteen(mem_byteen),
.mem_we(mem_we),
.mem_req(mem_req),
.mem_wdata(mem_wdata),
.mem_rdata(mem_rdata),
.mem_err(mem_err),
.interrupt_vect(interrupt_vect)
);
/*
* Adding RAM and ROM (Actually, Altera IP's, to fit into MAX10 FPGA).
* Feel free to replace them with your vendors custom IPs, the interfaces
* shall not differ too much from one to the other.
*/
ram RAM0 (
.aclr(int_rst_n),
.byteena_a(mem_byteen),
.clock(clk),
.enable(1'b1),
.rdaddress(mem_addr[16:2]),
.wraddress(mem_addr[16:2]),
.wren(mem_we),
.q(mem_rdata),
.data(mem_wdata)
);
/*
* For the first version, we stuck it to GND. We'll later add
* a error handling for the memory IOs (if needed ?).
*/
assign mem_err = 1'b0;
rom ROM0 (
.aclr(1'b1 | rom_flush),
.address_a(rom_addr[17:2]),
.address_b(mem_addr[17:2]),
.clock(clk),
.enable(rom_enable),
.rden_a(rom_rden),
.rden_b(mem_req),
.q_a(rom_instr),
.q_b(mem_rdata)
);
endmodule