Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nanomixer/nanomixer
...
head fork: nanomixer/nanomixer
  • 7 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
2  dsp/assembler.py
@@ -98,7 +98,7 @@ def biquad(in_addr, buf_base, param_base, out_addr):
MulAcc(yn1, a1),
MulAcc(yn2, a2),
HiToW(yn),
- MulToW(yn, yn, gain),
+ #MulToW(yn, yn, gain),
# Write output
AToW(out_addr, yn)
]
View
11 dsp/biquads.py
@@ -1,7 +1,7 @@
import numpy as np
from numpy import sin, cos, sinh
-import matplotlib.pyplot as plt
-from scipy.signal import freqz
+#import matplotlib.pyplot as plt
+#from scipy.signal import freqz
# Based on http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
@@ -90,6 +90,9 @@ def biquad_to_param_mif(b, a, outfile):
print >>outfile, "ADDRESS_RADIX = HEX;"
print >>outfile, "DATA_RADIX = HEX;"
print >>outfile, "CONTENT BEGIN"
- for addr, data in enumerate(arr):
- print >>outfile, '{:02x} : {};'.format(addr, BitArray(int=to_fixedpt(data, 36), length=36).hex)
+ addr = 0
+ for channel in range(2):
+ for data in arr:
+ print >>outfile, '{:02x} : {};'.format(addr, BitArray(int=to_fixedpt(data, 36), length=36).hex)
+ addr += 1
print >>outfile, "END;"
View
206 fpga/instr.mif
@@ -16,111 +16,103 @@ CONTENT BEGIN
0a : 000010000000000000000001010100000011;
0b : 000010000000000000000001100100000100;
0c : 000110000000010000000000000000000000;
-0d : 000011000000010000000001000100000101;
-0e : 001000001000000000000001000000000000;
-0f : 000100000000000000000000000000000000;
-10 : 000101000000000000000000000000000000;
-11 : 001000000000100100000010000000000000;
-12 : 001000000000100000000001110000000000;
-13 : 001000000000110000000010110000000000;
-14 : 001000000000101100000010100000000000;
-15 : 001000000000011100100000010000000000;
-16 : 000010000000000000000001110100000110;
-17 : 000010000000000000000010000100000111;
-18 : 000010000000000000000010010100001000;
-19 : 000010000000000000000010110100001001;
-1a : 000010000000000000000011000100001010;
-1b : 000110000000101000000000000000000000;
-1c : 000011000000101000000010100100001011;
-1d : 001000001000000100000010100000000000;
-1e : 000100000000000000000000000000000000;
-1f : 000101000000000000000000000000000000;
-20 : 001000000000111100000011100000000000;
-21 : 001000000000111000000011010000000000;
-22 : 001000000001001000000100010000000000;
-23 : 001000000001000100000100000000000000;
-24 : 001000000000110100100000100000000000;
-25 : 000010000000000000000011010100001100;
-26 : 000010000000000000000011100100001101;
-27 : 000010000000000000000011110100001110;
-28 : 000010000000000000000100010100001111;
-29 : 000010000000000000000100100100010000;
-2a : 000110000001000000000000000000000000;
-2b : 000011000001000000000100000100010001;
-2c : 001000001000001000000100000000000000;
-2d : 000100000000000000000000000000000000;
-2e : 000101000000000000000000000000000000;
-2f : 001000000001010100000101000000000000;
-30 : 001000000001010000000100110000000000;
-31 : 001000000001100000000101110000000000;
-32 : 001000000001011100000101100000000000;
-33 : 001000000001001100100000110000000000;
-34 : 000010000000000000000100110100010010;
-35 : 000010000000000000000101000100010011;
-36 : 000010000000000000000101010100010100;
-37 : 000010000000000000000101110100010101;
-38 : 000010000000000000000110000100010110;
-39 : 000110000001011000000000000000000000;
-3a : 000011000001011000000101100100010111;
-3b : 001000001000001100000101100000000000;
-3c : 000100000000000000000000000000000000;
-3d : 000101000000000000000000000000000000;
-3e : 001000000001101100000110100000000000;
-3f : 001000000001101000000110010000000000;
-40 : 001000000001111000000111010000000000;
-41 : 001000000001110100000111000000000000;
-42 : 001000000001100100100001000000000000;
-43 : 000010000000000000000110010100011000;
-44 : 000010000000000000000110100100011001;
-45 : 000010000000000000000110110100011010;
-46 : 000010000000000000000111010100011011;
-47 : 000010000000000000000111100100011100;
-48 : 000110000001110000000000000000000000;
-49 : 000011000001110000000111000100011101;
-4a : 001000001000010000000111000000000000;
-4b : 000100000000000000000000000000000000;
-4c : 000101000000000000000000000000000000;
-4d : 001000000010000100001000000000000000;
-4e : 001000000010000000000111110000000000;
-4f : 001000000010010000001000110000000000;
-50 : 001000000010001100001000100000000000;
-51 : 001000000001111100100001010000000000;
-52 : 000010000000000000000111110100011110;
-53 : 000010000000000000001000000100011111;
-54 : 000010000000000000001000010100100000;
-55 : 000010000000000000001000110100100001;
-56 : 000010000000000000001001000100100010;
-57 : 000110000010001000000000000000000000;
-58 : 000011000010001000001000100100100011;
-59 : 001000001000010100001000100000000000;
-5a : 000100000000000000000000000000000000;
-5b : 000101000000000000000000000000000000;
-5c : 001000000010011100001001100000000000;
-5d : 001000000010011000001001010000000000;
-5e : 001000000010101000001010010000000000;
-5f : 001000000010100100001010000000000000;
-60 : 001000000010010100100001100000000000;
-61 : 000010000000000000001001010100100100;
-62 : 000010000000000000001001100100100101;
-63 : 000010000000000000001001110100100110;
-64 : 000010000000000000001010010100100111;
-65 : 000010000000000000001010100100101000;
-66 : 000110000010100000000000000000000000;
-67 : 000011000010100000001010000100101001;
-68 : 001000001000011000001010000000000000;
-69 : 000100000000000000000000000000000000;
-6a : 000101000000000000000000000000000000;
-6b : 001000000010110100001011000000000000;
-6c : 001000000010110000001010110000000000;
-6d : 001000000011000000001011110000000000;
-6e : 001000000010111100001011100000000000;
-6f : 001000000010101100100001110000000000;
-70 : 000010000000000000001010110100101010;
-71 : 000010000000000000001011000100101011;
-72 : 000010000000000000001011010100101100;
-73 : 000010000000000000001011110100101101;
-74 : 000010000000000000001100000100101110;
-75 : 000110000010111000000000000000000000;
-76 : 000011000010111000001011100100101111;
-77 : 001000001000011100001011100000000000;
+0d : 001000001000000000000001000000000000;
+0e : 000100000000000000000000000000000000;
+0f : 000101000000000000000000000000000000;
+10 : 001000000000100100000010000000000000;
+11 : 001000000000100000000001110000000000;
+12 : 001000000000110000000010110000000000;
+13 : 001000000000101100000010100000000000;
+14 : 001000000000011100100000010000000000;
+15 : 000010000000000000000001110100000110;
+16 : 000010000000000000000010000100000111;
+17 : 000010000000000000000010010100001000;
+18 : 000010000000000000000010110100001001;
+19 : 000010000000000000000011000100001010;
+1a : 000110000000101000000000000000000000;
+1b : 001000001000000100000010100000000000;
+1c : 000100000000000000000000000000000000;
+1d : 000101000000000000000000000000000000;
+1e : 001000000000111100000011100000000000;
+1f : 001000000000111000000011010000000000;
+20 : 001000000001001000000100010000000000;
+21 : 001000000001000100000100000000000000;
+22 : 001000000000110100100000100000000000;
+23 : 000010000000000000000011010100001100;
+24 : 000010000000000000000011100100001101;
+25 : 000010000000000000000011110100001110;
+26 : 000010000000000000000100010100001111;
+27 : 000010000000000000000100100100010000;
+28 : 000110000001000000000000000000000000;
+29 : 001000001000001000000100000000000000;
+2a : 000100000000000000000000000000000000;
+2b : 000101000000000000000000000000000000;
+2c : 001000000001010100000101000000000000;
+2d : 001000000001010000000100110000000000;
+2e : 001000000001100000000101110000000000;
+2f : 001000000001011100000101100000000000;
+30 : 001000000001001100100000110000000000;
+31 : 000010000000000000000100110100010010;
+32 : 000010000000000000000101000100010011;
+33 : 000010000000000000000101010100010100;
+34 : 000010000000000000000101110100010101;
+35 : 000010000000000000000110000100010110;
+36 : 000110000001011000000000000000000000;
+37 : 001000001000001100000101100000000000;
+38 : 000100000000000000000000000000000000;
+39 : 000101000000000000000000000000000000;
+3a : 001000000001101100000110100000000000;
+3b : 001000000001101000000110010000000000;
+3c : 001000000001111000000111010000000000;
+3d : 001000000001110100000111000000000000;
+3e : 001000000001100100100001000000000000;
+3f : 000010000000000000000110010100011000;
+40 : 000010000000000000000110100100011001;
+41 : 000010000000000000000110110100011010;
+42 : 000010000000000000000111010100011011;
+43 : 000010000000000000000111100100011100;
+44 : 000110000001110000000000000000000000;
+45 : 001000001000010000000111000000000000;
+46 : 000100000000000000000000000000000000;
+47 : 000101000000000000000000000000000000;
+48 : 001000000010000100001000000000000000;
+49 : 001000000010000000000111110000000000;
+4a : 001000000010010000001000110000000000;
+4b : 001000000010001100001000100000000000;
+4c : 001000000001111100100001010000000000;
+4d : 000010000000000000000111110100011110;
+4e : 000010000000000000001000000100011111;
+4f : 000010000000000000001000010100100000;
+50 : 000010000000000000001000110100100001;
+51 : 000010000000000000001001000100100010;
+52 : 000110000010001000000000000000000000;
+53 : 001000001000010100001000100000000000;
+54 : 000100000000000000000000000000000000;
+55 : 000101000000000000000000000000000000;
+56 : 001000000010011100001001100000000000;
+57 : 001000000010011000001001010000000000;
+58 : 001000000010101000001010010000000000;
+59 : 001000000010100100001010000000000000;
+5a : 001000000010010100100001100000000000;
+5b : 000010000000000000001001010100100100;
+5c : 000010000000000000001001100100100101;
+5d : 000010000000000000001001110100100110;
+5e : 000010000000000000001010010100100111;
+5f : 000010000000000000001010100100101000;
+60 : 000110000010100000000000000000000000;
+61 : 001000001000011000001010000000000000;
+62 : 000100000000000000000000000000000000;
+63 : 000101000000000000000000000000000000;
+64 : 001000000010110100001011000000000000;
+65 : 001000000010110000001010110000000000;
+66 : 001000000011000000001011110000000000;
+67 : 001000000010111100001011100000000000;
+68 : 001000000010101100100001110000000000;
+69 : 000010000000000000001010110100101010;
+6a : 000010000000000000001011000100101011;
+6b : 000010000000000000001011010100101100;
+6c : 000010000000000000001011110100101101;
+6d : 000010000000000000001100000100101110;
+6e : 000110000010111000000000000000000000;
+6f : 001000001000011100001011100000000000;
END;
View
6 fpga/mixer.sv
@@ -30,7 +30,7 @@ adat_in adat_in_0(
spdif_out spdif_out_0(
.clk(adat_bitclock),
- .ldatain(audio_in[0]), .rdatain(audio_in[1]),
+ .ldatain(audio_out[0]), .rdatain(audio_out[1]),
.serialout(spdif_out));
wire signed [35:0] dsp_in[8];
@@ -39,7 +39,7 @@ wire [7:0] clip;
genvar i;
generate
for (i=0; i<8; i++) begin:channel
- assign dsp_in[i] = (audio_in[i] << 6);
+ assign dsp_in[i] = {{6{audio_in[i][23]}}, audio_in[i][23:0], {6{1'b0}}};
saturate sat(.in(dsp_out[i]), .overflow(clip[i]), .out(audio_out[i]));
end
endgenerate
@@ -51,7 +51,7 @@ DSPCore dsp0(
.inputs(dsp_in),
.outputs(dsp_out));
-wire [23:0] meter_src = audio_out[0];
+wire [23:0] meter_src = audio_in[0];
wire [23:0] abs_val;
assign abs_val = meter_src[23] ? -meter_src : meter_src;
View
4 fpga/nanomixer.qsf
@@ -221,7 +221,6 @@ set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2_IN[2]
# GPIO_0, GPIO_0 connect to GPIO Default
#============================================================
set_location_assignment PIN_A8 -to GPIO_0_IN[0]
-set_location_assignment PIN_D3 -to GPIO_0[0]
set_location_assignment PIN_B8 -to GPIO_0_IN[1]
set_location_assignment PIN_C3 -to GPIO_0[1]
set_location_assignment PIN_A2 -to GPIO_0[2]
@@ -256,7 +255,6 @@ set_location_assignment PIN_A12 -to GPIO_0[30]
set_location_assignment PIN_D11 -to GPIO_0[31]
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_0_IN[0]
-set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_0[0]
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_0_IN[1]
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_0[1]
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_0[2]
@@ -429,4 +427,6 @@ set_global_assignment -name SYSTEMVERILOG_FILE posedgeFF.sv
set_global_assignment -name SYSTEMVERILOG_FILE saturate.sv
set_global_assignment -name SYSTEMVERILOG_FILE saturate_test.sv
set_global_assignment -name SYSTEMVERILOG_FILE spdif_out.sv
+set_location_assignment PIN_D3 -to GPIO_00
+set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_00
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
View
16 fpga/param.mif
@@ -3,10 +3,16 @@ WIDTH = 36;
ADDRESS_RADIX = HEX;
DATA_RADIX = HEX;
CONTENT BEGIN
-00 : 58290117a;
-01 : 99f26efd1;
-02 : 117e2c210;
-03 : 99f26efd1;
-04 : 29a72d38b;
+00 : 400000000;
+01 : 200000000;
+02 : 000000000;
+03 : 200000000;
+04 : 000000000;
05 : 400000000;
+06 : 400000000;
+07 : 200000000;
+08 : 000000000;
+09 : 200000000;
+0a : 000000000;
+0b : 400000000;
END;
View
54 fpga/reparam.tcl
@@ -0,0 +1,54 @@
+
+##############################################################################################
+############################# Basic vJTAG Interface ##########################################
+##############################################################################################
+
+#This portion of the script is derived from some of the examples from Altera
+
+global usbblaster_name
+global test_device
+# List all available programming hardwares, and select the USBBlaster.
+# (Note: this example assumes only one USBBlaster connected.)
+# Programming Hardwares:
+foreach hardware_name [get_hardware_names] {
+# puts $hardware_name
+ if { [string match "USB-Blaster*" $hardware_name] } {
+ set usbblaster_name $hardware_name
+ }
+}
+
+
+puts "\nSelect JTAG chain connected to $usbblaster_name.\n";
+
+# List all devices on the chain, and select the first device on the chain.
+#Devices on the JTAG chain:
+
+
+foreach device_name [get_device_names -hardware_name $usbblaster_name] {
+# puts $device_name
+ if { [string match "@1*" $device_name] } {
+ set test_device $device_name
+ }
+}
+puts "\nSelect device: $test_device.\n";
+
+
+# Open device
+proc openport {} {
+ global usbblaster_name
+ global test_device
+ open_device -hardware_name $usbblaster_name -device_name $test_device
+}
+
+foreach instance [get_editable_mem_instances -hardware_name $usbblaster_name -device_name $test_device] {
+ set name [lindex $instance 5];
+ if { [string match "parm" $name] } {
+ set instance_idx [lindex $instance 0];
+ }
+}
+puts "\nInstance $instance_idx";
+
+begin_memory_edit -hardware_name $usbblaster_name -device_name $test_device
+update_content_to_memory_from_file -instance_index $instance_idx -mem_file_path "param.mif" -mem_file_type mif
+end_memory_edit
+
View
7 fpga/uDSP.sv
@@ -119,6 +119,11 @@ module uDSP #(
logic[35:0] wbData_EX;
logic wren_EX;
+ // Saturator: we multiplied a Q5.30 by a Q1.34 coefficient,
+ // giving a Q7.64 multiplicand. We want a Q5.30 output.
+ wire[35:0] accAsWord;
+ saturate #(.IN_WIDTH(72), .HEADROOM(2), .OUT_WIDTH(36)) saturator(
+ .in({HI, LO}), .out(accAsWord));
always_comb begin
case (opcode_EX)
MulToW: begin
@@ -126,7 +131,7 @@ module uDSP #(
wren_EX = 1;
end
HiToW: begin
- wbData_EX = HI;
+ wbData_EX = accAsWord;
wren_EX = 1;
end
LoToW: begin

No commit comments for this range

Something went wrong with that request. Please try again.