electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Concatenate String in Verilog?


Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> Concatenate String in Verilog?
Author Message
davyzhu



Joined: 23 May 2004
Posts: 521
Helped: 3
Location: oriental


Post01 Apr 2006 2:40   

verilog concatenation


Hi all,
I want to open a lot of files and read data to reg.

something like
//-----code--------
$readmemh(".\pattern\0.dat",inmem0);
$readmemh(".\pattern\1.dat",inmem1);
...
$readmemh(".\pattern\49.dat",inmem49);
//-----code end----

I want to use something like strcat() in C to concatenate the string.
So, I can use a loop to replace large block of code above.
Is there any method to do this work in Verilog?

Any suggestions will be appreciated!
Best regards,
Davy
Back to top
Google
AdSense
Google Adsense




Post01 Apr 2006 2:40   

Ads




Back to top
funzero



Joined: 19 Nov 2004
Posts: 204
Helped: 8


Post01 Apr 2006 6:17   

verilog string concatenation


you can try this:
case(i):
0: begin $readmemh("./pattern/mem_0.dat, mem0_reg);end
1:begin $readmemh("./pattern/mem_1.dat,mem1_reg);end
default: begin $display(" Nothing to Open " ); end
endcase
Back to top
jarodz



Joined: 12 Mar 2005
Posts: 100
Helped: 14


Post01 Apr 2006 7:16   

verilog concatenate string


hi davyzhu,
You can use $swrite to do what you want or use the attach file that I had implement C-like string manipulation function in verilog task.

Sincerely,
Jarod



Sorry, but you need login in to view this attachment

Back to top
aji_vlsi



Joined: 10 Sep 2004
Posts: 640
Helped: 72
Location: Bangalore, India


Post01 Apr 2006 8:06   

verilog concatenate


davyzhu wrote:
Hi all,
I want to open a lot of files and read data to reg.

something like
//-----code--------
$readmemh(".\pattern\0.dat",inmem0);
$readmemh(".\pattern\1.dat",inmem1);
...
$readmemh(".\pattern\49.dat",inmem49);
//-----code end----

I want to use something like strcat() in C to concatenate the string.
So, I can use a loop to replace large block of code above.
Is there any method to do this work in Verilog?

Any suggestions will be appreciated!
Best regards,
Davy


Verilog/SV has $sformat that is pretty close to sprintf in C - guess that's what you need here.

HTH
Ajeetha, CVC
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> Concatenate String in Verilog?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Load String in a memory ( verilog ) (1)
How to concatenate matrix in matlab? (3)
Need to slit a logic_vector - opposite of concatenate (3)
PicBasic string (5)
reverse of string. (1)
[C] String Problem? (2)
String Teory (6)
string to ascii (1)
string problem (5)
string searching algorithm (11)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS