Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4630|回复: 3

[求助] 新人请教各位大神,一组变量对应几组数值,应如何编程

[复制链接]
发表于 2014-9-27 11:21:18 | 显示全部楼层 |阅读模式
本帖最后由 hunduanic 于 2014-9-27 11:39 编辑

      新人小白,求指教,在cadence ocean中,现在我有5个变量:gm4,gm3,gm2,gm1,gm0。这5个变量的总的变化是:11111,01111,00111,00011,00001,00000。我想弄一个像数组一样的列表,让5个变量依次遍历一下,请问应该用什么指令,怎么写呢?比如这样:
(gm4 gm3 gm2 gm1 gm0)=(11111 01111 00111 00011 00001 00000)
      我想弄数组一类的原因是还有好几组变量也和这个类似,只有几种变化,而不是2^n的变化,因此学一下其他的几组变量也能用了。而根据变量数值间关系编程的话,不具有通用性,嘿嘿,小弟先行谢谢各位了。


发表于 2014-9-27 15:57:46 | 显示全部楼层
直接用数组存储不行吗?
 楼主| 发表于 2014-9-27 16:05:23 | 显示全部楼层
vivienluo 发表于 2014-9-27 15:57
直接用数组存储不行吗?

首先,谢谢回复,我刚刚接触,纯小白一枚,网上找的教程没有看到数组方面的,请问数组应该怎么列呢?
发表于 2014-9-27 17:53:17 | 显示全部楼层
hunduanic 发表于 2014-9-27 16:05
首先,谢谢回复,我刚刚接触,纯小白一枚,网上找的教程没有看到数组方面的,请问数组应该怎么列呢?

Allocating an Array of a Given Size

Use the declare function to allocate an array of a given size.

declare( week[7] )       => array[7]:9780700
week                     => array[7]:9780700
type( week )             => array
arrayp( week )           => t
days = '(monday tuesday wednesday
                  thursday friday saturday sunday)
for( day 0 length(week)-1
      week[day] = nth(day days))
The declare function returns the reference to the array storage and stores it as the value of week.

The type function returns the symbol array.

The arrayp function returns t.

更多关于数组的请查看参考文档。。。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|网站地图|Cadence Skill 论坛 ( 蜀ICP备13024417号 )

GMT+8, 2024-5-3 11:50 , Processed in 0.145004 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表