commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r6521 - gnuradio/branches/developers/matt/u2f/control_


From: matt
Subject: [Commit-gnuradio] r6521 - gnuradio/branches/developers/matt/u2f/control_lib
Date: Mon, 24 Sep 2007 17:23:39 -0600 (MDT)

Author: matt
Date: 2007-09-24 17:23:39 -0600 (Mon, 24 Sep 2007)
New Revision: 6521

Added:
   gnuradio/branches/developers/matt/u2f/control_lib/timer.v
Log:
new module to interrupt the processor at a defined time


Added: gnuradio/branches/developers/matt/u2f/control_lib/timer.v
===================================================================
--- gnuradio/branches/developers/matt/u2f/control_lib/timer.v                   
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/control_lib/timer.v   2007-09-24 
23:23:39 UTC (rev 6521)
@@ -0,0 +1,49 @@
+
+
+module timer
+  (input wb_clk_i, input rst_i,
+   input cyc_i, input stb_i, input [2:0] adr_i,
+   input we_i, input [31:0] dat_i, output [31:0] dat_o, output ack_o,
+   input sys_clk_i, output [31:0] master_time_o,
+   output int_o );
+   
+
+   reg [31:0] master_time;
+   always @(posedge sys_clk_i)
+     if(rst_i)
+       master_time <= 0;
+     else
+       master_time <= master_time + 1;
+   assign     master_time_o = master_time;
+
+   reg [31:0] time_wb;
+   always @(posedge wb_clk_i)
+     time_wb <= master_time;
+
+   assign     ack_o = stb_i;
+
+   reg [31:0] int_time;
+   reg               int_reg;
+   
+   always @(posedge sys_clk_i)
+     if(rst_i)
+       begin
+         int_time <= 0;
+         int_reg <= 0;
+       end
+     else if(|int_time && (time_wb >= int_time))
+       begin
+         int_time <= 0;
+         int_reg <= 1;
+       end
+     else if(stb_i & we_i)
+       begin
+         int_time <= dat_i;
+         int_reg <= 0;
+       end
+
+   assign dat_o = time_wb;
+   assign int_o = int_reg;
+   
+endmodule // timer
+





reply via email to

[Prev in Thread] Current Thread [Next in Thread]