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

Verilog simple but bit confusing


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Verilog simple but bit confusing
Author Message
balan



Joined: 18 Feb 2007
Posts: 43


Post25 Jun 2009 16:32   

Verilog simple but bit confusing


Let me know the output of this program

module tb;
reg [15:0] a;
initial begin
a=28'hff00;
$display("a = %h",a);
$display("a = %0h",a);
$display("a = %7h",a);

end
endmodule
Back to top
balan



Joined: 18 Feb 2007
Posts: 43


Post27 Jun 2009 5:50   

Re: Verilog simple but bit confusing


whether the result which i get is expected.

1st display
ff00
2nd display
ff00
3rd display
ff00

Is that correct
Back to top
sheik_vb



Joined: 21 Jul 2006
Posts: 63
Helped: 3


Post27 Jun 2009 8:43   

Re: Verilog simple but bit confusing


Yes Correct.
Back to top
Google
AdSense
Google Adsense




Post27 Jun 2009 8:43   

Ads




Back to top
balan



Joined: 18 Feb 2007
Posts: 43


Post28 Jun 2009 4:09   

Re: Verilog simple but bit confusing


The reg a is 16 bit, but the assignment is a = 28'h ff00 (assigned as 28 bit).

In the display we have given as $display("%7h",a)

I expect the value to be
000ff00.

Please let me know does %7h has any effect.
Back to top
tiger_cn



Joined: 28 Jun 2009
Posts: 1


Post28 Jun 2009 8:43   

Verilog simple but bit confusing


There must be something wrong with your answer.
you can simular with modelsim and you can see de result are:

1st display
ff00
2nd display
ff
3rd display
___ff00 (_means Space bar)
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 -> PLD, SPLD, GAL, CPLD, FPGA Design -> Verilog simple but bit confusing
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
simple but unique dC project (5)
[help] I measure a simple structure, but... (1)
PIC: Simple circuit but something wrong? (8)
LC oscillator - simple but temperature resistive (4)
Simple but decent quality USB oscilloscope (9)
A simple question but nearly make me crazy (6)
a simple question about bandgap, but really troubled m (12)
please it is simple but so important (2)
Kind of Simple but its bugging me? (2)
U2270 It's very simple, but what's wrong? (1)


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