OpenCores
URL https://opencores.org/ocsvn/openarty/openarty/trunk

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [fastio.v] - Diff between revs 36 and 49

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 36 Rev 49
Line 2... Line 2...
//
//
// Filename:    fastio.v
// Filename:    fastio.v
//
//
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
//
//
// Purpose:     
// Purpose:     This file is used to group all of the simple I/O registers
 
//              together.  These are the I/O registers whose values can be
 
//      read without requesting it of any submodules, and that are guaranteed
 
//      not to stall the bus.  In general, these are items that can be read
 
//      or written in one clock (two, if an extra delay is needed to match
 
//      timing requirements).
//
//
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Line 157... Line 162...
        // read only counter if you will.
        // read only counter if you will.
        reg     [31:0]   pwr_counter;
        reg     [31:0]   pwr_counter;
        initial pwr_counter = 32'h00;
        initial pwr_counter = 32'h00;
        always @(posedge i_clk)
        always @(posedge i_clk)
                if (pwr_counter[31])
                if (pwr_counter[31])
                        pwr_counter[30:0] <= pwr_counter[30:0] + 31'h001;
                        pwr_counter[30:0] <= pwr_counter[30:0] + 1'b1;
                else
                else
                        pwr_counter[31:0] <= pwr_counter[31:0] + 31'h001;
                        pwr_counter[31:0] <= pwr_counter[31:0] + 1'b1;
 
 
 
        //
 
        // These pwr_counter bits are used for generating a PWM modulated
 
        // color LED output--allowing us to create multiple different, varied,
 
        // color LED "colors".  Here, we reverse the bits, to make their
 
        // transitions and PWM that much *less* noticable.  (a 50%
 
        // value, thus, is now an on-off-on-off-etc sequence, vice a 
 
        // sequence of 256 ons followed by a sequence of 256 offs --- it
 
        // places the transitions into a higher frequency bracket, and costs
 
        // us no logic to do--only a touch more pain to understand on behalf
 
        // of the programmer.)
 
        wire    [8:0]    rev_pwr_counter;
 
        assign rev_pwr_counter[8:0] = { pwr_counter[0],
 
                        pwr_counter[1], pwr_counter[2],
 
                        pwr_counter[3], pwr_counter[4],
 
                        pwr_counter[5], pwr_counter[6],
 
                        pwr_counter[7], pwr_counter[8] };
 
 
        //
        //
        // BTNSW
        // BTNSW
        //
        //
        // The button and switch control register
        // The button and switch control register
Line 267... Line 289...
        assign  w_clr_led0 = { 5'h0,
        assign  w_clr_led0 = { 5'h0,
                        r_clr_led0_r[8], r_clr_led0_g[8], r_clr_led0_b[8],
                        r_clr_led0_r[8], r_clr_led0_g[8], r_clr_led0_b[8],
                        r_clr_led0_r[7:0], r_clr_led0_g[7:0], r_clr_led0_b[7:0]
                        r_clr_led0_r[7:0], r_clr_led0_g[7:0], r_clr_led0_b[7:0]
                };
                };
        always @(posedge i_clk)
        always @(posedge i_clk)
                o_clr_led0 <= { (pwr_counter[8:0] < r_clr_led0_r),
                o_clr_led0 <= { (rev_pwr_counter[8:0] < r_clr_led0_r),
                                (pwr_counter[8:0] < r_clr_led0_g),
                                (rev_pwr_counter[8:0] < r_clr_led0_g),
                                (pwr_counter[8:0] < r_clr_led0_b) };
                                (rev_pwr_counter[8:0] < r_clr_led0_b) };
 
 
        // CLR LED 1
        // CLR LED 1
        wire    [31:0]   w_clr_led1;
        wire    [31:0]   w_clr_led1;
        reg     [8:0]    r_clr_led1_r, r_clr_led1_g, r_clr_led1_b;
        reg     [8:0]    r_clr_led1_r, r_clr_led1_g, r_clr_led1_b;
        initial r_clr_led1_r = 9'h007;
        initial r_clr_led1_r = 9'h007;
