Skip to content

Commit a15fd6a

Browse files
authored
Merge branch 'YosysHQ:main' into gatemate-demo
2 parents 5267e9a + 87c89ac commit a15fd6a

File tree

6 files changed

+52
-10
lines changed

6 files changed

+52
-10
lines changed

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
push:
3+
pull_request:
4+
workflow_dispatch:
5+
6+
jobs:
7+
riscv-formal:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout picorv32.v
12+
uses: actions/checkout@v4
13+
with:
14+
sparse-checkout: |
15+
picorv32.v
16+
sparse-checkout-cone-mode: false
17+
- name: Checkout riscv-formal
18+
uses: actions/checkout@v4
19+
with:
20+
repository: YosysHQ/riscv-formal
21+
path: riscv-formal
22+
- name: cp picorv32.v
23+
run: |
24+
cp picorv32.v -t riscv-formal/cores/picorv32
25+
26+
- uses: YosysHQ/setup-oss-cad-suite@v3
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: make checks
31+
run: |
32+
cd riscv-formal/cores/picorv32
33+
make checks -j$(nproc)
34+
- name: make check
35+
run: |
36+
cd riscv-formal/cores/picorv32
37+
make check

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![.github/workflows/ci.yml](https://github.com/YosysHQ/picorv32/actions/workflows/ci.yml/badge.svg)](https://github.com/YosysHQ/picorv32/actions/workflows/ci.yml)
12

23
PicoRV32 - A Size-Optimized RISC-V CPU
34
======================================
@@ -237,7 +238,9 @@ triggering an interrupt.
237238

238239
#### ENABLE_PCPI (default = 0)
239240

240-
Set this to 1 to enable the Pico Co-Processor Interface (PCPI).
241+
Set this to 1 to enable the _external_ Pico Co-Processor Interface (PCPI).
242+
The external interface is not required for the internal PCPI cores, such as
243+
`picorv32_pcpi_mul`.
241244

242245
#### ENABLE_MUL (default = 0)
243246

@@ -284,7 +287,7 @@ Support for the timer is always disabled when ENABLE_IRQ is set to 0.
284287
#### ENABLE_TRACE (default = 0)
285288

286289
Produce an execution trace using the `trace_valid` and `trace_data` output ports.
287-
For a demontration of this feature run `make test_vcd` to create a trace file
290+
For a demonstration of this feature run `make test_vcd` to create a trace file
288291
and then run `python3 showtrace.py testbench.trace firmware/firmware.elf` to decode
289292
it.
290293

@@ -735,4 +738,3 @@ See `make area` in [scripts/vivado/](scripts/vivado/).
735738
| PicoRV32 (small) | 761 | 48 | 442 |
736739
| PicoRV32 (regular) | 917 | 48 | 583 |
737740
| PicoRV32 (large) | 2019 | 88 | 1085 |
738-

firmware/start.S

-2
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ irq_vec:
327327

328328
picorv32_retirq_insn()
329329

330-
#ifndef ENABLE_QREGS
331330
.balign 0x200
332-
#endif
333331
irq_regs:
334332
// registers are saved to this memory region during interrupt handling
335333
// the program counter is saved as register 0

picorv32.v

+8-3
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,12 @@ module picorv32 #(
648648
reg instr_lb, instr_lh, instr_lw, instr_lbu, instr_lhu, instr_sb, instr_sh, instr_sw;
649649
reg instr_addi, instr_slti, instr_sltiu, instr_xori, instr_ori, instr_andi, instr_slli, instr_srli, instr_srai;
650650
reg instr_add, instr_sub, instr_sll, instr_slt, instr_sltu, instr_xor, instr_srl, instr_sra, instr_or, instr_and;
651-
reg instr_rdcycle, instr_rdcycleh, instr_rdinstr, instr_rdinstrh, instr_ecall_ebreak;
651+
reg instr_rdcycle, instr_rdcycleh, instr_rdinstr, instr_rdinstrh, instr_ecall_ebreak, instr_fence;
652652
reg instr_getq, instr_setq, instr_retirq, instr_maskirq, instr_waitirq, instr_timer;
653653
wire instr_trap;
654654

655-
reg [regindex_bits-1:0] decoded_rd, decoded_rs1, decoded_rs2;
655+
reg [regindex_bits-1:0] decoded_rd, decoded_rs1;
656+
reg [4:0] decoded_rs2;
656657
reg [31:0] decoded_imm, decoded_imm_j;
657658
reg decoder_trigger;
658659
reg decoder_trigger_q;
@@ -680,7 +681,7 @@ module picorv32 #(
680681
instr_lb, instr_lh, instr_lw, instr_lbu, instr_lhu, instr_sb, instr_sh, instr_sw,
681682
instr_addi, instr_slti, instr_sltiu, instr_xori, instr_ori, instr_andi, instr_slli, instr_srli, instr_srai,
682683
instr_add, instr_sub, instr_sll, instr_slt, instr_sltu, instr_xor, instr_srl, instr_sra, instr_or, instr_and,
683-
instr_rdcycle, instr_rdcycleh, instr_rdinstr, instr_rdinstrh,
684+
instr_rdcycle, instr_rdcycleh, instr_rdinstr, instr_rdinstrh, instr_fence,
684685
instr_getq, instr_setq, instr_retirq, instr_maskirq, instr_waitirq, instr_timer};
685686

