commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6004 - gnuradio/branches/developers/matt/u2f/models


From: matt
Subject: [Commit-gnuradio] r6004 - gnuradio/branches/developers/matt/u2f/models
Date: Tue, 17 Jul 2007 16:52:44 -0600 (MDT)

Author: matt
Date: 2007-07-17 16:52:44 -0600 (Tue, 17 Jul 2007)
New Revision: 6004

Added:
   gnuradio/branches/developers/matt/u2f/models/adc_model.v
Log:
basic adc model


Added: gnuradio/branches/developers/matt/u2f/models/adc_model.v
===================================================================
--- gnuradio/branches/developers/matt/u2f/models/adc_model.v                    
        (rev 0)
+++ gnuradio/branches/developers/matt/u2f/models/adc_model.v    2007-07-17 
22:52:44 UTC (rev 6004)
@@ -0,0 +1,48 @@
+
+module adc_model
+  (input clk, input rst,
+   output [13:0] adc_a,
+   output adc_ovf_a,
+   input adc_oen_a,
+   input adc_pdn_a,
+   output [13:0] adc_b,
+   output adc_ovf_b,
+   input adc_oen_b,
+   input adc_pdn_b);
+
+   reg [13:0] adc_a_int = -7532;
+   reg [13:0] adc_b_int = 1237;
+   reg               a_up = 1;
+   reg               b_up = 0;
+   
+   assign     adc_a = (adc_oen_a & ~adc_pdn_a) ? adc_a_int : 14'bz;
+   assign     adc_ovf_a = (adc_oen_a & ~adc_pdn_a) ? 1'b0 : 1'bz;
+   assign     adc_b = (adc_oen_b & ~adc_pdn_b) ? adc_b_int : 14'bz;
+   assign     adc_ovf_b = (adc_oen_b & ~adc_pdn_b) ? 1'b0 : 1'bz;
+   
+   always @(posedge clk)
+     if(a_up)
+       if(adc_a_int == 14'd8100)
+        a_up <= 0;
+       else
+        adc_a_int <= adc_a_int + 1;
+     else
+       if(adc_a_int == -14'd8100)
+        a_up <= 1;
+       else
+        adc_a_int <= adc_a_int - 1;
+   
+   always @(posedge clk)
+     if(b_up)
+       if(adc_b_int == 14'd8100)
+        b_up <= 0;
+       else
+        adc_b_int <= adc_b_int + 1;
+     else
+       if(adc_b_int == -14'd8100)
+        b_up <= 1;
+       else
+        adc_b_int <= adc_b_int - 1;
+   
+       
+endmodule // adc_model





reply via email to

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