ビット論理演算方法
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
maruti
le 6 Déc 2019
Réponse apportée : Musashi Ito
le 7 Déc 2019
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 commentaires
Réponse acceptée
Musashi Ito
le 7 Déc 2019
Simulinkではベクトルが使用できますので、Constant ブロックにベクトルで定義する方法はいかがでしょうか。Relational Operator ブロックでベクトルの要素ごとに比較され、Logical Operator ブロック(OR) でもベクトルの要素ごとに OR されます。取り出すときは、demux や selector ブロックで取り出します。
Relational Operator ブロックを使用してますが、Compare to Constant ブロックに直接設定しても良いかと思います。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!