Update note.cpp and main.cpp for new CSRStorage layout

This commit is contained in:
Aadi Desai 2023-05-18 11:38:39 +01:00
parent b2573b5f95
commit afcf1093be
No known key found for this signature in database
4 changed files with 26 additions and 7 deletions

View file

@ -124,7 +124,7 @@ static void leds_cmd(char **val) {
static void saw_cmd(char **val) { static void saw_cmd(char **val) {
int value = (int)strtol(get_token(val), NULL, 0); int value = (int)strtol(get_token(val), NULL, 0);
printf("Setting Sawtooth to %dHz\n", value); printf("Setting Sawtooth to %dHz\n", value);
audio_targ_write(value); audio_targ0_write(value);
} }
static void imperial_cmd() { static void imperial_cmd() {

View file

@ -2,7 +2,7 @@
#include <stdint.h> #include <stdint.h>
void note(uint32_t frequency, unsigned int duration_ms) { void note(uint32_t frequency, unsigned int duration_ms) {
audio_targ_write(frequency); audio_targ0_write(frequency);
busy_wait(duration_ms); busy_wait(duration_ms);
audio_targ_write(0); audio_targ0_write(0);
} }

View file

@ -241,8 +241,8 @@ class BaseSoC(SoCCore):
self.add_uartbone(name="debug_uart", baudrate=921600) self.add_uartbone(name="debug_uart", baudrate=921600)
from litescope import LiteScopeAnalyzer from litescope import LiteScopeAnalyzer
analyzer_signals = [ analyzer_signals = [
self.audio.targ.re, self.audio.targ0.re,
self.audio.targ.storage, self.audio.targ0.storage,
# self.audio.backpressure_48, # self.audio.backpressure_48,
# self.audio.sample_48, # self.audio.sample_48,
# self.audio.audioready_48, # self.audio.audioready_48,

View file

@ -18,7 +18,26 @@ class TestSaw(Module, AutoCSR, ModuleDoc):
platform.add_source("rtl/dacDriver.sv") platform.add_source("rtl/dacDriver.sv")
self.pads = pads self.pads = pads
self.targ = CSRStorage(size = 24, description="Target Frequency of the Sawtooth Wave") self.targ0 = CSRStorage(size = 24, description = "Oscillator 0: Target Frequency of the Sawtooth Wave")
self.wave0 = CSRStorage(size = 8, description = "Oscillator 0: Waveform to Output")
self.targ1 = CSRStorage(size = 24, description = "Oscillator 1: Target Frequency of the Sawtooth Wave")
self.wave1 = CSRStorage(size = 8, description = "Oscillator 1: Waveform to Output")
self.targ2 = CSRStorage(size = 24, description = "Oscillator 2: Target Frequency of the Sawtooth Wave")
self.wave2 = CSRStorage(size = 8, description = "Oscillator 2: Waveform to Output")
self.targ3 = CSRStorage(size = 24, description = "Oscillator 3: Target Frequency of the Sawtooth Wave")
self.wave3 = CSRStorage(size = 8, description = "Oscillator 3: Waveform to Output")
self.targ4 = CSRStorage(size = 24, description = "Oscillator 4: Target Frequency of the Sawtooth Wave")
self.wave4 = CSRStorage(size = 8, description = "Oscillator 4: Waveform to Output")
self.targ5 = CSRStorage(size = 24, description = "Oscillator 5: Target Frequency of the Sawtooth Wave")
self.wave5 = CSRStorage(size = 8, description = "Oscillator 5: Waveform to Output")
self.targ6 = CSRStorage(size = 24, description = "Oscillator 6: Target Frequency of the Sawtooth Wave")
self.wave6 = CSRStorage(size = 8, description = "Oscillator 6: Waveform to Output")
self.targ7 = CSRStorage(size = 24, description = "Oscillator 7: Target Frequency of the Sawtooth Wave")
self.wave7 = CSRStorage(size = 8, description = "Oscillator 7: Waveform to Output")
self.targ8 = CSRStorage(size = 24, description = "Oscillator 8: Target Frequency of the Sawtooth Wave")
self.wave8 = CSRStorage(size = 8, description = "Oscillator 8: Waveform to Output")
self.targ9 = CSRStorage(size = 24, description = "Oscillator 9: Target Frequency of the Sawtooth Wave")
self.wave9 = CSRStorage(size = 8, description = "Oscillator 9: Waveform to Output")
# 48MHz Domain Signals # 48MHz Domain Signals
self.backpressure_48 = Signal() self.backpressure_48 = Signal()
@ -39,7 +58,7 @@ class TestSaw(Module, AutoCSR, ModuleDoc):
i_i_clk48 = ClockSignal(), i_i_clk48 = ClockSignal(),
i_i_rst48_n = ~ResetSignal(), i_i_rst48_n = ~ResetSignal(),
i_i_pause = self.backpressure_48, i_i_pause = self.backpressure_48,
i_i_targetf = self.targ.storage, i_i_targetf = self.targ0.storage,
o_o_sample = self.sample_48, o_o_sample = self.sample_48,
o_o_pulse = self.audioready_48, o_o_pulse = self.audioready_48,
) )