686687
wire is_rdcycle_rdcycleh_rdinstr_rdinstrh;
@@ -746,6 +747,7 @@ module picorv32 #(
746747
if (instr_rdcycleh) new_ascii_instr = "rdcycleh";
747748
if (instr_rdinstr) new_ascii_instr = "rdinstr";
748749
if (instr_rdinstrh) new_ascii_instr = "rdinstrh";
750+
if (instr_fence) new_ascii_instr = "fence";
749751

750752
if (instr_getq) new_ascii_instr = "getq";
751753
if (instr_setq) new_ascii_instr = "setq";
@@ -1083,6 +1085,7 @@ module picorv32 #(
10831085

10841086
instr_ecall_ebreak <= ((mem_rdata_q[6:0] == 7'b1110011 && !mem_rdata_q[31:21] && !mem_rdata_q[19:7]) ||
10851087
(COMPRESSED_ISA && mem_rdata_q[15:0] == 16'h9002));
1088+
instr_fence <= (mem_rdata_q[6:0] == 7'b0001111 && !mem_rdata_q[14:12]);
10861089

10871090
instr_getq <= mem_rdata_q[6:0] == 7'b0001011 && mem_rdata_q[31:25] == 7'b0000000 && ENABLE_IRQ && ENABLE_IRQ_QREGS;
10881091
instr_setq <= mem_rdata_q[6:0] == 7'b0001011 && mem_rdata_q[31:25] == 7'b0000001 && ENABLE_IRQ && ENABLE_IRQ_QREGS;
@@ -1158,6 +1161,8 @@ module picorv32 #(
11581161
instr_sra <= 0;
11591162
instr_or <= 0;
11601163
instr_and <= 0;
1164+
1165+
instr_fence <= 0;
11611166
end
11621167
end
11631168

picosoc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ clean:
152152
rm -f testbench.vvp testbench.vcd spiflash_tb.vvp spiflash_tb.vcd
153153
rm -f hx8kdemo_fw.elf hx8kdemo_fw.hex hx8kdemo_fw.bin cmos.log
154154
rm -f icebreaker_fw.elf icebreaker_fw.hex icebreaker_fw.bin
155-
rm -f hx8kdemo.blif hx8kdemo.log hx8kdemo.asc hx8kdemo.rpt hx8kdemo.bin
155+
rm -f hx8kdemo.json hx8kdemo.log hx8kdemo.asc hx8kdemo.rpt hx8kdemo.bin
156156
rm -f hx8kdemo_syn.v hx8kdemo_syn_tb.vvp hx8kdemo_tb.vvp
157157
rm -f icebreaker.json icebreaker.log icebreaker.asc icebreaker.rpt icebreaker.bin
158158
rm -f icebreaker_syn.v icebreaker_syn_tb.vvp icebreaker_tb.vvp

scripts/cxxdemo/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CXX = $(RISCV_TOOLS_PREFIX)g++
33
CC = $(RISCV_TOOLS_PREFIX)gcc
44
AS = $(RISCV_TOOLS_PREFIX)gcc
55
CXXFLAGS = -MD -Os -Wall -std=c++11
6-
CCFLAGS = -MD -Os -Wall -std=c++11
6+
CFLAGS = -MD -Os -Wall -std=c++11
77
LDFLAGS = -Wl,--gc-sections
88
LDLIBS = -lstdc++
99

0 commit comments

Comments
 (0)