///////////////////////////////////////////////////////////////////// //// //// //// SBOX //// //// The SBOX is essentially a 64x4 ROM //// //// //// //// Author: Rudolf Usselmann //// //// rudi@asics.ws //// //// //// ///////////////////////////////////////////////////////////////////// //// //// //// Copyright (C) 2001 Rudolf Usselmann //// //// rudi@asics.ws //// //// //// //// This source file may be used and distributed without //// //// restriction provided that this copyright statement is not //// //// removed from the file and that any derivative work contains //// //// the original copyright notice and the associated disclaimer.//// //// //// //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //// //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //// //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //// //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //// //// 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. //// //// //// ///////////////////////////////////////////////////////////////////// module sbox2(addr, dout); input [1:6] addr; output [1:4] dout; reg [1:4] dout; always @(addr) begin case ({addr[1], addr[6], addr[2:5]}) //synopsys full_case parallel_case 0: dout = 15; 1: dout = 1; 2: dout = 8; 3: dout = 14; 4: dout = 6; 5: dout = 11; 6: dout = 3; 7: dout = 4; 8: dout = 9; 9: dout = 7; 10: dout = 2; 11: dout = 13; 12: dout = 12; 13: dout = 0; 14: dout = 5; 15: dout = 10; 16: dout = 3; 17: dout = 13; 18: dout = 4; 19: dout = 7; 20: dout = 15; 21: dout = 2; 22: dout = 8; 23: dout = 14; 24: dout = 12; 25: dout = 0; 26: dout = 1; 27: dout = 10; 28: dout = 6; 29: dout = 9; 30: dout = 11; 31: dout = 5; 32: dout = 0; 33: dout = 14; 34: dout = 7; 35: dout = 11; 36: dout = 10; 37: dout = 4; 38: dout = 13; 39: dout = 1; 40: dout = 5; 41: dout = 8; 42: dout = 12; 43: dout = 6; 44: dout = 9; 45: dout = 3; 46: dout = 2; 47: dout = 15; 48: dout = 13; 49: dout = 8; 50: dout = 10; 51: dout = 1; 52: dout = 3; 53: dout = 15; 54: dout = 4; 55: dout = 2; 56: dout = 11; 57: dout = 6; 58: dout = 7; 59: dout = 12; 60: dout = 0; 61: dout = 5; 62: dout = 14; 63: dout = 9; endcase end endmodule