Line 289... Line 311...
        assign  w_clr_led1 = { 5'h0,
        assign  w_clr_led1 = { 5'h0,
                        r_clr_led1_r[8], r_clr_led1_g[8], r_clr_led1_b[8],
                        r_clr_led1_r[8], r_clr_led1_g[8], r_clr_led1_b[8],
                        r_clr_led1_r[7:0], r_clr_led1_g[7:0], r_clr_led1_b[7:0]
                        r_clr_led1_r[7:0], r_clr_led1_g[7:0], r_clr_led1_b[7:0]
                };
                };
        always @(posedge i_clk)
        always @(posedge i_clk)
                o_clr_led1 <= { (pwr_counter[8:0] < r_clr_led1_r),
                o_clr_led1 <= { (rev_pwr_counter[8:0] < r_clr_led1_r),
                                (pwr_counter[8:0] < r_clr_led1_g),
                                (rev_pwr_counter[8:0] < r_clr_led1_g),
                                (pwr_counter[8:0] < r_clr_led1_b) };
                                (rev_pwr_counter[8:0] < r_clr_led1_b) };
        // CLR LED 0
        // CLR LED 0
        wire    [31:0]   w_clr_led2;
        wire    [31:0]   w_clr_led2;
        reg     [8:0]    r_clr_led2_r, r_clr_led2_g, r_clr_led2_b;
        reg     [8:0]    r_clr_led2_r, r_clr_led2_g, r_clr_led2_b;
        initial r_clr_led2_r = 9'h00f;
        initial r_clr_led2_r = 9'h00f;
        initial r_clr_led2_g = 9'h000;
        initial r_clr_led2_g = 9'h000;
Line 310... Line 332...
        assign  w_clr_led2 = { 5'h0,
        assign  w_clr_led2 = { 5'h0,
                        r_clr_led2_r[8], r_clr_led2_g[8], r_clr_led2_b[8],
                        r_clr_led2_r[8], r_clr_led2_g[8], r_clr_led2_b[8],
                        r_clr_led2_r[7:0], r_clr_led2_g[7:0], r_clr_led2_b[7:0]
                        r_clr_led2_r[7:0], r_clr_led2_g[7:0], r_clr_led2_b[7:0]
                };
                };
        always @(posedge i_clk)
        always @(posedge i_clk)
                o_clr_led2 <= { (pwr_counter[8:0] < r_clr_led2_r),
                o_clr_led2 <= { (rev_pwr_counter[8:0] < r_clr_led2_r),
                                (pwr_counter[8:0] < r_clr_led2_g),
                                (rev_pwr_counter[8:0] < r_clr_led2_g),
                                (pwr_counter[8:0] < r_clr_led2_b) };
                                (rev_pwr_counter[8:0] < r_clr_led2_b) };
        // CLR LED 3
        // CLR LED 3
        wire    [31:0]   w_clr_led3;
        wire    [31:0]   w_clr_led3;
        reg     [8:0]    r_clr_led3_r, r_clr_led3_g, r_clr_led3_b;
        reg     [8:0]    r_clr_led3_r, r_clr_led3_g, r_clr_led3_b;
        initial r_clr_led3_r = 9'h01f; // LED is on far left
        initial r_clr_led3_r = 9'h01f; // LED is on far left
        initial r_clr_led3_g = 9'h000;
        initial r_clr_led3_g = 9'h000;
