Continue to Site

Welcome to

Welcome to our site! 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.

Matlab(simulink) and Modelsim Cosimulation

Not open for further replies.


Member level 3
May 15, 2011
Reaction score
Trophy points
Activity points
Hello everybody,

I'm trying to link Modelsim to matlab.
i've built a block using modelsim that has 6 inputs clock, reset , and it will take the other 4 values from matlab's workspace and its output will be taken to a "scope component" to display the output on it..

i followed the required steps but when i click "start simulation" in simulink window the error message below occur
Error reported by S-function 'shdlcosim' in 'testing_env/HDL Cosimulation/S-Function':
Continuous sample time not allowed for input port 0 of cosim block.
i don't know what is this input "port 0 of cosim block" ..
i thought its related to the clock as i'm connecting the "clock input port" by a "clock component" from the simulink library and setting the clocks tab to a rising edge clock at the same time..

when i removed the clock component the error message was the same except it becomes for input port 1 as below
Error reported by S-function 'shdlcosim' in 'testing_env/HDL Cosimulation/S-Function':
Continuous sample time not allowed for input port 1 of cosim block.

any idea how can i overcome this plzzz..

I'm using matlab (R2010a), modelsim PE

any help plzzz

Last edited:

You need to make the simulation discrete time steps rather than the continuous one you have.
IIRC, its in simulation-> options -> simulation time or something like that - make it discrete.

Im also concerned you have 6 clocks? why 6?

Hii TrickyDicky,

i only have 1 clk
i meant that i'm having 6 inputs
clk , rst, in1, in2, in3, in4

i made some work arround
*removed the clk port and set it in the clocks tab
*let the rst takes its input from a constant instead of a step

but i don't know
*why having the rst takes its input from step dosen't work??? is there is a problem with using step component??
*how to adjust the clock signal with that in the modelsim so that each play represents a single clock in modelsim not 5 displays
having for each play click from matlab simulink

Π_ in modelsim wave window

instead of


any idea plzz...

Last edited:

the number of clocks will depend on the relationship between one simulink "second" (ie a 1 time step) and the time period of the clock in the clock tab.

Not open for further replies.

Part and Inventory Search

Welcome to