From 46e79a0d349dabd8ed79dd9930b86e0ca20f2623 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Sun, 29 Oct 2023 13:57:06 +0300 Subject: [PATCH] Added Wishbone interface --- interfaces/axi4_if.sv | 4 +-- interfaces/axis_if.sv | 22 +++++++------- interfaces/wb_if.sv | 69 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 interfaces/wb_if.sv diff --git a/interfaces/axi4_if.sv b/interfaces/axi4_if.sv index f4a9252..27aa25d 100644 --- a/interfaces/axi4_if.sv +++ b/interfaces/axi4_if.sv @@ -77,7 +77,7 @@ interface axi4_if #( parameter logic wvalid; - modport master( + modport master_mp( input arready, input awready, @@ -128,7 +128,7 @@ interface axi4_if #( parameter ); - modport slave( + modport slave_mp( input araddr, input arburst, diff --git a/interfaces/axis_if.sv b/interfaces/axis_if.sv index 8c33820..b270233 100644 --- a/interfaces/axis_if.sv +++ b/interfaces/axis_if.sv @@ -17,17 +17,19 @@ interface axis_if #( parameter ); - logic [ DATA_W-1:0 ] tdata; - logic [ ID_W-1:0 ] tdest; - logic [ ID_W-1:0 ] tid; - logic [ DATA_W/8-1:0 ] tkeep; - logic tlast; - logic tready; - logic [ USER_W-1:0 ] tuser; - logic tvalid; + localparam KEEP_W = DATA_W/8; + + logic [DATA_W-1:0] tdata; + logic [ ID_W-1:0] tdest; + logic [ ID_W-1:0] tid; + logic [KEEP_W-1:0] tkeep; + logic tlast; + logic tready; + logic [USER_W-1:0] tuser; + logic tvalid; - modport master( + modport master_mp( input tready, @@ -41,7 +43,7 @@ interface axis_if #( parameter ); - modport slave( + modport slave_mp( input tdata, input tdest, diff --git a/interfaces/wb_if.sv b/interfaces/wb_if.sv new file mode 100644 index 0000000..b98d929 --- /dev/null +++ b/interfaces/wb_if.sv @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// wb_if.sv +// published as part of https://github.com/pConst/basic_verilog +// Konstantin Pavlov, pavlovconst@gmail.com +//------------------------------------------------------------------------------ + + +// INFO ------------------------------------------------------------------------ +// Wishbone instantiation +// + + +interface wb_if #( parameter + ADDR_W = 32, + DATA_W = 32, + SEL_W = 4 + //TAG_W = 4 +); + + + logic ack; + logic [ADDR_W-1:0] adr; + logic cyc; + logic [DATA_W-1:0] dat; + logic [DATA_W-1:0] dat; + logic err; + logic rty; + logic [ SEL_W-1:0] sel; + logic stb; + //logic [ TAG_W-1:0] tgd; // user-defined TAG signals + logic we; + + + modport master_mp( + + input ack, + input dat, + input err, + input rty, + + output adr, + output cyc, + output dat, + output sel, + output stb, + //output tgd, + output we + ); + + + modport slave_mp( + + input adr, + input cyc, + input dat, + input sel, + input stb, + //input tgd, + input we, + + output ack, + output dat, + output err, + output rty + ); + + +endinterface +