Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unified signal crossing sync by single module implementation and prop…
…er instatiation in top module
  • Loading branch information
kristianpaul committed Jul 21, 2011
1 parent 89687e1 commit 6dd7b0e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 39 deletions.
55 changes: 16 additions & 39 deletions cores/namuru/rtl/namuru.v
Expand Up @@ -51,48 +51,25 @@ namuru_psync system_rst(
);

/* stb */
reg stb_i0;
reg stb_i1;
reg stb_i2;
reg stb_i3;

always @(posedge gps_rec_clk) begin
stb_i0 <= wb_stb_i;
stb_i1 <= stb_i0;
stb_i2 <= stb_i1;
stb_i3 <= stb_i2;
end
namuru_ssync wb_stb_in(
.clks(gps_rec_clk),
.i(wb_stb_i),
.o(wb_stb_i_sync)
);

assign wb_stb_i_sync = stb_i3;
/* cyc */
reg cyc_i0;
reg cyc_i1;
reg cyc_i2;
reg cyc_i3;

always @(posedge gps_rec_clk) begin
cyc_i0 <= wb_cyc_i;
cyc_i1 <= cyc_i0;
cyc_i2 <= cyc_i1;
cyc_i3 <= cyc_i2;
end

assign wb_cyc_i_sync = cyc_i3;
namuru_ssync wb_cyc_in(
.clks(gps_rec_clk),
.i(wb_cyc_i),
.o(wb_cyc_i_sync)
);

/* we */
reg we_i0;
reg we_i1;
reg we_i2;
reg we_i3;

always @(posedge gps_rec_clk) begin
we_i0 <= wb_we_i;
we_i1 <= we_i0;
we_i2 <= we_i1;
we_i3 <= we_i2;
end

assign wb_we_i_sync = we_i3;
namuru_ssync wb_we_in(
.clks(gps_rec_clk),
.i(wb_we_i),
.o(wb_we_i_sync)
);

gps_channel_correlator gps_correlator (
.correlator_clk(gps_rec_clk),
Expand All @@ -112,7 +89,7 @@ gps_channel_correlator gps_correlator (

/*CDC Sync from Slave to Master */
/* ack */
namuru_psync system_ack(
namuru_psync wb_ack_out(
.clk1(gps_rec_clk),
.i(wb_ack_o_sync),
.clk2(sys_clk),
Expand Down
45 changes: 45 additions & 0 deletions cores/namuru/rtl/namuru_ssync.v
@@ -0,0 +1,45 @@
/*
* Milkymist SoC GPS-SDR
* Copyleft 2011 Cristian Paul Peñaranda Rojas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

module namuru_ssync(
input i,
input clks,
input o
);

reg level1;
reg level2;
reg level3;
reg level4;
always @(posedge clkss) begin
level1 <= i;
level2 <= level1;
level3 <= level2;
level4 <= level3;
end

//assign o = level3 & level4;
assign o = level4;

initial begin
level1 <= 1'b0;
level2 <= 1'b0;
level3 <= 1'b0;
level4 <= 1'b0;
end

endmodule

0 comments on commit 6dd7b0e

Please sign in to comment.