Skip to content

Commit 5da7507

Browse files
committed
Adapt firmware-binaries/ code to new numeric types
1 parent 33b6974 commit 5da7507

17 files changed

Lines changed: 338 additions & 177 deletions

File tree

bittide-instances/src/Bittide/Instances/Hitl/SoftUgnDemo/Core.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ muConfig ::
7373
muConfig =
7474
PeConfig
7575
{ cpu = Riscv32imc.vexRiscv1
76-
, depthI = SNat @(Div (64 * 1024) 4)
76+
, depthI = SNat @(Div (80 * 1024) 4)
7777
, depthD = SNat @(Div (64 * 1024) 4)
7878
, initI = Nothing
7979
, initD = Nothing

bittide-instances/src/Bittide/Instances/Hitl/SwitchDemo/Core.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ muConfig ::
140140
muConfig =
141141
PeConfig
142142
{ cpu = Riscv32imc.vexRiscv1
143-
, depthI = SNat @(Div (64 * 1024) 4)
143+
, depthI = SNat @(Div (72 * 1024) 4)
144144
, depthD = SNat @(Div (64 * 1024) 4)
145145
, initI = Nothing
146146
, initD = Nothing
@@ -157,7 +157,7 @@ ccConfig ::
157157
ccConfig =
158158
PeConfig
159159
{ cpu = Riscv32imc.vexRiscv2
160-
, depthI = SNat @(Div (64 * 1024) 4)
160+
, depthI = SNat @(Div (72 * 1024) 4)
161161
, depthD = SNat @(Div (64 * 1024) 4)
162162
, initI = Nothing
163163
, initD = Nothing

firmware-binaries/Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

firmware-binaries/demos/clock-control/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//
66
// SPDX-License-Identifier: Apache-2.0
77

8+
use bittide_hal::manual_additions::unsigned::Unsigned;
89
use core::panic::PanicInfo;
910
use itertools::izip;
1011

@@ -68,7 +69,7 @@ fn main() -> ! {
6869
)
6970
.map(|(i, counter)| {
7071
if domain_diff_counters.enable(i).unwrap_or(false) {
71-
Some(counter)
72+
Some(counter.into_inner())
7273
} else {
7374
None
7475
}
@@ -81,7 +82,8 @@ fn main() -> ! {
8182

8283
// Store debug information. Stop capturing samples if we are stable to
8384
// reduce plot sizes.
84-
let has_sense_of_global_time = freeze.number_of_sync_pulses_seen() != 0;
85+
let has_sense_of_global_time =
86+
freeze.number_of_sync_pulses_seen() != Unsigned::new(0).unwrap();
8587
if !prev_all_stable && has_sense_of_global_time {
8688
sample_store.store(&freeze, stability, callisto.accumulated_speed_requests);
8789
}

firmware-binaries/demos/soft-ugn-mu/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ license = "Apache-2.0"
1010
authors = ["Google LLC"]
1111

1212
[dependencies]
13-
riscv-rt = "0.11.0"
13+
bittide-macros = { path = "../../../firmware-support/bittide-macros" }
14+
bittide-hal = { path = "../../../firmware-support/bittide-hal" }
1415
bittide-sys = { path = "../../../firmware-support/bittide-sys" }
16+
riscv-rt = "0.11.0"
1517
ufmt = "0.2.0"
16-
bittide-hal = { path = "../../../firmware-support/bittide-hal" }
1718

1819
[build-dependencies]
1920
memmap-generate = { path = "../../../firmware-support/memmap-generate" }

firmware-binaries/demos/soft-ugn-mu/src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
//
66
// SPDX-License-Identifier: Apache-2.0
77

8-
use bittide_hal::hals::soft_ugn_demo_mu::DeviceInstances;
9-
use bittide_hal::manual_additions::calendar::RingbufferCalendar;
10-
use bittide_hal::shared_devices::{Transceivers, Uart};
8+
use bittide_hal::{
9+
hals::soft_ugn_demo_mu::DeviceInstances,
10+
manual_additions::calendar::RingbufferCalendar,
11+
shared_devices::{Transceivers, Uart},
12+
};
1113
use bittide_sys::stability_detector::Stability;
1214
use core::panic::PanicInfo;
1315
use ufmt::uwriteln;
@@ -132,7 +134,7 @@ fn main() -> ! {
132134
"Capture UGN {}: local = {}, remote = {}",
133135
i,
134136
capture_ugn.local_counter(),
135-
capture_ugn.remote_counter()
137+
capture_ugn.remote_counter(),
136138
)
137139
.unwrap();
138140
*done = true;
@@ -153,7 +155,7 @@ fn main() -> ! {
153155

154156
loop {
155157
for (i, eb) in elastic_buffers.iter().enumerate() {
156-
let occupancy = eb.data_count();
158+
let occupancy = eb.data_count().into_inner();
157159
let (min, max) = occupancy_ranges[i];
158160

159161
// Check if occupancy exceeds current range

firmware-binaries/demos/switch-demo1-mu/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
//
66
// SPDX-License-Identifier: Apache-2.0
77

8-
use bittide_hal::hals::switch_demo_mu::DeviceInstances;
9-
use bittide_hal::shared_devices::{ElasticBuffer, Transceivers};
8+
use bittide_hal::{
9+
hals::switch_demo_mu::DeviceInstances,
10+
shared_devices::{ElasticBuffer, Transceivers},
11+
};
1012
use bittide_sys::stability_detector::Stability;
1113
use core::panic::PanicInfo;
1214
use ufmt::uwriteln;

firmware-binaries/demos/switch-demo2-mu/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn main() -> ! {
106106
"Capture UGN {}: local = {}, remote = {}",
107107
i,
108108
capture_ugn.local_counter(),
109-
capture_ugn.remote_counter()
109+
capture_ugn.remote_counter(),
110110
)
111111
.unwrap();
112112
*done = true;

firmware-binaries/hitl-tests/clock-board/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn check_frequency(
7878
domain_diff_counters.set_enable(0, false);
7979

8080
let diff = match (start, end) {
81-
(Some(s), Some(e)) => e - s,
81+
(Some(s), Some(e)) => e.into_inner() - s.into_inner(),
8282
_ => return Err(FrequencyCheckError::CounterInaccessible),
8383
};
8484

firmware-binaries/sim-tests/capture_ugn_test/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ fn main() -> ! {
2626
}
2727
uwriteln!(
2828
uart,
29-
"(0x{:16X},0x{:16X})",
29+
"({},{})",
3030
capture_ugn.local_counter(),
31-
capture_ugn.remote_counter()
31+
capture_ugn.remote_counter(),
3232
)
3333
.unwrap();
3434
loop {

0 commit comments

Comments
 (0)