Line 331... Line 353...
        assign  w_clr_led3 = { 5'h0,
        assign  w_clr_led3 = { 5'h0,
                        r_clr_led3_r[8], r_clr_led3_g[8], r_clr_led3_b[8],
                        r_clr_led3_r[8], r_clr_led3_g[8], r_clr_led3_b[8],
                        r_clr_led3_r[7:0], r_clr_led3_g[7:0], r_clr_led3_b[7:0]
                        r_clr_led3_r[7:0], r_clr_led3_g[7:0], r_clr_led3_b[7:0]
                };
                };
        always @(posedge i_clk)
        always @(posedge i_clk)
                o_clr_led3 <= { (pwr_counter[8:0] < r_clr_led3_r),
                o_clr_led3 <= { (rev_pwr_counter[8:0] < r_clr_led3_r),
                                (pwr_counter[8:0] < r_clr_led3_g),
                                (rev_pwr_counter[8:0] < r_clr_led3_g),
                                (pwr_counter[8:0] < r_clr_led3_b) };
                                (rev_pwr_counter[8:0] < r_clr_led3_b) };
 
 
        //
        //
        // The Calendar DATE
        // The Calendar DATE
        //
        //
        wire    [31:0]   date_data;
        wire    [31:0]   date_data;
Line 461... Line 483...
        assign  gpstx_data = { 20'h00,
        assign  gpstx_data = { 20'h00,
                gpsck_uart, o_gps_tx, r_gpstx_break, gpstx_busy,
                gpsck_uart, o_gps_tx, r_gpstx_break, gpstx_busy,
                r_gpstx_data };
                r_gpstx_data };
        assign  gpstx_int = !gpstx_busy;
        assign  gpstx_int = !gpstx_busy;
 
 
 
        reg     [32:0]   sec_step;
 
        initial sec_step = 33'h1;
 
        always @(posedge i_clk)
 
                if ((w_wb_stb)&&(w_wb_addr == 5'h12))
 
                        sec_step <= { 1'b1, w_wb_data };
 
                else if (!pps_int)
 
                        sec_step <= 33'h1;
 
 
 
        reg     [31:0]   time_now_secs;
 
        initial time_now_secs = 32'h00;
 
        always @(posedge i_clk)
 
                if (pps_int)
 
                        time_now_secs <= time_now_secs + sec_step[31:0];
 
                else if (sec_step[32])
 
                        time_now_secs <= time_now_secs + sec_step[31:0];
 
 
        always @(posedge i_clk)
        always @(posedge i_clk)
                case(i_wb_addr)
                case(i_wb_addr)
                5'h00: o_wb_data <= `DATESTAMP;
                5'h00: o_wb_data <= `DATESTAMP;
                5'h01: o_wb_data <= pic_data;
                5'h01: o_wb_data <= pic_data;
                5'h02: o_wb_data <= i_buserr;
                5'h02: o_wb_data <= i_buserr;
Line 481... Line 519...
                5'h0d: o_wb_data <= gpio_data;
                5'h0d: o_wb_data <= gpio_data;
                5'h0e: o_wb_data <= auxrx_data;
                5'h0e: o_wb_data <= auxrx_data;
                5'h0f: o_wb_data <= auxtx_data;
                5'h0f: o_wb_data <= auxtx_data;
                5'h10: o_wb_data <= gpsrx_data;
                5'h10: o_wb_data <= gpsrx_data;
                5'h11: o_wb_data <= gpstx_data;
                5'h11: o_wb_data <= gpstx_data;
                // 5'h12: o_wb_data <= i_gps_secs;
                5'h12: o_wb_data <= time_now_secs;
                5'h13: o_wb_data <= i_gps_sub;
                5'h13: o_wb_data <= i_gps_sub;
                5'h14: o_wb_data <= i_gps_step;
                5'h14: o_wb_data <= i_gps_step;
                // 5'hf: UART_SETUP
 
                // 4'h6: GPIO
 
                // ?? : GPS-UARTRX
 
                // ?? : GPS-UARTTX
 
                default: o_wb_data <= 32'h00;
                default: o_wb_data <= 32'h00;
                endcase
                endcase
 
 
        assign  o_wb_stall = 1'b0;
        assign  o_wb_stall = 1'b0;
        always @(posedge i_clk)
        always @(posedge i_clk)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.