Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Basic questions: Multiple modules and using "#"

Added by Patrick Mulder 2 months ago

Hello,

I want to play with some simple modules and signals and tried this:

module half_adder(x,y,s,c);                         
  input x, y;                                       
  output s, c;                                      

  xor(s,x,y);                                       
  and(c,x,y);                                       

endmodule                                           

module our;                                         

   reg[1:0] in;                                     
   wire[3:0] out;                                   

   initial begin                                    
     $display("Start.");                            

     in = 2'b00;                                    
     #5                                             
     $display("input: %b", in);                     

     $finish;                                       
   end                                              

endmodule                                           

1) Can I write several modules in one .v file? If not how would I structure these best?

2) How would I put a simple time model (using # equivalent) into the sim?

Thanks!


Replies (1)

RE: Basic questions: Multiple modules and using "#" - Added by Wilson Snyder 2 months ago

1) Yes, you can put multiple modules per file.

2) You'd write this in C code, for example in = 0; then make time pass and call topp->eval(), then print the value.

However if you're just doing this to learn Verilog you might want to consider using Icarus Verilog instead, as then most of the examples you find online will work directly as written.

    (1-1/1)