Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

concatenating bits example

Status
Not open for further replies.

lh-

Member level 1
Joined
Oct 5, 2016
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
277
i have the following example:

Code:
reg A;
reg[1:0] B, C;
reg[2:0] D;
reg[15:0] Y;

A = 1'b1;
B = 2'b01;
C = 2'b10;
D = 3'b110;
Y = { 2{A}, 3{B}, C, 2{D} };

and the result is:
Code:
Y = 10'b 1000_1111_1010_0101

i understand that {} is the concatenation operator but how does it work here?
2{A} means 2*1 = 10, then where does the 1000 come from?
or 3{B}?
 

I don't think that result is correct. I get 11_010101_10_110110 = 1101_0101_1011_0110.

2{A} means "replicate A two times"
 
  • Like
Reactions: lh-

    lh-

    Points: 2
    Helpful Answer Positive Rating
what i wrote was the option chosen as correct answer in a test question, i guess it's just wrong. and okay, i get it now. there's another option with your result which should be the correct result. thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top