Permalink
Browse files

namuru gnsssdr initial import

  • Loading branch information...
1 parent e2d56b8 commit 13ca0cdd2c7a383e71ab2d72f006de3cdf0ba853 @kristianpaul committed Mar 20, 2012
View
@@ -10,6 +10,7 @@
*.swn
*.swo
*log*
+*.svn
boards/milkymist-one/synthesis/build
boards/milkymist-one/synthesis/build-rescue
boards/milkymist-one/standby/build
@@ -1,6 +1,6 @@
MMDIR?=../../..
-TARGETS=standby.fpg soc-rescue.fpg bios-rescue.bin splash-rescue.raw soc.fpg bios.bin splash.raw
+TARGETS=standby.fpg soc-rescue.fpg bios-rescue.bin splash-rescue.raw soc.fpg gps.bin bios.bin splash.raw
SERIAL?=/dev/ttyUSB0
all: $(TARGETS)
@@ -24,6 +24,7 @@ bios-rescue.bin:
$(MAKE) -C $(MMDIR)/software/libhal
$(MAKE) -C $(MMDIR)/software/libnet
$(MAKE) -C $(MMDIR)/software/bios
+ $(MAKE) -C $(MMDIR)/software/gps
cp $(MMDIR)/software/bios/bios-rescue.bin .
splash-rescue.raw: splash-rescue.png
@@ -43,6 +44,15 @@ bios.bin:
$(MAKE) -C $(MMDIR)/software/libnet
$(MAKE) -C $(MMDIR)/software/bios
cp $(MMDIR)/software/bios/bios.bin .
+
+gps.bin:
+ $(MAKE) -C $(MMDIR)/tools
+ $(MAKE) -C $(MMDIR)/software/libhpdmc
+ $(MAKE) -C $(MMDIR)/software/libbase
+ $(MAKE) -C $(MMDIR)/software/libhal
+ $(MAKE) -C $(MMDIR)/software/libnet
+ $(MAKE) -C $(MMDIR)/software/gps
+ cp $(MMDIR)/software/gps/gps.bin .
splash.raw: splash.png
$(MAKE) -C $(MMDIR)/tools
@@ -33,6 +33,7 @@
//`define ENABLE_MIDI
//`define ENABLE_DMX
//`define ENABLE_IR
+`define ENABLE_CORRELATOR
`ifndef ENABLE_TMU
`define ENABLE_MEMTEST
@@ -141,7 +141,6 @@ module system(
input gps_rec_clk,
input gps_rec_sign,
input gps_rec_mag,
- //output gps_led,
// PCB revision
input [3:0] pcb_revision
@@ -379,7 +378,7 @@ wire norflash_ack,
conbus5x6 #(
.s0_addr(3'b000), // norflash
.s1_addr(3'b001), // debug
- .s2_addr(3'b010), // L1 GPS Correlator
+ .s2_addr(3'b010), // Namuru Correlator
.s3_addr(3'b011), // Ethernet
.s4_addr(2'b10), // SDRAM
.s5_addr(2'b11) // CSR
@@ -757,7 +756,7 @@ wire namuru_irq;
wire [31:0] cpu_interrupt;
assign cpu_interrupt = {16'd0,
- namuru_irq,
+ ~namuru_irq,
ir_irq,
midi_irq,
videoin_irq,
@@ -950,7 +949,7 @@ sysctl #(
.csr_do(csr_dr_sysctl),
.gpio_inputs({pcb_revision, btn3, btn2, btn1}),
- .gpio_outputs({led1}),
+ .gpio_outputs({led1,led2}),
.debug_write_lock(debug_write_lock),
.bus_errors_en(bus_errors_en),
@@ -1615,24 +1614,21 @@ FD workaround(
//---------------------------------------------------------------------------
// namuru GPS Correlator
//---------------------------------------------------------------------------
-namuru baseband (
- .sys_clk(sys_clk),
- .sys_rst(sys_rst),
-
- .wb_adr_i(namuru_adr),
- .wb_dat_o(namuru_dat_r),
- .wb_dat_i(namuru_dat_w),
- .wb_sel_i(namuru_sel),
- .wb_stb_i(namuru_stb),
- .wb_cyc_i(namuru_cyc),
- .wb_ack_o(namuru_ack),
- .wb_we_i(namuru_we),
-
-//// .gps_rec_clk(gps_rec_clk),
- .gps_rec_sign(gps_rec_sign),
- .gps_rec_mag(gps_rec_mag),
-
- .gps_led(led2)
+//
+simplified_gps_baseband corr(
+ .clk(sys_clk),
+ .hw_rstn(~sys_rst),
+ .sign(gps_rec_sign),
+ .mag(gps_rec_mag),
+ .wb_adr_i(namuru_adr),
+ .wb_dat_o(namuru_dat_r),
+ .wb_dat_i(namuru_dat_w),
+ .wb_sel_i(namuru_sel),
+ .wb_stb_i(namuru_stb),
+ .wb_cyc_i(namuru_cyc),
+ .wb_ack_o(namuru_ack),
+ .wb_we_i(namuru_we),
+ .accum_int(namuru_irq)
);
endmodule
@@ -0,0 +1,81 @@
+// -*- Mode: Verilog -*-
+// Filename : accumulator.v
+// Description : accumulate and dump process
+
+// Author : Peter Mumford, UNSW, 2005
+/*
+ carrier_mix_sign provides the sign.
+ 0 for negative, 1 for positive.
+ The three magnitude bits represent the values 1,2,3,6.
+
+ The code is 0 or 1 representing -1 or 1 respectively.
+
+ The multiplication of the carrier_mix and the code
+ is simply the carrier_mix_mag with the sign determined
+ from the multiplication of the carrier_mix sign and the code.
+
+ code 0 0 1 1
+ carrier_mix_sign 0 1 0 1
+ -------
+ result 1 0 0 1 (0 for -ve, 1 for +ve)
+
+ if (code == carrier_mix_sign) result = 1
+ else result = 0
+ */
+/*
+ Copyright (C) 2007 Peter Mumford
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+module accumulator (clk, rstn, sample_enable, code, carrier_mix_sign, carrier_mix_mag, dump_enable, accumulation);
+
+ input clk, rstn, sample_enable, dump_enable;
+ input carrier_mix_sign;
+ input [2:0] carrier_mix_mag;
+ input code;
+
+ //output [31:0] accumulation;
+ output [15:0] accumulation;
+
+ integer accum_i;
+ //reg [31:0] accumulation;
+ reg [15:0] accumulation;
+
+ always @ (posedge clk)
+ begin
+ if (!rstn)
+ begin
+ accumulation <= 0;
+ accum_i <= 0;
+ end
+ else if (dump_enable)
+ begin
+ //accumulation = accum_i; // buffer the accumultion... //xilinx ISE error!
+ accumulation <= accum_i; // buffer the accumultion...
+ //accum_i = 0; // then reset the accumulation
+ accum_i <= 0; // then reset the accumulation //xilinx ISE error!
+ end
+ else if (sample_enable) // 20 MHz rate
+ begin
+ if (code == carrier_mix_sign)
+ accum_i <= accum_i + carrier_mix_mag;
+ else
+ accum_i <= accum_i - carrier_mix_mag;
+ end
+ end // always @ (posedge clk)
+endmodule // accumulator
+
+
@@ -0,0 +1,65 @@
+// -*- Mode: Verilog -*-
+// Filename : carrier_mixer.v
+// Description : Mix together the incomming signal with the local carrier.
+
+// Author : Peter Mumford, UNSW, 2005
+
+
+/*
+ The IF raw data and carrier are two bit quantities.
+ Each has a sign bit and a mag bit.
+ The IF_mag bit represents the values 1 and 3.
+ The carrier_mag bit represents the values 1 and 2.
+
+ The mix_mag is three bits representing the values 1,2,3,6
+ The mix_sign bit is 0 for negative, 1 for positive.
+
+ truth table
+
+ if_mag | 0 0 1 1 |
+ carrier_mag | 0 1 0 1 |
+ output bit:
+ 0 | 1 0 1 0 | = not carrier_mag
+
+ 1 | 0 1 1 1 | = if_mag or carrier_mag
+ 2 | 0 0 0 1 | = if_mag and carrier_mag
+ -------------|---------|
+ value | 1 2 3 6 |
+
+ if_sign | 0 0 1 1 | (0 = -ve, 1 = +ve)
+ carrier sign | 0 1 0 1 |
+ output sign:
+ | 1 0 0 1 | = not( if_sign xor carrier_sign )
+*/
+/*
+ Copyright (C) 2007 Peter Mumford
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+module carrier_mixer (if_sign, if_mag, carrier_sign, carrier_mag, mix_sign, mix_mag);
+
+input if_sign, if_mag, carrier_sign, carrier_mag;
+output mix_sign;
+output [2:0] mix_mag;
+
+assign mix_mag[0] = !carrier_mag;
+assign mix_mag[1] = if_mag | carrier_mag;
+assign mix_mag[2] = if_mag & carrier_mag;
+assign mix_sign = !(if_sign ^ carrier_sign);
+
+endmodule
+
+
Oops, something went wrong.

0 comments on commit 13ca0cd

Please sign in to comment.