纽扣虽小,搭配却至关重要——Pin Assignment

640?wx_fmt=gif

今天介绍一下Physical budget中Pin Assignment步骤。首先,关于pin的定义,器件的pin,一般指器件外部的引脚,与各种wire相连。而这里所讲的pin是指partition pin。一般来说,top层上的IO端口,我们称之为Port。而top下面,各个hierarchy module的端口,我们一般称之为Partition Pin。当这个partition被push down下去,成为block后,被单独load之后,这些pin又会变成IO pin。如下图所示:这些长条状的阴影小条就是pin了。从attribute editor中也可以看出他的type是partition pin.

640?wx_fmt=jpeg

640?wx_fmt=jpeg

别看这些pin小,但它在整个hierarchy flow中起着至关重要的作用。类似一件衣服上的纽扣一样,是各个block能顺利拼接合并的关键。那pin assignment的功能就是给纽扣排位置。位置排的不好,再好看的布料做出来的衣服都没人愿意穿。

我们知道,在chip中,定义好每个partition,并切割下去,每个block分别各自完成布局布线的操作,然后再在顶层top level中实现合并。你可能会奇怪,在block level中,我们看不到外面的情况,那拼接时,其中的net是如何顺利找到对应的顶层中的net?其实靠得就是这些小小的partition pin。它是physical上,guide各个block连接的关键。看下面的简单的示意图:

640?wx_fmt=jpeg

上图中,绿色部分是各个partition。当做完pin assignment之后,在每个partition的各自边界上会长出不同layer的partition pin。有了这些pin,就定义好了每个block的input和output pin,图中蓝色部分。在block level中,我们不能改变pin的位置,否则就无法完成顶层收回的操作。

 

那pin的位置可以随便定义吗?答案显示然是不能的,合理的pin的位置,不仅能guide block的connection,而且会对时序的结果产生重要影响。看下面的对比示意图:

