Skip to content

Commit b930ea3

Browse files
committed
Use PLIC and CLINT from riscv-peripheral
1 parent 8f6b47f commit b930ea3

File tree

2 files changed

+241
-155
lines changed

2 files changed

+241
-155
lines changed

src/generate/device.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,14 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
189189
});
190190
}
191191

192-
debug!("Rendering interrupts");
193192
match config.target {
194193
#[cfg(feature = "unstable-riscv")]
195194
Target::RISCV => {
196-
if let Some(riscv) = d.riscv.as_ref() {
197-
out.extend(riscv::render(riscv, &d.peripherals, device_x)?);
198-
} else {
199-
out.extend(interrupt::render(
200-
config.target,
201-
&d.peripherals,
202-
device_x,
203-
config,
204-
)?);
205-
}
195+
debug!("Rendering RISC-V specific code");
196+
out.extend(riscv::render(d.riscv.as_ref(), &d.peripherals, device_x)?);
206197
}
207198
_ => {
199+
debug!("Rendering interrupts");
208200
out.extend(interrupt::render(
209201
config.target,
210202
&d.peripherals,
@@ -222,6 +214,11 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
222214
// Core peripherals are handled above
223215
continue;
224216
}
217+
#[cfg(feature = "unstable-riscv")]
218+
if config.target == Target::RISCV && riscv::is_riscv_peripheral(p) {
219+
// RISC-V specific peripherals are handled above
220+
continue;
221+
}
225222

226223
debug!("Rendering peripheral {}", p.name);
227224
let periph = peripheral::render(p, &index, config).with_context(|| {

0 commit comments

Comments
 (0)