
ビット論理演算方法
3 views (last 30 days)
Show older comments
assign a = (x > 17'd1000)|(x < 17'd300);
assign b = (x > 17'd3620)|(x < 17'd583);
assign c = (x > 17'd2512)|(x < 17'd121);
assign d = (x > 17'd2133)|(x < 17'd363);
assign e = (x > 17'd3145)|(x < 17'd696);
assign f = (x > 17'd1525)|(x < 17'd99);
assign g = (x > 17'd3055)|(x < 17'd69);
をsimulinkのブロックを使って実装しようとしているが、
そのままx信号とconstantの比較をしてそれを一々ORゲートを通すとすると
余計にブロック図は大きくなり非効率的だと思い
質問します。
質問:constant信号を1 x nの入力でORゲートを通すことで可能な方法があるのでしょうか?
いくつか試してみたところで欲しい結果を得られなくて質問しました。
0 Comments
Accepted Answer
Musashi Ito
on 7 Dec 2019
Simulinkではベクトルが使用できますので、Constant ブロックにベクトルで定義する方法はいかがでしょうか。Relational Operator ブロックでベクトルの要素ごとに比較され、Logical Operator ブロック(OR) でもベクトルの要素ごとに OR されます。取り出すときは、demux や selector ブロックで取り出します。

Relational Operator ブロックを使用してますが、Compare to Constant ブロックに直接設定しても良いかと思います。
0 Comments
More Answers (0)
See Also
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!