tableIns1 = table.render({ elem: '#showTable' , contentType: 'application/json' , page: true //开启分页 , url: ctx + 'caninfo/listByPage' , method: 'POST' , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据 return { "code": res.code, //解析接口状态 "msg": res.msg, //解析提示文本 "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度 "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表 } } , cols: [ [ {type: 'checkbox', fixed: 'left'}, {field: 'id', title: 'id', sort: true, width: 'auto'}, {field: '车型', title: langData.vehicle_model, sort: true, width: 'auto'}, {field: '模块', title: langData.module, sort: true, width: 'auto'}, {field: '总线类型', title: langData.bus_type, sort: true, width: 'auto', align: 'center'}, {field: '诊断协议', title: langData.diagnostic_protocol, sort: true, width: 'auto', align: 'center'}, {field: '引脚', title: langData.pin, sort: true, width: 'auto'}, {field: '波特率', title: langData.baud_rate, sort: true, width: 'auto', align: 'center'}, {field: '请求ID', title: langData.request_id, sort: true, width: 'auto', align: 'center'}, {field: '接收ID', title: langData.receive_id, sort: true, width: 'auto', align: 'center'}, {field: '流控帧', title: langData.flow_control_frame, sort: true, width: 'auto', align: 'center'}, {field: '填充', title: langData.padding, sort: true, width: 'auto', align: 'center'}, {field: '故障码长度', title: langData.dtc_length, sort: true, width: 'auto', align: 'center'}, {field: '清故障码', title: langData.clear_dtc, sort: true, width: 'auto', align: 'center'}, {field: '读故障码', title: langData.read_dtc, sort: true, width: 'auto', align: 'center'}, {fixed: 'right', width: 130, toolbar: "#tool", title: langData.operation, align: 'center'}
04-04
<think>好的,我现在需要帮助用户解决如何正确配置LayUI的table.render方法来实现表格展示、分页功能,以及自定义列字段和样式的问题。让我先仔细分析用户的需求和提供的引用内容。 首先,用户提到了三个引用,都是关于LayUI表格渲染和分页的配置。引用1讲的是使用Vue的Render函数自定义列头显示内容,但用户的问题是关于LayUI的,所以可能用户是想了解类似的自定义方法在LayUI中的实现。引用2和3都是关于LayUI的table.render方法的具体配置,尤其是分页参数的设置和列定义。用户的主要问题集中在如何正确设置table.render方法,包括分页和自定义列字段及样式。 接下来,我需要回忆LayUI的表格组件文档。table.render是LayUI中初始化表格的核心方法,需要配置elem指定容器,url指定数据源,page开启分页,cols定义列结构。分页功能需要后端支持分页参数,比如page和limit,这在引用3中提到需要修改分页携带的参数,用户可能需要调整这些参数名以匹配后端接口。 关于列定义,引用2中的例子展示了如何定义字段名、标题、对齐方式和固定列。用户可能需要设置每列的field、title、align等属性,以及可能的自定义模板。此外,引用1虽然涉及Vue,但用户可能想了解如何在LayUI中自定义列的内容,比如使用templet选项或者模板函数。 现在需要整理一个步骤指南。首先,基础配置包括elem、url、page等。然后,处理分页参数,可能需要像引用3中那样修改请求参数,适配后端的分页参数名称,比如size和page。接着,列定义部分,每个列的field对应数据字段,title设置列标题,align调整对齐方式,可能还需要使用templet来自定义内容显示,比如添加图标或样式。 还需要注意响应数据的格式,LayUI默认期望数据包含code、msg、count、data等字段,如果后端返回结构不同,需要parseData回调函数进行转换。例如,如果后端返回的是total和rows,就需要在parseData中映射count和data。 样式自定义方面,除了align,还可以使用width设置列宽,templet使用函数返回HTML内容,或者使用固定列fixed属性。用户可能还需要处理表头样式,比如引用1中的Render函数,但在LayUI中可能需要使用头部模板或其他方式。 最后,测试和调试,确保分页参数正确传递,数据加载正常,列显示符合预期。如果有问题,检查浏览器控制台的网络请求和响应数据格式是否正确,参数是否匹配后端要求。 总结步骤:配置table.render的基本参数,处理分页参数和响应数据,定义列结构和样式,处理数据映射,最后测试调整。需要确保每个部分都正确设置,特别是分页参数和列定义部分,可能涉及多个配置项,如page、limit、cols中的各个属性,以及parseData和request参数的重写。</think>### LayUI表格渲染及分页功能配置指南 #### 一、基础配置结构 使用`table.render()`方法时需包含以下核心参数: ```javascript table.render({ elem: '#tableId', // 绑定容器选择器 url: '/api/data', // 数据接口地址 page: true, // 开启分页功能 cols: [[/* 列配置 */]], // 二维数组定义列结构 // 其他扩展参数... }); ``` #### 二、分页参数设置 1. **适配后端接口参数**(参考引用[3]) ```javascript request: { pageName: 'page', // 当前页码参数名 limitName: 'size' // 每页数据量参数名 }, response: { statusName: 'code', // 状态字段 countName: 'total', // 数据总数字段 dataName: 'rows' // 数据列表字段 } ``` 2. **自定义分页参数格式**(如需要复杂参数结构) ```javascript where: { extraParam1: 'value', extraParam2: 123 } ``` #### 三、列定义与样式配置 1. **基础列定义**(参考引用[2]) ```javascript cols: [[ {field: 'id', title: 'ID', width: 80, fixed: 'left'}, {field: 'username', title: '用户名', align: 'center'}, {field: 'createTime', title: '创建时间', sort: true} ]] ``` 2. **自定义列样式**(三种实现方式) - **方式1:直接模板** ```javascript {templet: '#genderTpl', title: '性别'} ``` ```html <script type="text/html" id="genderTpl"> {{# if(d.gender === 1){ }} <span class="layui-badge">男</span> {{# } else { }} <span class="layui-badge layui-bg-orange">女</span> {{# } }} </script> ``` - **方式2:函数模板** ```javascript {templet: function(d){ return `<i class="layui-icon ${d.icon}"></i> ${d.title}`; }} ``` - **方式3:内容对齐与溢出处理** ```javascript {align: 'center', style: 'max-width: 200px;text-overflow: ellipsis;'} ``` #### 四、完整配置示例 ```javascript table.render({ elem: '#demoTable', url: '/api/user/list', toolbar: '#toolbarDemo', page: true, request: { pageName: 'page', limitName: 'size' }, response: { statusCode: 200, countName: 'total', dataName: 'rows' }, cols: [[ {type: 'checkbox', fixed: 'left'}, {field: 'id', title: 'ID', width: 80, sort: true}, {field: 'username', title: '用户名', width: 150, align: 'center'}, {field: 'email', title: '邮箱', templet: '#emailLinkTpl'}, {field: 'status', title: '状态', templet: function(d){ return d.status ? '启用' : '停用'; }}, {fixed: 'right', width: 160, align: 'center', toolbar: '#actionBarTpl'} ]] }); ``` #### 五、注意事项 1. **数据格式验证**:确保接口返回数据格式与`response`配置匹配,特别是`count`总条数和`data`数组字段 2. **样式覆盖**:通过CSS覆盖默认样式时,使用`!important`提升优先级 3. **性能优化**:大数据量时建议开启`limit: 20`分页限制,避免前端渲染卡顿 4. **跨域问题**:需要后端配置`Access-Control-Allow-Origin`等CORS头信息
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值