From e035224754ff5a0f6bd90b6c2f7821db42d53bdb Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 22 Jul 2018 10:02:38 +0100 Subject: [PATCH] add soc_template.bsv, remove unneeded files --- src/bsv/bsv_lib/gpio.bsv | 264 ------------------------ src/bsv/bsv_lib/mux.bsv | 97 --------- src/bsv/bsv_lib/soc_template.bsv | 331 +++++++++++++++++++++++++++++++ 3 files changed, 331 insertions(+), 361 deletions(-) delete mode 100644 src/bsv/bsv_lib/gpio.bsv delete mode 100644 src/bsv/bsv_lib/mux.bsv create mode 100644 src/bsv/bsv_lib/soc_template.bsv diff --git a/src/bsv/bsv_lib/gpio.bsv b/src/bsv/bsv_lib/gpio.bsv deleted file mode 100644 index 3ac83ba..0000000 --- a/src/bsv/bsv_lib/gpio.bsv +++ /dev/null @@ -1,264 +0,0 @@ -/* -Copyright (c) 2013, IIT Madras -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of IIT Madras nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -*/ -package gpio; - /*==== Package imports ==== */ - import TriState ::*; - import Vector ::*; - import BUtils::*; - import ConfigReg ::*; - /*============================ */ - /*===== Project Imports ===== */ - import Semi_FIFOF :: *; - import AXI4_Lite_Types :: *; - /*============================ */ - `include "instance_defines.bsv" - - interface GPIO_func#(numeric type ionum); - (*always_ready,always_enabled*) - method Action gpio_in (Vector#(ionum,Bit#(1)) inp); - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_out; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_out_en; - endinterface - interface GPIO_config#(numeric type ionum); - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_DRV0; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_DRV1; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_DRV2; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PD; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PPEN; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PRG_SLEW; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PUQ; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PWRUPZHL; - (*always_ready*) - method Vector#(ionum,Bit#(1)) gpio_PWRUP_PULL_EN; - endinterface - interface GPIO#(numeric type ionum); - interface GPIO_config#(ionum) pad_config; - interface GPIO_func#(ionum) func; - interface AXI4_Lite_Slave_IFC#(`ADDR,`DATA,`USERSPACE) axi_slave; - endinterface - - module mkgpio(GPIO#(ionum_)); - let ionum = valueOf(ionum_); - Vector#(ionum_,ConfigReg#(Bool)) direction_reg <-replicateM(mkConfigReg(False)); - Vector#(ionum_,ConfigReg#(Bit#(1))) dataout_register <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) datain_register <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) drv0_reg <-replicateM(mkConfigReg(1'b1)); - Vector#(ionum_,ConfigReg#(Bit#(1))) drv1_reg <-replicateM(mkConfigReg(1'b1)); - Vector#(ionum_,ConfigReg#(Bit#(1))) drv2_reg <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) pd_reg <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) ppen_reg <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) prg_slew_reg <-replicateM(mkConfigReg(1'b1)); - Vector#(ionum_,ConfigReg#(Bit#(1))) puq_reg <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) pwrupzhl_reg <-replicateM(mkConfigReg(0)); - Vector#(ionum_,ConfigReg#(Bit#(1))) pwrup_pull_en_reg <-replicateM(mkConfigReg(0)); - - AXI4_Lite_Slave_Xactor_IFC #(`ADDR, `DATA, `USERSPACE) s_xactor <- mkAXI4_Lite_Slave_Xactor; - rule rl_wr_respond; - // Get the wr request - let aw <- pop_o (s_xactor.o_wr_addr); - let w <- pop_o (s_xactor.o_wr_data); - let b = AXI4_Lite_Wr_Resp {bresp: AXI4_LITE_OKAY, buser: aw.awuser}; - if(aw.awaddr[5:0]=='h0) - for(Integer i=0;i=16) - for(Integer i=0;i=16)begin - for(Integer i=0;i