Commits

Christopher Felton committed cf6bd67

set audio options

Comments (0)

Files changed (2)

mycores/aic23/aic23_top.py

     mic_in   = Signal(intbv(0)[32:]) # Mic audio stream
     hp_out   = Signal(intbv(0)[32:]) # Speaker audio stream
     Ts       = Signal(False)         # Sample rate pulse
+
+    # The external bus to the AIC23 CODEC
     aic23_bus = Namespace(bclk=AUDIO_BCLK, din=AUDIO_DIN, dout=AUDIO_DOUT,
                           lrcin=AUDIO_LRCIN, lrcout=AUDIO_LRCOUT, mode=AUDIO_MODE,
                           csn=AUDIO_CSN, sclk=AUDIO_SCLK, sdin=AUDIO_SDIN)
+    # Internal audio bus
     au_bus = Namespace(in_r=au_in_r, in_l=au_in_l, out_r=au_out_r, out_l=au_out_l,
                        mic_in=mic_in, hp_out=hp_out, Ts=Ts)    
+
     clk12MHz = Signal(False); 
     clk48MHz = Signal(False); 
     clk96MHz = Signal(False)
     one = Signal(True)
     zero = Signal(False)
 
+    # Xilinx DCM IP, generate clocks required.
     g_dcm = dcm12MHz(CLKIN_IN=clock_in, RST_IN=zero, CLKDV_OUT=clk12MHz,
                      CLKIN_IBUFG_OUT=_clock, CLK0_OUT=clk48MHz,
                      CLKFX_OUT=clk96MHz, LOCKED_OUT=dcm_locked)
         else:
             rbits.next = ((rbits << 1) | 1) & 0xFF
             reset.next = rbits[7]
+            
+    # The logic to interface to the AIC23 CODEC
+    if ConfigOpt is None:
+        ConfigOpt = Aic23Config()
+        ConfigOpt.sample_rate = 48   # 48kHz sample rate
+        ConfigOpt.iwl = 16           # 16bit samples
 
-    g_aic23 = aic23(clk96MHz, reset, au_bus, aic23_bus, tst_pts, ConfigOpt)
+    g_aic23 = aic23(clk96MHz, reset, au_bus, aic23_bus, 
+                    tst_pts, ConfigOpt)
 
 
     @always(clk96MHz.posedge)
         oclk.next = clk12MHz
         oclk_n.next = not clk12MHz
 
+    # Xilinx DDR IO to send 12MHz clock to AIC23 CODEC
     g_ddr = OFDDRCPE(Q=AUDIO_CLK, C0=oclk, C1=oclk_n, CE=one, 
                      CLR=zero, D0=one, D1=zero, PRE=zero)
 

mycores/aic23/aic23_top.v

 // File: aic23_top.v
 // Generated by MyHDL 0.8dev
-// Date: Tue Aug 28 05:27:28 2012
+// Date: Thu Sep  6 23:47:49 2012
 
 
 `timescale 1ns/10ps
 reg g_aic23_g_setup_SPI_sclk;
 
 
-//assign _clock = 0;
+assign zero = 0;
 assign g_aic23_pgm = 0;
 
 
         end
         g_aic23_g_setup__pgm <= g_aic23_pgm;
     end
- end
-    
-    
+end
+
+
 always @(posedge clk96MHz, negedge reset) begin: AIC23_TOP_G_AIC23_G_SETUP_HDL_SM
     if (reset == 0) begin
         g_aic23_g_setup_aic_c_go <= 0;
         g_aic23_g_setup_state <= 3'b000;
         g_aic23_g_setup_reg_cnt <= 0;
     end
-    else
+    else begin
         case (g_aic23_g_setup_state)
             3'b000: begin
                 if (g_aic23_g_setup_pgm_trans) begin
             end
         endcase
     end
-    
-    
+end
+
+
 always @(posedge clk96MHz) begin: AIC23_TOP_G_AIC23_G_SETUP_SPI_RTL_SYNC_OUTS
     if ((reset == 1'b0)) begin
         g_aic23_g_setup_SPI_csn <= 1'b1;
     if (reset == 0) begin
         cnt <= 0;
     end
-    else
+    else begin
         cnt <= (cnt + 1);
     end
-    
-    
+end
+
+
 always @(posedge clk48MHz, negedge reset) begin: AIC23_TOP_HDL_LEDS
     if (reset == 0) begin
         LEDS <= 0;
     end
-    else
+    else begin
         LEDS <= cnt[32-1:25];
     end
-    
-    
+end
+
+
 always @(posedge _clock, negedge reset_in) begin: AIC23_TOP_HDL_RESET
     if ((reset_in == 0)) begin
         rbits <= 0;
 end
 
 
-assign one = 1'b1;
-assign zero = 1'b0;
+
 assign oclk = clk12MHz;
 assign oclk_n = (!clk12MHz);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.