source: PlatformSupport/CustomPeripherals/pcores/radio_controller_axi_v3_01_a/hdl/verilog/radio_mirror_regs.v

Last change on this file was 2943, checked in by murphpo, 10 years ago
File size: 2.7 KB
Line 
1module radio_mirror_regs (
2    input          clk,
3    input          reset,
4    input   [13:0] spi_reg_wr_data,
5    input   [ 3:0] spi_reg_wr_addr,
6    input          spi_reg_wr_en,
7   
8    output  [13:0] mirror_reg0,
9    output  [13:0] mirror_reg1,
10    output  [13:0] mirror_reg2,
11    output  [13:0] mirror_reg3,
12    output  [13:0] mirror_reg4,
13    output  [13:0] mirror_reg5,
14    output  [13:0] mirror_reg6,
15    output  [13:0] mirror_reg7,
16    output  [13:0] mirror_reg8,
17    output  [13:0] mirror_reg9,
18    output  [13:0] mirror_regA,
19    output  [13:0] mirror_regB,
20    output  [13:0] mirror_regC
21);
22
23wire [13:0] radio_mirrorRegs [12:0]; //Thirteen 14-bit registers
24
25assign mirror_reg0 = radio_mirrorRegs[0];
26assign mirror_reg1 = radio_mirrorRegs[1];
27assign mirror_reg2 = radio_mirrorRegs[2];
28assign mirror_reg3 = radio_mirrorRegs[3];
29assign mirror_reg4 = radio_mirrorRegs[4];
30assign mirror_reg5 = radio_mirrorRegs[5];
31assign mirror_reg6 = radio_mirrorRegs[6];
32assign mirror_reg7 = radio_mirrorRegs[7];
33assign mirror_reg8 = radio_mirrorRegs[8];
34assign mirror_reg9 = radio_mirrorRegs[9];
35assign mirror_regA = radio_mirrorRegs[10];
36assign mirror_regB = radio_mirrorRegs[11];
37assign mirror_regC = radio_mirrorRegs[12];
38
39localparam MAX2829_REG0_ON_RESET = 14'b01000101000000;
40localparam MAX2829_REG1_ON_RESET = 14'b00000011001010;
41localparam MAX2829_REG2_ON_RESET = 14'b01000000000111;
42localparam MAX2829_REG3_ON_RESET = 14'b11000010100010;
43localparam MAX2829_REG4_ON_RESET = 14'b01110111011101;
44localparam MAX2829_REG5_ON_RESET = 14'b01100000100100;
45localparam MAX2829_REG6_ON_RESET = 14'b01110000000000;
46localparam MAX2829_REG7_ON_RESET = 14'b00000000101010;
47localparam MAX2829_REG8_ON_RESET = 14'b00000000100101;
48localparam MAX2829_REG9_ON_RESET = 14'b00001000000000;
49localparam MAX2829_REGA_ON_RESET = 14'b00001111000000;
50localparam MAX2829_REGB_ON_RESET = 14'b00000001111111;
51localparam MAX2829_REGC_ON_RESET = 14'b00000000000000;
52
53localparam MAX2829_REGS_ON_RESET = {MAX2829_REGC_ON_RESET, MAX2829_REGB_ON_RESET, MAX2829_REGA_ON_RESET,
54                                    MAX2829_REG9_ON_RESET, MAX2829_REG8_ON_RESET, MAX2829_REG7_ON_RESET,
55                                    MAX2829_REG6_ON_RESET, MAX2829_REG5_ON_RESET, MAX2829_REG4_ON_RESET,
56                                    MAX2829_REG3_ON_RESET, MAX2829_REG2_ON_RESET, MAX2829_REG1_ON_RESET,
57                                    MAX2829_REG0_ON_RESET};
58
59genvar bit_index;
60genvar reg_index;
61for(reg_index = 0; reg_index <= 12; reg_index = reg_index + 1) begin: MIRROR_REGS_GEN
62    for(bit_index = 0; bit_index <= 13; bit_index = bit_index + 1) begin: MIRROR_REGS_BITS_GEN
63        FDRE #(.INIT(MAX2829_REGS_ON_RESET[(reg_index * 14) + bit_index])) FDRE_RFA_MIRRORREG (
64          .C(clk),
65          .CE(spi_reg_wr_en & (spi_reg_wr_addr == reg_index)),
66          .R(reset),
67          .D(spi_reg_wr_data[bit_index]),
68          .Q(radio_mirrorRegs[reg_index][bit_index])
69       );
70    end
71end
72
73endmodule
Note: See TracBrowser for help on using the repository browser.