From afcf1093be9535f1734d0dcbb56f876f18e43587 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Thu, 18 May 2023 11:38:39 +0100 Subject: [PATCH] Update note.cpp and main.cpp for new CSRStorage layout --- demo/main.cpp | 2 +- demo/note.cpp | 4 ++-- make.py | 4 ++-- testSaw.py | 23 +++++++++++++++++++++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/demo/main.cpp b/demo/main.cpp index 0fba852..9529e28 100644 --- a/demo/main.cpp +++ b/demo/main.cpp @@ -124,7 +124,7 @@ static void leds_cmd(char **val) { static void saw_cmd(char **val) { int value = (int)strtol(get_token(val), NULL, 0); printf("Setting Sawtooth to %dHz\n", value); - audio_targ_write(value); + audio_targ0_write(value); } static void imperial_cmd() { diff --git a/demo/note.cpp b/demo/note.cpp index fa6ce44..21421b7 100644 --- a/demo/note.cpp +++ b/demo/note.cpp @@ -2,7 +2,7 @@ #include void note(uint32_t frequency, unsigned int duration_ms) { - audio_targ_write(frequency); + audio_targ0_write(frequency); busy_wait(duration_ms); - audio_targ_write(0); + audio_targ0_write(0); } diff --git a/make.py b/make.py index 730129e..62c1355 100755 --- a/make.py +++ b/make.py @@ -241,8 +241,8 @@ class BaseSoC(SoCCore): self.add_uartbone(name="debug_uart", baudrate=921600) from litescope import LiteScopeAnalyzer analyzer_signals = [ - self.audio.targ.re, - self.audio.targ.storage, + self.audio.targ0.re, + self.audio.targ0.storage, # self.audio.backpressure_48, # self.audio.sample_48, # self.audio.audioready_48, diff --git a/testSaw.py b/testSaw.py index 7cfe1e1..2ce68df 100644 --- a/testSaw.py +++ b/testSaw.py @@ -18,7 +18,26 @@ class TestSaw(Module, AutoCSR, ModuleDoc): platform.add_source("rtl/dacDriver.sv") 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 self.backpressure_48 = Signal() @@ -39,7 +58,7 @@ class TestSaw(Module, AutoCSR, ModuleDoc): i_i_clk48 = ClockSignal(), i_i_rst48_n = ~ResetSignal(), 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_pulse = self.audioready_48, )