agorararmard | 6c766a8 | 2020-12-10 18:13:12 +0200 | [diff] [blame] | 1 | // SPDX-FileCopyrightText: 2020 Efabless Corporation |
agorararmard | e5780bf | 2020-12-09 21:27:56 +0000 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
agorararmard | afa96ea | 2020-12-09 23:37:31 +0200 | [diff] [blame] | 14 | // SPDX-License-Identifier: Apache-2.0 |
agorararmard | e5780bf | 2020-12-09 21:27:56 +0000 | [diff] [blame] | 15 | |
Matt Venn | 08cd6eb | 2020-11-16 12:01:14 +0100 | [diff] [blame] | 16 | `default_nettype none |
Tim Edwards | 04ba17f | 2020-10-02 22:27:50 -0400 | [diff] [blame] | 17 | // This module represents an unprogrammed mask revision |
| 18 | // block that is configured with via programming on the |
| 19 | // chip top level. This value is passed to the block as |
| 20 | // a parameter |
| 21 | |
| 22 | module user_id_programming #( |
| 23 | parameter [ 0:0] USER_PROJECT_ID = 32'h0 |
| 24 | ) ( |
Ahmed Ghazy | 27200e9 | 2020-11-25 22:07:02 +0200 | [diff] [blame] | 25 | `ifdef USE_POWER_PINS |
manarabdelaty | c752431 | 2020-12-07 18:13:54 +0200 | [diff] [blame] | 26 | inout VPWR, |
| 27 | inout VGND, |
Ahmed Ghazy | 27200e9 | 2020-11-25 22:07:02 +0200 | [diff] [blame] | 28 | `endif |
Tim Edwards | 04ba17f | 2020-10-02 22:27:50 -0400 | [diff] [blame] | 29 | output [31:0] mask_rev |
| 30 | ); |
| 31 | wire [31:0] mask_rev; |
| 32 | wire [31:0] user_proj_id_high; |
| 33 | wire [31:0] user_proj_id_low; |
| 34 | |
| 35 | // For the mask revision input, use an array of digital constant logic cells |
| 36 | |
| 37 | sky130_fd_sc_hd__conb_1 mask_rev_value [31:0] ( |
Ahmed Ghazy | 64c17e8 | 2020-11-18 20:17:26 +0200 | [diff] [blame] | 38 | `ifdef USE_POWER_PINS |
manarabdelaty | c752431 | 2020-12-07 18:13:54 +0200 | [diff] [blame] | 39 | .VPWR(VPWR), |
| 40 | .VPB(VPWR), |
| 41 | .VNB(VGND), |
| 42 | .VGND(VGND), |
Ahmed Ghazy | 64c17e8 | 2020-11-18 20:17:26 +0200 | [diff] [blame] | 43 | `endif |
Tim Edwards | 04ba17f | 2020-10-02 22:27:50 -0400 | [diff] [blame] | 44 | .HI(user_proj_id_high), |
| 45 | .LO(user_proj_id_low) |
| 46 | ); |
| 47 | |
| 48 | genvar i; |
| 49 | generate |
| 50 | for (i = 0; i < 32; i = i+1) begin |
| 51 | assign mask_rev[i] = (USER_PROJECT_ID & (32'h01 << i)) ? |
| 52 | user_proj_id_high[i] : user_proj_id_low[i]; |
| 53 | end |
| 54 | endgenerate |
| 55 | |
| 56 | endmodule |
Tim Edwards | 581068f | 2020-11-19 12:45:25 -0500 | [diff] [blame] | 57 | `default_nettype wire |