Verig HDL 语法讲座.ppt

Verig HDL 语法讲座

大部分综合工具都能按照约定,正确地处理在源代码中用注释行表示的指导综合器如何转换到门级网表的指令即综合指令。 可以在 Verilog 语句之间用注释行嵌入综合指令,Verilog 仿真器运行时将忽略嵌入的指令,而当综合工具编译时,这些符合约定的综合指令是有意义的,能对综合过程进行干预和指导。 不同的综合工具有不同的综合指令集,使用综合指令为的是:使同样的RTL代码能综合出更高质量优化的门级网表。 下面列出了一部分 Cadence 综合工具支持的综合指令,它们与其他综合工具(例如:Synopsys DC)中的指令非常相似。 //ambit synthesis on //ambit synthesis off //ambit synthesis case=full、parallel、mux 语法详细讲解 综合指令 * 结构指令 //ambit synthesis architecture=cla or rpl 有限状态机指令 //ambit synthesis enum xyz //ambit synthesis stat_vector sig state_vector_flag 注:指令中通常包括综合工具或公司的名称,例如:上面指令中的ambit 表示使用的综合器是Envisia Ambit。 语法详细讲解 综合指令 * 当Verilog 模块中case –endcase 块被综合时,有多种门级实现方法可 供选择:综合指令case 可以用来干预综合过程。让由case 指定的编 译方式被综合器优先考虑,即采用 case = 后列出的方法转换为门级 电路。case 综合指令的含义如下所示: //ambit synthesis case=parallel 对解码逻辑进行并行编译,没有优先级。 //ambit synthesis case=mux 如果库中含有多路器,则使用多路器编译解码逻辑。 //ambit synthesis case=full 不用考虑没有包含在 case 条件语句中的情形(即这些情形不会发生),这样设定,可以综合出的优化的门级逻辑,并可避免发生状态机死锁。 语法详细讲解 综合指令 语法详细讲解 综合指令 * 完整条件语句 module comcase(a, b, c, d, e); input a, b, c, d; output e; reg e; always @(a or b or c or d) case ({a,b}) 2’b11: e=d; 2’b10: e=~c; 2’b01: e=1’b0; 2’b00: e=1’b1; endcase endmodule 语法详细讲解 条件语句 * module compif(a, b, c, d, e); input a, b, c, d; output e; reg e; always @(a or b or c or d) if(ab) e=d; else if (a~b) e=~c; else if (~ ab) e=1’b0; else if (~a~b) e=1’b1; endmodule 语法详细讲解 条件语句 * module inccase(a, b, c, d, e); input a, b, c, d; output e; reg e; always @(a or b or c ord) case ({a,b}) 2’b11: e=d; 2’b10: e=~c; endcase endmodule 语法详细讲解 不完整条件语句 * module incpif(a, b, c, d, e); input a, b, c, d; output e; reg e; always @(a or b or c or d) if (ab) e=d; else if(a~b) e=~c; endmodule 语法详细讲解 不完整条件语句 * 在前面所述的例子中,当 a 为 0 时,没有值赋给 e。因此,e 将保存原来的值,直到 a 变为 1。此行为与锁存器的特性相同。 语法详细讲解 不完整条件语句 * module comcase(a, b, c, d, e); input a, b, c, d; output e; reg e; always @(a or b or c or d) case ({a,b})

文档评论(0)

1亿VIP精品文档

相关文档