https://mp.weixin.qq.com/s/GrYJ4KXEFRoLLmLnAGoMSA

 

原理图

 

参考链接

https://github.com/wjcdx/jchdl/blob/master/src/org/jchdl/model/gsl/example/Mux4.java

 

 

1.创建Mux4.java, 并生成构造方法和logic()方法

 

根据逻辑原理图,添加输入输出线

 

 

3. 在构造方法中搜集输入输出线并调用construct()方法

 

4. 在logic()方法中创建子节点并连线

 

5. 创建inst静态方法方便后续使用

 

6. 创建main方法执行验证

 

运行结果为:

 

四种组合逐个选择i0~i3中的值。

 

7. 生成Verilog

 

执行结果如下:

 

org.jchdl.model.gsl.core.datatype.net.Wire;

org.jchdl.model.gsl.core.meta.Node;

org.jchdl.model.gsl.core.meta.PropagateManager;

org.jchdl.model.gsl.core.value.Value;

org.jchdl.model.gsl.operator.conditional.Mux;

 

Node {

;

;

;

;

;

;

;

 

Wire();

Wire();

 

Mux4(Wire out, Wire i0, Wire i1, Wire i2, Wire i3, Wire s1, Wire s0) {

(i0, i1, i2, i3, s1, s0));

out(out);

construct();

}

 

@Override

logic() {

));

));

));

));

));

));

));

 

);

);

);

}

 

Mux4 inst(Wire out, Wire i0, Wire i1, Wire i2, Wire i3, Wire s1, Wire s0) {

Mux4(out, i0, i1, i2, i3, s1, s0);

}

 

main(String[] args) {

);

);

);

);

);

);

Wire();

(out, i0, i1, i2, i3, s1, s0);

 

(i0, i1, i2, i3, s1, s0);

+ out.getValue().toString());

 

);

);

(s1, s0);

+ out.getValue().toString());

 

);

);

(s1, s0);

+ out.getValue().toString());

 

);

);

(s1, s0);

+ out.getValue().toString());

 

mux4.toVerilog();

}

}

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案